From 3c3f237d683fd095f171043b22b915a14c528685 Mon Sep 17 00:00:00 2001 From: Purushottam Kushwaha Date: Fri, 15 May 2020 14:47:15 +0530 Subject: PNO: Store PNO settings before startHwPnoScan(). PNO settings are stored only when startHwPnoScan() call succeeds. In cases where call to startHwPnoScan() fails (ex: driver returns EBUSY), reportPnoScanFailure() is invoked which notifies the registered listeners only if PNO settings are present. This CL is to store PNO settings before calling startHwPnoScan() API. Thus, caller is notified on failure. Also, clearing pno scan failure count from stopConnectivityScan() API results in PNO scan getting scheduled indefinitely as long as PNO start fails. This CL moves clearing of pno scan failure count to stop(). Bug: 156713311 Test: atest com.android.server.wifi Change-Id: I6e9cac1b1597cad54b45498d8e19469a4a2b3f5e Signed-off-by: Purushottam Kushwaha --- .../wifi/scanner/WificondPnoScannerTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') 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 @@ -106,6 +106,28 @@ public class WificondPnoScannerTest extends WifiBaseTest { verifyNoMoreInteractions(pnoEventHandler); } + /** + * 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. -- cgit v1.2.3