diff options
author | Kai Shi <kaishi@google.com> | 2020-09-09 23:32:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-09-09 23:32:21 +0000 |
commit | 59d3999893e4f2bade6c81bd2a7187a63a433c16 (patch) | |
tree | c1c284cd43cddfaa5028cd95c492e6558f6e77f1 /service | |
parent | 2a2fc39e77bf780fbb2e98255738c818c5927392 (diff) | |
parent | 42317137d8c9bda389c7bd6cf7d5378d60b3bdc0 (diff) |
Merge changes from topic "mainlineVersion" into rvc-qpr-dev
* changes:
wifi: get the correct mainline version when wifi is disabled
wifi:get wifi stack version from com.android.wifi
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiHealthMonitor.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/service/java/com/android/server/wifi/WifiHealthMonitor.java b/service/java/com/android/server/wifi/WifiHealthMonitor.java index bc1f9af01..b21ea516d 100644 --- a/service/java/com/android/server/wifi/WifiHealthMonitor.java +++ b/service/java/com/android/server/wifi/WifiHealthMonitor.java @@ -24,6 +24,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.app.AlarmManager; import android.content.Context; +import android.content.pm.ModuleInfo; import android.content.pm.PackageManager; import android.net.MacAddress; import android.net.wifi.ScanResult; @@ -76,7 +77,7 @@ public class WifiHealthMonitor { "WifiHealthMonitor Schedule Post-Boot Detection Timer"; // Package name of WiFi mainline module found from the following adb command // adb shell pm list packages --apex-only| grep wifi - private static final String WIFI_APK_PACKAGE_NAME = "com.google.android.wifi"; + private static final String WIFI_APEX_NAME = "com.android.wifi"; private static final String SYSTEM_INFO_DATA_NAME = "systemInfoData"; // The time that device waits after device boot before triggering post-boot detection. // This needs be long enough so that memory read can complete before post-boot detection. @@ -329,8 +330,20 @@ public class WifiHealthMonitor { * @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(); + PackageManager packageManager = mContext.getPackageManager(); + long wifiStackVersion = 0; + try { + ModuleInfo wifiModule = packageManager.getModuleInfo( + WIFI_APEX_NAME, PackageManager.MODULE_APEX_NAME); + String wifiPackageName = wifiModule.getPackageName(); + if (wifiPackageName != null) { + wifiStackVersion = packageManager.getPackageInfo( + wifiPackageName, PackageManager.MATCH_APEX).getLongVersionCode(); + } + } catch (PackageManager.NameNotFoundException e) { + Log.e(TAG, " Hit PackageManager exception", e); + } + return wifiStackVersion; } private synchronized void dailyDetectionHandler() { @@ -539,14 +552,7 @@ public class WifiHealthMonitor { if (!mWifiEnabled) { return null; } - PackageManager packageManager = mContext.getPackageManager(); - long wifiStackVersion = 0; - try { - wifiStackVersion = packageManager.getPackageInfo( - WIFI_APK_PACKAGE_NAME, PackageManager.MATCH_APEX).getLongVersionCode(); - } catch (PackageManager.NameNotFoundException e) { - Log.e(TAG, " Hit PackageManager exception", e); - } + long wifiStackVersion = getWifiStackVersion(); String osBuildVersion = replaceNullByEmptyString(Build.DISPLAY); if (mWifiNative == null) { return null; |