diff options
author | Kai Shi <kaishi@google.com> | 2020-06-01 21:23:26 -0700 |
---|---|---|
committer | Kai Shi <kaishi@google.com> | 2020-06-01 22:37:38 -0700 |
commit | 175269fd8db424e61b3ab5e3b8e9ffa85681ab60 (patch) | |
tree | 3c1548fd6fa1ea10d1ee4a4240e4465aee8ca5c8 /service | |
parent | 4d77b3f79c3e44a9c227e2901020951ca274fda9 (diff) |
Add mainlineModuleVersion in WifiMetrics
Add mainlineModuleVersion in WifiMetrics and use getLongVersionCode() to
extract mainline module version.
Updated-PDD: TRUE
Bug: 157944630
Test: atest com.android.server.wifi
Test: manual test with adb shell dumpsys wifi | grep -C 10
WifiHealthMonitor
Change-Id: I9add15029014e549c1644244e130d8e7d4237d33
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiHealthMonitor.java | 23 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 3 | ||||
-rw-r--r-- | service/proto/src/metrics.proto | 3 | ||||
-rw-r--r-- | service/proto/src/scorecard.proto | 2 |
4 files changed, 22 insertions, 9 deletions
diff --git a/service/java/com/android/server/wifi/WifiHealthMonitor.java b/service/java/com/android/server/wifi/WifiHealthMonitor.java index 27167dccf..8ab3a74a6 100644 --- a/service/java/com/android/server/wifi/WifiHealthMonitor.java +++ b/service/java/com/android/server/wifi/WifiHealthMonitor.java @@ -326,6 +326,15 @@ public class WifiHealthMonitor { pw.println("WifiHealthMonitor - Log End ----"); } + /** + * Get current wifi mainline module long version code + * @Return a non-zero value if version code is available, 0 otherwise. + */ + public long getWifiStackVersion() { + WifiSoftwareBuildInfo currentBuild = getWifiSystemInfoStats().getCurrSoftwareBuildInfo(); + return (currentBuild == null) ? 0 : currentBuild.getWifiStackVersion(); + } + private synchronized void dailyDetectionHandler() { logd("Run daily detection"); // Clear daily detection result @@ -533,12 +542,12 @@ public class WifiHealthMonitor { return null; } PackageManager packageManager = mContext.getPackageManager(); - int wifiStackVersion = 0; + long wifiStackVersion = 0; try { wifiStackVersion = packageManager.getPackageInfo( - WIFI_APK_PACKAGE_NAME, PackageManager.MATCH_APEX).versionCode; + WIFI_APK_PACKAGE_NAME, PackageManager.MATCH_APEX).getLongVersionCode(); } catch (PackageManager.NameNotFoundException e) { - Log.e(TAG, " hit PackageManager nameNotFoundException"); + Log.e(TAG, " Hit PackageManager exception", e); } String osBuildVersion = replaceNullByEmptyString(Build.DISPLAY); if (mWifiNative == null) { @@ -629,10 +638,10 @@ public class WifiHealthMonitor { */ final class WifiSoftwareBuildInfo { private String mOsBuildVersion; - private int mWifiStackVersion; + private long mWifiStackVersion; private String mWifiDriverVersion; private String mWifiFirmwareVersion; - WifiSoftwareBuildInfo(@NonNull String osBuildVersion, int wifiStackVersion, + WifiSoftwareBuildInfo(@NonNull String osBuildVersion, long wifiStackVersion, @NonNull String wifiDriverVersion, @NonNull String wifiFirmwareVersion) { mOsBuildVersion = osBuildVersion; mWifiStackVersion = wifiStackVersion; @@ -648,7 +657,7 @@ public class WifiHealthMonitor { String getOsBuildVersion() { return mOsBuildVersion; } - int getWifiStackVersion() { + long getWifiStackVersion() { return mWifiStackVersion; } String getWifiDriverVersion() { @@ -842,7 +851,7 @@ public class WifiHealthMonitor { @NonNull SoftwareBuildInfo softwareBuildInfo) { String osBuildVersion = softwareBuildInfo.hasOsBuildVersion() ? softwareBuildInfo.getOsBuildVersion() : "NA"; - int stackVersion = softwareBuildInfo.hasWifiStackVersion() + long stackVersion = softwareBuildInfo.hasWifiStackVersion() ? softwareBuildInfo.getWifiStackVersion() : 0; String driverVersion = softwareBuildInfo.hasWifiDriverVersion() ? softwareBuildInfo.getWifiDriverVersion() : "NA"; diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index dbd532541..e23779e85 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -4359,8 +4359,9 @@ public class WifiMetrics { initialPartialScanStats.failedScanChannelCountHistogram = mInitPartialScanFailureHistogram.toProto(); mWifiLogProto.initPartialScanStats = initialPartialScanStats; - mWifiLogProto.carrierWifiMetrics = mCarrierWifiMetrics.toProto(); + mWifiLogProto.mainlineModuleVersion = mWifiHealthMonitor.getWifiStackVersion(); + } } diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index eaea7342b..349543d59 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -712,6 +712,9 @@ message WifiLog { // Metrics about carrier wifi network. optional CarrierWifiMetrics carrier_wifi_metrics = 200; + + // Long version code of wifi mainline module, 0 means not available. + optional int64 mainline_module_version = 201; } // Information that gets logged for every WiFi connection. diff --git a/service/proto/src/scorecard.proto b/service/proto/src/scorecard.proto index ad5822c72..d351c5666 100644 --- a/service/proto/src/scorecard.proto +++ b/service/proto/src/scorecard.proto @@ -146,7 +146,7 @@ message SoftwareBuildInfo { // Android OS build version optional string os_build_version = 1; // WiFi stack APK version, 0 means not available. - optional int32 wifi_stack_version = 2; + optional int64 wifi_stack_version = 2; // WiFi driver version optional string wifi_driver_version = 3; // WiFi firmware version |