diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-05-16 00:59:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-16 00:59:55 +0000 |
commit | 6b55795b9224c5e80218bc7e102835374cb7a692 (patch) | |
tree | 034b60a10bf0736de86120612d9770c226053704 | |
parent | b9b695b0f9d240b306a0f4d67ca94816e7115035 (diff) | |
parent | 3c3f237d683fd095f171043b22b915a14c528685 (diff) |
Merge "PNO: Store PNO settings before startHwPnoScan()." into rvc-dev
3 files changed, 27 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index ed647cb69..8470d0c7d 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -1572,7 +1572,6 @@ public class WifiConnectivityManager { cancelPeriodicScanTimer(); cancelDelayedPartialScan(); stopPnoScan(); - mScanRestartCount = 0; } /** @@ -1905,6 +1904,7 @@ public class WifiConnectivityManager { mWaitForFullBandScanResults = false; mLatestCandidates = null; mLatestCandidatesTimestampMs = 0; + mScanRestartCount = 0; } /** diff --git a/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java b/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java index 4a48ed252..66e0cfbaa 100644 --- a/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java +++ b/service/java/com/android/server/wifi/scanner/WificondScannerImpl.java @@ -437,12 +437,11 @@ public class WificondScannerImpl extends WifiScannerImpl implements Handler.Call return false; } - if (startHwPnoScan(settings)) { - mLastPnoScanSettings = new LastPnoScanSettings( - mClock.getElapsedSinceBootMillis(), - settings.networkList, eventHandler); + mLastPnoScanSettings = new LastPnoScanSettings( + mClock.getElapsedSinceBootMillis(), + settings.networkList, eventHandler); - } else { + if (!startHwPnoScan(settings)) { Log.e(TAG, "Failed to start PNO scan"); reportPnoScanFailure(); } diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java index a43950d0e..152095c8d 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java @@ -107,6 +107,28 @@ public class WificondPnoScannerTest extends WifiBaseTest { } /** + * Verify that the HW disconnected PNO scan triggers a wificond PNO scan and invokes the + * OnPnoScanFailed callback when the scan fails. + */ + @Test + public void startHwDisconnectedPnoScanFailure() { + createScannerWithHwPnoScanSupport(); + + WifiNative.PnoEventHandler pnoEventHandler = mock(WifiNative.PnoEventHandler.class); + WifiNative.PnoSettings pnoSettings = createDummyPnoSettings(false); + + InOrder order = inOrder(pnoEventHandler, mWifiNative); + + // Fail PNO scan + when(mWifiNative.startPnoScan(eq(IFACE_NAME), any(WifiNative.PnoSettings.class))) + .thenReturn(false); + assertTrue(mScanner.setHwPnoList(pnoSettings, pnoEventHandler)); + order.verify(mWifiNative).startPnoScan(any(), any(WifiNative.PnoSettings.class)); + order.verify(pnoEventHandler).onPnoScanFailed(); + verifyNoMoreInteractions(pnoEventHandler); + } + + /** * Verify that the HW PNO scan stop failure still resets the PNO scan state. * 1. Start Hw PNO. * 2. Stop Hw PNO scan which raises a stop command to WifiNative which is failed. |