diff options
author | Roshan Pius <rpius@google.com> | 2016-05-06 10:13:36 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2016-05-06 18:21:02 +0000 |
commit | 362fad8eddd674d7cf19ffcc1fec38d2d2ee2f53 (patch) | |
tree | 4cb33fc65f952d5a5c99bde2e1d24297c662803e /tests | |
parent | d06a43097e21f90b9dca90a3767e8c7f610c67d8 (diff) |
SupplicantScanner: Truncate hidden network list
Truncate the hidden network id list if it goes beyond wpa_supplicant's
max value. wpa_supplicant has a hard coded value of 16 for the max
number of networks that can be specified for each scan.
There is currently no way to query this value from wpa_supplicant, so
hardcoding this value in SupplicantScanner.
BUG: 28632556
Change-Id: I31a338b91c221c1686437b738894e13abb897474
TEST: Compiles & unit-test passes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
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 04684d932..15d1465f0 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java @@ -167,6 +167,29 @@ public abstract class BaseWifiScannerImplTest { ScanResults.create(0, 5650, 5650, 5650, 5650, 5650, 5650, 5650, 5650), false); } + /** + * Tests whether the provided hidden networkId's in scan settings is truncated to max size + * supported by wpa_supplicant when invoking native scan. + */ + @Test + public void singleScanSuccessWithTruncatedHiddenNetworkIds() { + int[] hiddenNetworkIds = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; + WifiNative.ScanSettings settings = new NativeScanSettingsBuilder() + .withBasePeriod(10000) + .withMaxApPerScan(10) + .withHiddenNetworkIds(hiddenNetworkIds) + .addBucketWithChannels(20000, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, 5650) + .build(); + + Set<Integer> hiddenNetworkIdSet = new HashSet<Integer>(); + for (int i = 0; i < SupplicantWifiScannerImpl.MAX_HIDDEN_NETWORK_IDS_PER_SCAN; i++) { + hiddenNetworkIdSet.add(hiddenNetworkIds[i]); + } + doSuccessfulSingleScanTest(settings, createFreqSet(5650), + hiddenNetworkIdSet, + ScanResults.create(0, 5650, 5650, 5650, 5650, 5650, 5650, 5650, 5650), false); + } + @Test public void overlappingSingleScanFails() { WifiNative.ScanSettings settings = new NativeScanSettingsBuilder() |