summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2020-08-28 18:03:41 -0700
committerKai Shi <kaishi@google.com>2020-09-08 20:44:06 +0000
commit42317137d8c9bda389c7bd6cf7d5378d60b3bdc0 (patch)
treed8c7c558f572ff61b5989a3e02b4b35ff02ba260 /service
parente1af31c338db20727c554349e0344761dd2d4438 (diff)
wifi: get the correct mainline version when wifi is disabled
update getWifiStackVersion() to return the correct mainline version even when wifi is disabled. Bug: 166835054 Test: atest com.android.server.wifi Test: manual test to confirm post-boot detection can detect SW version change correctly Change-Id: I3eb878145a761452ddcfdd0b5c424e78212fc799 Merged-In: I3eb878145a761452ddcfdd0b5c424e78212fc799
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiHealthMonitor.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/service/java/com/android/server/wifi/WifiHealthMonitor.java b/service/java/com/android/server/wifi/WifiHealthMonitor.java
index 7b68ffce8..b21ea516d 100644
--- a/service/java/com/android/server/wifi/WifiHealthMonitor.java
+++ b/service/java/com/android/server/wifi/WifiHealthMonitor.java
@@ -330,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() {
@@ -540,19 +552,7 @@ public class WifiHealthMonitor {
if (!mWifiEnabled) {
return null;
}
- 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);
- }
+ long wifiStackVersion = getWifiStackVersion();
String osBuildVersion = replaceNullByEmptyString(Build.DISPLAY);
if (mWifiNative == null) {
return null;