diff options
author | Roshan Pius <rpius@google.com> | 2016-09-12 13:41:36 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2016-09-16 15:34:21 -0700 |
commit | 6259b630ddb59b642729a2d2113d81ed8e33a0e3 (patch) | |
tree | cf530b3b6b1ad5cf9fa62f038d95bcc6204c0df2 /tests | |
parent | 5c6da02cf7736d4ba9fc388151177f5277464c89 (diff) |
WifiScanningService: Change hidden/PNO scan params
Since networks are no longer configured in wpa_supplicant, network
IDs/priorities being passed around for hidden/PNO scanning does not make
any sense. Changing the wifi scanner interface to remove all
network ID/priority references.
For hidden networks, we'll now send a sorted array of <ssid> for
each network (similar to PNO). This should help wificond prioritize
networks when the size exceed the max supported by driver.
Also, since wpa_supplicant already supports sending a list of ssids for
scanning, plumb it all the way through.
NOTE:
1. The backend for all these scans will eventually be replaced by
wificond.
2. Hidden networks are no longer considered in bgscan requests. This was
anyway not workin in HalWifiScanner's gscan backed bgscan.
BUG: 29503772
TEST: Existing unit tests.
TEST: Successfully connected to a hidden network on device
Change-Id: Ie7783353d2eb87c2fd7b9a10f44e3e5df4cbc218
Diffstat (limited to 'tests')
7 files changed, 72 insertions, 86 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java b/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java index 87c7975cc..ab9a7620e 100644 --- a/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java +++ b/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java @@ -111,12 +111,16 @@ public class ScanTestUtil { } /** - * Add the provided hidden network IDs to scan request. - * @param networkIds List of hidden network IDs + * Add the provided hidden network SSIDs to scan request. + * @param networkSSIDs List of hidden network SSIDs * @return builder object */ - public NativeScanSettingsBuilder withHiddenNetworkIds(int[] networkIds) { - mSettings.hiddenNetworkIds = networkIds; + public NativeScanSettingsBuilder withHiddenNetworkSSIDs(String[] networkSSIDs) { + mSettings.hiddenNetworks = new WifiNative.HiddenNetwork[networkSSIDs.length]; + for (int i = 0; i < networkSSIDs.length; i++) { + mSettings.hiddenNetworks[i] = new WifiNative.HiddenNetwork(); + mSettings.hiddenNetworks[i].ssid = networkSSIDs[i]; + } return this; } @@ -371,10 +375,6 @@ public class ScanTestUtil { for (int i = 0; i < expected.networkList.length; i++) { assertEquals("networkList[" + i + "].ssid", expected.networkList[i].ssid, actual.networkList[i].ssid); - assertEquals("networkList[" + i + "].networkId", - expected.networkList[i].networkId, actual.networkList[i].networkId); - assertEquals("networkList[" + i + "].priority", - expected.networkList[i].priority, actual.networkList[i].priority); assertEquals("networkList[" + i + "].flags", expected.networkList[i].flags, actual.networkList[i].flags); assertEquals("networkList[" + i + "].auth_bit_field", diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java index b5579d68c..af5ca8fe2 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java @@ -195,10 +195,9 @@ public class WifiConfigurationUtilTest { @Test public void testCreatePnoNetworkWithOpenNetwork() { WifiConfiguration network = WifiConfigurationTestUtil.createOpenNetwork(); - network.networkId = 5; WifiScanner.PnoSettings.PnoNetwork pnoNetwork = WifiConfigurationUtil.createPnoNetwork(network, 1); - assertEquals(network.networkId, pnoNetwork.networkId); + assertEquals(network.SSID, pnoNetwork.ssid); assertEquals( WifiScanner.PnoSettings.PnoNetwork.FLAG_A_BAND | WifiScanner.PnoSettings.PnoNetwork.FLAG_G_BAND, pnoNetwork.flags); @@ -213,10 +212,9 @@ public class WifiConfigurationUtilTest { @Test public void testCreatePnoNetworkWithOpenHiddenNetwork() { WifiConfiguration network = WifiConfigurationTestUtil.createOpenHiddenNetwork(); - network.networkId = 5; WifiScanner.PnoSettings.PnoNetwork pnoNetwork = WifiConfigurationUtil.createPnoNetwork(network, 1); - assertEquals(network.networkId, pnoNetwork.networkId); + assertEquals(network.SSID, pnoNetwork.ssid); assertEquals( WifiScanner.PnoSettings.PnoNetwork.FLAG_A_BAND | WifiScanner.PnoSettings.PnoNetwork.FLAG_G_BAND @@ -232,10 +230,9 @@ public class WifiConfigurationUtilTest { @Test public void testCreatePnoNetworkWithPskNetwork() { WifiConfiguration network = WifiConfigurationTestUtil.createPskNetwork(); - network.networkId = 5; WifiScanner.PnoSettings.PnoNetwork pnoNetwork = WifiConfigurationUtil.createPnoNetwork(network, 1); - assertEquals(network.networkId, pnoNetwork.networkId); + assertEquals(network.SSID, pnoNetwork.ssid); assertEquals( WifiScanner.PnoSettings.PnoNetwork.FLAG_A_BAND | WifiScanner.PnoSettings.PnoNetwork.FLAG_G_BAND, pnoNetwork.flags); @@ -250,10 +247,9 @@ public class WifiConfigurationUtilTest { @Test public void testCreatePnoNetworkWithEapNetwork() { WifiConfiguration network = WifiConfigurationTestUtil.createEapNetwork(); - network.networkId = 5; WifiScanner.PnoSettings.PnoNetwork pnoNetwork = WifiConfigurationUtil.createPnoNetwork(network, 1); - assertEquals(network.networkId, pnoNetwork.networkId); + assertEquals(network.SSID, pnoNetwork.ssid); assertEquals( WifiScanner.PnoSettings.PnoNetwork.FLAG_A_BAND | WifiScanner.PnoSettings.PnoNetwork.FLAG_G_BAND, pnoNetwork.flags); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 3ed98fac7..5e6359326 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -617,7 +617,7 @@ public class WifiStateMachineTest { return null; } - private void verifyScan(int band, int reportEvents, Set<Integer> configuredNetworkIds) { + private void verifyScan(int band, int reportEvents, Set<String> hiddenNetworkSSIDSet) { ArgumentCaptor<WifiScanner.ScanSettings> scanSettingsCaptor = ArgumentCaptor.forClass(WifiScanner.ScanSettings.class); ArgumentCaptor<WifiScanner.ScanListener> scanListenerCaptor = @@ -628,16 +628,16 @@ public class WifiStateMachineTest { assertEquals("band", band, actualSettings.band); assertEquals("reportEvents", reportEvents, actualSettings.reportEvents); - if (configuredNetworkIds == null) { - configuredNetworkIds = new HashSet<>(); + if (hiddenNetworkSSIDSet == null) { + hiddenNetworkSSIDSet = new HashSet<>(); } - Set<Integer> actualConfiguredNetworkIds = new HashSet<>(); - if (actualSettings.hiddenNetworkIds != null) { - for (int i = 0; i < actualSettings.hiddenNetworkIds.length; ++i) { - actualConfiguredNetworkIds.add(actualSettings.hiddenNetworkIds[i]); + Set<String> actualHiddenNetworkSSIDSet = new HashSet<>(); + if (actualSettings.hiddenNetworks != null) { + for (int i = 0; i < actualSettings.hiddenNetworks.length; ++i) { + actualHiddenNetworkSSIDSet.add(actualSettings.hiddenNetworks[i].ssid); } } - assertEquals("configured networks", configuredNetworkIds, actualConfiguredNetworkIds); + assertEquals("hidden networks", hiddenNetworkSSIDSet, actualHiddenNetworkSSIDSet); when(mWifiNative.getScanResults()).thenReturn(getMockScanResults()); mWsm.sendMessage(WifiMonitor.SCAN_RESULTS_EVENT); @@ -665,15 +665,20 @@ public class WifiStateMachineTest { public void scanWithHiddenNetwork() throws Exception { addNetworkAndVerifySuccess(true); + Set<String> hiddenNetworkSet = new HashSet<>(); + hiddenNetworkSet.add(sSSID); + List<WifiScanner.ScanSettings.HiddenNetwork> hiddenNetworkList = new ArrayList<>(); + hiddenNetworkList.add(new WifiScanner.ScanSettings.HiddenNetwork(sSSID)); + when(mWifiConfigManager.retrieveHiddenNetworkList()).thenReturn(hiddenNetworkList); + mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE); mWsm.startScan(-1, 0, null, null); mLooper.dispatchAll(); - //TODO(b/29503772): Retrieve the list of hidden networks to scan for. verifyScan(WifiScanner.WIFI_BAND_BOTH_WITH_DFS, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN | WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT, - null); + hiddenNetworkSet); } @Test diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java index 4f2c6ce84..b348f0191 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java @@ -120,7 +120,7 @@ public abstract class BaseWifiScannerImplTest { .build(); doSuccessfulSingleScanTest(settings, expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), - new HashSet<Integer>(), + new HashSet<String>(), ScanResults.create(0, isAllChannelsScanned(WifiScanner.WIFI_BAND_24_GHZ), 2400, 2450, 2450, 2400, 2450, 2450, 2400, 2450, 2450), false); } @@ -134,7 +134,7 @@ public abstract class BaseWifiScannerImplTest { .build(); doSuccessfulSingleScanTest(settings, createFreqSet(5650), - new HashSet<Integer>(), + new HashSet<String>(), ScanResults.create(0, 5650, 5650, 5650, 5650, 5650, 5650, 5650, 5650), false); } @@ -150,7 +150,7 @@ public abstract class BaseWifiScannerImplTest { .build(); doSuccessfulSingleScanTest(settings, expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), - new HashSet<Integer>(), + new HashSet<String>(), ScanResults.create(0, isAllChannelsScanned(WifiScanner.WIFI_BAND_24_GHZ), 2400, 2450, 2450, 2400, 2450, 2450, 2400, 2450, 2450), true); } @@ -161,20 +161,20 @@ public abstract class BaseWifiScannerImplTest { */ @Test public void singleScanSuccessWithHiddenNetworkIds() { - int[] hiddenNetworkIds = {0, 5}; + String[] hiddenNetworkSSIDs = {"test_ssid_1", "test_ssid_2"}; WifiNative.ScanSettings settings = new NativeScanSettingsBuilder() .withBasePeriod(10000) .withMaxApPerScan(10) - .withHiddenNetworkIds(hiddenNetworkIds) + .withHiddenNetworkSSIDs(hiddenNetworkSSIDs) .addBucketWithChannels(20000, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, 5650) .build(); - Set<Integer> hiddenNetworkIdSet = new HashSet<Integer>(); - for (int i = 0; i < hiddenNetworkIds.length; i++) { - hiddenNetworkIdSet.add(hiddenNetworkIds[i]); + Set<String> hiddenNetworkSSIDSet = new HashSet<>(); + for (int i = 0; i < hiddenNetworkSSIDs.length; i++) { + hiddenNetworkSSIDSet.add(hiddenNetworkSSIDs[i]); } doSuccessfulSingleScanTest(settings, createFreqSet(5650), - hiddenNetworkIdSet, + hiddenNetworkSSIDSet, ScanResults.create(0, 5650, 5650, 5650, 5650, 5650, 5650, 5650, 5650), false); } @@ -184,20 +184,25 @@ public abstract class BaseWifiScannerImplTest { */ @Test public void singleScanSuccessWithTruncatedHiddenNetworkIds() { - int[] hiddenNetworkIds = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; + String[] hiddenNetworkSSIDs = { + "test_ssid_0", "test_ssid_1", "test_ssid_2", "test_ssid_3", "test_ssid_4", + "test_ssid_5", "test_ssid_6", "test_ssid_7", "test_ssid_8", "test_ssid_9", + "test_ssid_10", "test_ssid_11", "test_ssid_12", "test_ssid_13", "test_ssid_14", + "test_ssid_15", "test_ssid_16", "test_ssid_17", "test_ssid_18", "test_ssid_19" + }; WifiNative.ScanSettings settings = new NativeScanSettingsBuilder() .withBasePeriod(10000) .withMaxApPerScan(10) - .withHiddenNetworkIds(hiddenNetworkIds) + .withHiddenNetworkSSIDs(hiddenNetworkSSIDs) .addBucketWithChannels(20000, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, 5650) .build(); - Set<Integer> hiddenNetworkIdSet = new HashSet<Integer>(); + Set<String> hiddenNetworkSSIDSet = new HashSet<>(); for (int i = 0; i < SupplicantWifiScannerImpl.MAX_HIDDEN_NETWORK_IDS_PER_SCAN; i++) { - hiddenNetworkIdSet.add(hiddenNetworkIds[i]); + hiddenNetworkSSIDSet.add(hiddenNetworkSSIDs[i]); } doSuccessfulSingleScanTest(settings, createFreqSet(5650), - hiddenNetworkIdSet, + hiddenNetworkSSIDSet, ScanResults.create(0, 5650, 5650, 5650, 5650, 5650, 5650, 5650, 5650), false); } @@ -368,7 +373,7 @@ public abstract class BaseWifiScannerImplTest { expectSuccessfulSingleScan(order, eventHandler, expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), - new HashSet<Integer>(), + new HashSet<String>(), ScanResults.create(0, isAllChannelsScanned(WifiScanner.WIFI_BAND_24_GHZ), 2400, 2450, 2450), false); @@ -377,7 +382,7 @@ public abstract class BaseWifiScannerImplTest { expectSuccessfulSingleScan(order, eventHandler, expectedBandScanFreqs(WifiScanner.WIFI_BAND_BOTH_WITH_DFS), - new HashSet<Integer>(), + new HashSet<String>(), ScanResults.create(0, true, 5150, 5175), false); @@ -479,7 +484,7 @@ public abstract class BaseWifiScannerImplTest { } protected void doSuccessfulSingleScanTest(WifiNative.ScanSettings settings, - Set<Integer> expectedScan, Set<Integer> expectedHiddenNetIds, ScanResults results, + Set<Integer> expectedScan, Set<String> expectedHiddenNetSSIDs, ScanResults results, boolean expectFullResults) { WifiNative.ScanEventHandler eventHandler = mock(WifiNative.ScanEventHandler.class); @@ -491,7 +496,7 @@ public abstract class BaseWifiScannerImplTest { // start scan assertTrue(mScanner.startSingleScan(settings, eventHandler)); - expectSuccessfulSingleScan(order, eventHandler, expectedScan, expectedHiddenNetIds, + expectSuccessfulSingleScan(order, eventHandler, expectedScan, expectedHiddenNetSSIDs, results, expectFullResults); verifyNoMoreInteractions(eventHandler); @@ -499,8 +504,8 @@ public abstract class BaseWifiScannerImplTest { protected void expectSuccessfulSingleScan(InOrder order, WifiNative.ScanEventHandler eventHandler, Set<Integer> expectedScan, - Set<Integer> expectedHiddenNetIds, ScanResults results, boolean expectFullResults) { - order.verify(mWifiNative).scan(eq(expectedScan), eq(expectedHiddenNetIds)); + Set<String> expectedHiddenNetSSIDs, ScanResults results, boolean expectFullResults) { + order.verify(mWifiNative).scan(eq(expectedScan), eq(expectedHiddenNetSSIDs)); when(mWifiNative.getScanResults()).thenReturn(results.getScanDetailArrayList()); diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java index 76ce5ff31..34b0b102c 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java @@ -24,14 +24,12 @@ import static org.mockito.Mockito.*; import android.app.test.TestAlarmManager; import android.content.Context; -import android.os.test.TestLooper; -import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiScanner; import android.os.SystemClock; +import android.os.test.TestLooper; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.R; - import com.android.server.wifi.Clock; import com.android.server.wifi.MockResources; import com.android.server.wifi.MockWifiMonitor; @@ -47,10 +45,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; - /** * Unit tests for {@link com.android.server.wifi.scanner.SupplicantWifiScannerImpl.setPnoList}. */ @@ -122,8 +118,7 @@ public class SupplicantPnoScannerTest { assertTrue(mScanner.startSingleScan(settings, eventHandler)); // Verify that the PNO scan was paused and single scan runs successfully expectSuccessfulSingleScanWithHwPnoEnabled(order, eventHandler, - expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), new HashSet<Integer>(), - scanResults); + expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), scanResults); verifyNoMoreInteractions(eventHandler); order = inOrder(pnoEventHandler, mWifiNative); @@ -192,8 +187,7 @@ public class SupplicantPnoScannerTest { assertTrue(mScanner.startSingleScan(settings, eventHandler)); // Verify that the PNO scan was paused and single scan runs successfully expectSuccessfulSingleScanWithHwPnoEnabled(order, eventHandler, - expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), new HashSet<Integer>(), - scanResults); + expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), scanResults); verifyNoMoreInteractions(eventHandler); // Fail the PNO resume and check that the OnPnoScanFailed callback is invoked. @@ -283,7 +277,7 @@ public class SupplicantPnoScannerTest { pnoSettings.networkList = Arrays.copyOf(pnoSettings.networkList, pnoSettings.networkList.length + 1); pnoSettings.networkList[pnoSettings.networkList.length - 1] = - createDummyPnoNetwork("ssid_pno_new", 6, 6); + createDummyPnoNetwork("ssid_pno_new"); startSuccessfulPnoScan(null, pnoSettings, null, pnoEventHandler); // This should bypass the debounce timer and stop PNO scan immediately and then start @@ -359,11 +353,9 @@ public class SupplicantPnoScannerTest { new SupplicantWifiScannerImpl(mContext, mWifiNative, mLooper.getLooper(), mClock); } - private WifiNative.PnoNetwork createDummyPnoNetwork(String ssid, int networkId, int priority) { + private WifiNative.PnoNetwork createDummyPnoNetwork(String ssid) { WifiNative.PnoNetwork pnoNetwork = new WifiNative.PnoNetwork(); pnoNetwork.ssid = ssid; - pnoNetwork.networkId = networkId; - pnoNetwork.priority = priority; return pnoNetwork; } @@ -371,8 +363,8 @@ public class SupplicantPnoScannerTest { WifiNative.PnoSettings pnoSettings = new WifiNative.PnoSettings(); pnoSettings.isConnected = isConnected; pnoSettings.networkList = new WifiNative.PnoNetwork[2]; - pnoSettings.networkList[0] = createDummyPnoNetwork("ssid_pno_1", 1, 1); - pnoSettings.networkList[1] = createDummyPnoNetwork("ssid_pno_2", 2, 2); + pnoSettings.networkList[0] = createDummyPnoNetwork("ssid_pno_1"); + pnoSettings.networkList[1] = createDummyPnoNetwork("ssid_pno_2"); return pnoSettings; } @@ -422,12 +414,6 @@ public class SupplicantPnoScannerTest { */ private void expectHwDisconnectedPnoScanStart(InOrder order, WifiNative.PnoSettings pnoSettings) { - for (int i = 0; i < pnoSettings.networkList.length; i++) { - WifiNative.PnoNetwork network = pnoSettings.networkList[i]; - order.verify(mWifiNative).setNetworkVariable(network.networkId, - WifiConfiguration.priorityVarName, Integer.toString(network.priority)); - order.verify(mWifiNative).enableNetworkWithoutConnect(network.networkId); - } // Verify HW PNO scan started order.verify(mWifiNative).setPnoScan(true); } @@ -458,11 +444,11 @@ public class SupplicantPnoScannerTest { */ private void expectSuccessfulSingleScanWithHwPnoEnabled(InOrder order, WifiNative.ScanEventHandler eventHandler, Set<Integer> expectedScanFreqs, - Set<Integer> expectedHiddenNetIds, ScanResults scanResults) { + ScanResults scanResults) { // Pause PNO scan first order.verify(mWifiNative).setPnoScan(false); - order.verify(mWifiNative).scan(eq(expectedScanFreqs), eq(expectedHiddenNetIds)); + order.verify(mWifiNative).scan(eq(expectedScanFreqs), any(Set.class)); when(mWifiNative.getScanResults()).thenReturn(scanResults.getScanDetailArrayList()); diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java index 7bf548109..8a578c6f6 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java @@ -38,7 +38,6 @@ import org.junit.Test; import org.mockito.InOrder; import java.util.ArrayList; -import java.util.HashSet; import java.util.Set; /** @@ -327,7 +326,7 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest { assertBackgroundPeriodAlarmPending(); expectFailedScanStart(order, eventHandler, - expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), new HashSet<Integer>()); + expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ)); // Fire alarm to start next scan dispatchBackgroundPeriodAlarm(); @@ -335,7 +334,7 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest { assertBackgroundPeriodAlarmPending(); expectFailedScanStart(order, eventHandler, - expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), new HashSet<Integer>()); + expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ)); verifyNoMoreInteractions(eventHandler); } @@ -362,7 +361,7 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest { assertBackgroundPeriodAlarmPending(); expectFailedEventScan(order, eventHandler, - expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), new HashSet<Integer>()); + expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ)); // Fire alarm to start next scan dispatchBackgroundPeriodAlarm(); @@ -370,7 +369,7 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest { assertBackgroundPeriodAlarmPending(); expectFailedEventScan(order, eventHandler, - expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ), new HashSet<Integer>()); + expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ)); verifyNoMoreInteractions(eventHandler); } @@ -610,7 +609,7 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest { } } expectSuccessfulBackgroundScan(order, eventHandler, period.getScanFreqs(), - new HashSet<Integer>(), nativeResults, scanDatas, fullResults, periodId); + nativeResults, scanDatas, fullResults, periodId); } /** @@ -619,11 +618,11 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest { */ private void expectSuccessfulBackgroundScan(InOrder order, WifiNative.ScanEventHandler eventHandler, Set<Integer> scanFreqs, - Set<Integer> networkIds, ArrayList<ScanDetail> nativeResults, + ArrayList<ScanDetail> nativeResults, WifiScanner.ScanData[] expectedScanResults, ScanResult[] fullResults, int periodId) { // Verify scan started - order.verify(mWifiNative).scan(eq(scanFreqs), eq(networkIds)); + order.verify(mWifiNative).scan(eq(scanFreqs), any(Set.class)); // Setup scan results when(mWifiNative.getScanResults()).thenReturn(nativeResults); @@ -647,17 +646,15 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest { } private void expectFailedScanStart(InOrder order, WifiNative.ScanEventHandler eventHandler, - Set<Integer> scanFreqs, Set<Integer> networkIds) { + Set<Integer> scanFreqs) { // Verify scan started - order.verify(mWifiNative).scan(eq(scanFreqs), eq(networkIds)); - - // TODO: verify failure event + order.verify(mWifiNative).scan(eq(scanFreqs), any(Set.class)); } private void expectFailedEventScan(InOrder order, WifiNative.ScanEventHandler eventHandler, - Set<Integer> scanFreqs, Set<Integer> networkIds) { + Set<Integer> scanFreqs) { // Verify scan started - order.verify(mWifiNative).scan(eq(scanFreqs), eq(networkIds)); + order.verify(mWifiNative).scan(eq(scanFreqs), any(Set.class)); // Notify scan has failed mWifiMonitor.sendMessage(mWifiNative.getInterfaceName(), WifiMonitor.SCAN_FAILED_EVENT); diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java index bbcb33310..4a0ba4816 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java @@ -1440,9 +1440,6 @@ public class WifiScanningServiceTest { for (i = 0; i < requestPnoSettings.networkList.length; i++) { nativePnoSettings.networkList[i] = new WifiNative.PnoNetwork(); nativePnoSettings.networkList[i].ssid = requestPnoSettings.networkList[i].ssid; - nativePnoSettings.networkList[i].networkId = - requestPnoSettings.networkList[i].networkId; - nativePnoSettings.networkList[i].priority = requestPnoSettings.networkList[i].priority; nativePnoSettings.networkList[i].flags = requestPnoSettings.networkList[i].flags; nativePnoSettings.networkList[i].auth_bit_field = requestPnoSettings.networkList[i].authBitField; |