diff options
author | Kai Shi <kaishi@google.com> | 2020-03-12 16:35:38 -0700 |
---|---|---|
committer | Kai Shi <kaishi@google.com> | 2020-03-12 23:42:22 +0000 |
commit | 38ac66aaa9d9f9526f700d693ab8c5207103a85b (patch) | |
tree | bfc3895fc4731e0524319482810e7ffb4002cedf /tests | |
parent | 4ec33363089faf54b56253f6b32f05bd309ef117 (diff) |
Bug fix of WifiHealthMonitor when Wifi is not up
When Wifi is disabled during boot up, WLAN driver/FW build/Wifi APK version information are not available. Current WifiHealthMonitor still tries to extract these information and results in a false detection of SW build change in this case.
To work around the problem, skip SW build change detection if it is found that WiFi is not enabled after boot up.
Bug: 151351913
Test: atest com.android.server.wifi
Test: manual test with adb commands
1)enable wifi verbose
2)keep Wifi on, reboot the phone, run "adb logcat WifiHealthMonitor:d *:s", confirm there is no SW build change detected (assuming there is SW build change before reboot)
3)disable Wifi through UI, reboot the phone, run the same adb command,
confirm that there is no sW build change detected during post-boot
detection.
Change-Id: I98df4092cd6953e6c9d99b7ddbc417b7562fc9ca
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java index 55ac03388..89de82675 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java @@ -557,9 +557,22 @@ public class WifiHealthMonitorTest extends WifiBaseTest { // Day 2 String firmwareVersion = "HW 1.2"; makeSwBuildChangeExample(firmwareVersion); + // Disable WiFi before post-boot-detection + mWifiHealthMonitor.setWifiEnabled(false); mAlarmManager.dispatch(WifiHealthMonitor.POST_BOOT_DETECTION_TIMER_TAG); mLooper.dispatchAll(); + // Skip SW build change detection PerNetwork perNetwork = mWifiScoreCard.fetchByNetwork(mWifiInfo.getSSID()); + assertEquals(DEFAULT_HEALTH_MONITOR_MIN_NUM_CONNECTION_ATTEMPT * 1, + perNetwork.getStatsCurrBuild().getCount(WifiScoreCard.CNT_CONNECTION_ATTEMPT)); + assertEquals(DEFAULT_HEALTH_MONITOR_MIN_NUM_CONNECTION_ATTEMPT * 0, + perNetwork.getStatsPrevBuild().getCount(WifiScoreCard.CNT_CONNECTION_ATTEMPT)); + + // Day 3 + mWifiHealthMonitor.setWifiEnabled(true); + mAlarmManager.dispatch(WifiHealthMonitor.POST_BOOT_DETECTION_TIMER_TAG); + mLooper.dispatchAll(); + // Finally detect SW build change assertEquals(0, perNetwork.getStatsCurrBuild().getCount(WifiScoreCard.CNT_CONNECTION_ATTEMPT)); assertEquals(DEFAULT_HEALTH_MONITOR_MIN_NUM_CONNECTION_ATTEMPT * 1, |