From e3da880a84385b8ac304b9e08d6bb5551db56628 Mon Sep 17 00:00:00 2001 From: Ahmed ElArabawy Date: Sat, 9 May 2020 12:01:15 -0700 Subject: Include 6GHz band in scanning This commit includes the 6GHz band in scanning triggered internally by the wifi stack. Bug: 156053158 Test: atest com.android.server.wifi Test: Make sure 6GHz channels are included in scan requests Change-Id: I65bf213337512a279f1f213fb1acc4488c0b5a91 --- .../android/server/wifi/ScanRequestProxyTest.java | 6 ++--- .../android/server/wifi/WakeupControllerTest.java | 3 ++- .../server/wifi/WifiConnectivityManagerTest.java | 8 +++--- .../android/server/wifi/WifiHealthMonitorTest.java | 4 +-- .../server/wifi/WifiNetworkFactoryTest.java | 2 +- .../wifi/scanner/WifiScanningServiceTest.java | 29 +++++++++++----------- 6 files changed, 27 insertions(+), 25 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java b/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java index e4d67eca9..b065f823c 100644 --- a/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java @@ -131,11 +131,11 @@ public class ScanRequestProxyTest extends WifiBaseTest { mTestScanDatas1 = ScanTestUtil.createScanDatas(new int[][]{{ 2417, 2427, 5180, 5170 }}, new int[]{0}, - new int[]{WifiScanner.WIFI_BAND_BOTH_WITH_DFS}); + new int[]{WifiScanner.WIFI_BAND_ALL}); mTestScanDatas2 = ScanTestUtil.createScanDatas(new int[][]{{ 2412, 2422, 5200, 5210 }}, new int[]{0}, - new int[]{WifiScanner.WIFI_BAND_BOTH_WITH_DFS}); + new int[]{WifiScanner.WIFI_BAND_ALL}); // Scan throttling is enabled by default. when(mWifiSettingsConfigStore.get(eq(WIFI_SCAN_THROTTLE_ENABLED))).thenReturn(true); @@ -866,7 +866,7 @@ public class ScanRequestProxyTest extends WifiBaseTest { boolean expectHiddenNetworks, boolean expectHighAccuracyType) { assertNotNull(scanSettings); - assertEquals(WifiScanner.WIFI_BAND_BOTH_WITH_DFS, scanSettings.band); + assertEquals(WifiScanner.WIFI_BAND_ALL, scanSettings.band); if (expectHighAccuracyType) { assertEquals(WifiScanner.SCAN_TYPE_HIGH_ACCURACY, scanSettings.type); } else { diff --git a/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java b/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java index 4b97f69f7..ed2ccce5e 100644 --- a/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java @@ -114,8 +114,9 @@ public class WakeupControllerTest extends WifiBaseTest { ScanResult[] scanResults = new ScanResult[1]; scanResults[0] = mTestScanResult; mTestScanDatas = new WifiScanner.ScanData[1]; + int scanBand = WifiScanner.WIFI_BAND_ALL & ~WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY; mTestScanDatas[0] = new WifiScanner.ScanData(0 /* id */, 0 /* flags */, - 0 /* bucketsScanned */, WifiScanner.WIFI_BAND_BOTH /* bandScanned */, scanResults); + 0 /* bucketsScanned */, scanBand /* bandScanned */, scanResults); } /** Initializes the wakeupcontroller in the given {@code enabled} state. */ diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java index cd9ef0243..b01f2beb1 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java @@ -259,7 +259,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { ScanData mockScanData() { ScanData scanData = mock(ScanData.class); - when(scanData.getBandScanned()).thenReturn(WifiScanner.WIFI_BAND_BOTH_WITH_DFS); + when(scanData.getBandScanned()).thenReturn(WifiScanner.WIFI_BAND_ALL); return scanData; } @@ -1791,7 +1791,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { doAnswer(new AnswerWithArguments() { public void answer(ScanSettings settings, ScanListener listener, WorkSource workSource) throws Exception { - assertEquals(settings.band, WifiScanner.WIFI_BAND_BOTH_WITH_DFS); + assertEquals(settings.band, WifiScanner.WIFI_BAND_ALL); assertNull(settings.channels); }}).when(mWifiScanner).startScan(anyObject(), anyObject(), anyObject()); @@ -1958,7 +1958,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { doAnswer(new AnswerWithArguments() { public void answer(ScanSettings settings, Executor executor, ScanListener listener, WorkSource workSource) throws Exception { - assertEquals(settings.band, WifiScanner.WIFI_BAND_BOTH_WITH_DFS); + assertEquals(settings.band, WifiScanner.WIFI_BAND_ALL); assertNull(settings.channels); }}).when(mWifiScanner).startScan(anyObject(), anyObject(), anyObject(), anyObject()); @@ -2110,7 +2110,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { CANDIDATE_NETWORK_ID, Process.WIFI_UID, CANDIDATE_BSSID); // Set up as full band scan results. - when(mScanData.getBandScanned()).thenReturn(WifiScanner.WIFI_BAND_BOTH_WITH_DFS); + when(mScanData.getBandScanned()).thenReturn(WifiScanner.WIFI_BAND_ALL); // Force a connectivity scan which enables WifiConnectivityManager // to wait for full band scan results. diff --git a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java index 5ba8dbadb..0660e5eec 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java @@ -165,7 +165,7 @@ public class WifiHealthMonitorTest extends WifiBaseTest { .thenReturn(mAlarmManager.getAlarmManager()); mScanData = mockScanData(); - mWifiScanner = mockWifiScanner(WifiScanner.WIFI_BAND_BOTH_WITH_DFS); + mWifiScanner = mockWifiScanner(WifiScanner.WIFI_BAND_ALL); when(mWifiInjector.getWifiScanner()).thenReturn(mWifiScanner); when(mWifiNative.getDriverVersion()).thenReturn(mDriverVersion); when(mWifiNative.getFirmwareVersion()).thenReturn(mFirmwareVersion); @@ -703,7 +703,7 @@ public class WifiHealthMonitorTest extends WifiBaseTest { // Add Above2G only scan data mScanData = mockScanDataAbove2GOnly(); - mWifiScanner = mockWifiScanner(WifiScanner.WIFI_BAND_BOTH_WITH_DFS); + mWifiScanner = mockWifiScanner(WifiScanner.WIFI_BAND_ALL); when(mWifiInjector.getWifiScanner()).thenReturn(mWifiScanner); millisecondsPass(5000); mWifiHealthMonitor.setWifiEnabled(true); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java index ff31eb223..17159b5e7 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java @@ -2934,7 +2934,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { private void validateScanSettings(@Nullable String hiddenSsid) { ScanSettings scanSettings = mScanSettingsArgumentCaptor.getValue(); assertNotNull(scanSettings); - assertEquals(WifiScanner.WIFI_BAND_BOTH_WITH_DFS, scanSettings.band); + assertEquals(WifiScanner.WIFI_BAND_ALL, scanSettings.band); assertEquals(WifiScanner.SCAN_TYPE_HIGH_ACCURACY, scanSettings.type); assertEquals(WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, scanSettings.reportEvents); if (hiddenSsid == null) { 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 bccf6b49a..0264bc261 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java @@ -1694,10 +1694,10 @@ public class WifiScanningServiceTest extends WifiBaseTest { @Test public void retrieveSingleScanResults() throws Exception { WifiScanner.ScanSettings requestSettings = - createRequest(WifiScanner.WIFI_BAND_BOTH_WITH_DFS, - 0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN); + createRequest(WifiScanner.WIFI_BAND_ALL, 0, 0, 20, + WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN); ScanResults expectedResults = - ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2412, 5160, 5175); + ScanResults.create(0, WifiScanner.WIFI_BAND_ALL, 2412, 5160, 5175); doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings), expectedResults); @@ -1772,10 +1772,10 @@ public class WifiScanningServiceTest extends WifiBaseTest { */ @Test public void retrieveMostRecentFullSingleScanResults() throws Exception { - WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0, - 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN); - ScanResults expectedResults = ScanResults.create( - 0, WifiScanner.WIFI_BAND_BOTH, 2412, 5160, 5175); + int scanBand = WifiScanner.WIFI_BAND_ALL & ~WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY; + WifiScanner.ScanSettings requestSettings = createRequest(scanBand, 0, 0, 20, + WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN); + ScanResults expectedResults = ScanResults.create(0, scanBand, 2412, 5160, 5175); doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings), expectedResults); @@ -1795,7 +1795,7 @@ public class WifiScanningServiceTest extends WifiBaseTest { // now update with a new scan that only has one result int secondScanRequestId = 35; - ScanResults expectedSingleResult = ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 5160); + ScanResults expectedSingleResult = ScanResults.create(0, scanBand, 5160); sendSingleScanRequest(controlChannel, secondScanRequestId, requestSettings, null); mLooper.dispatchAll(); @@ -1829,10 +1829,11 @@ public class WifiScanningServiceTest extends WifiBaseTest { */ @Test public void doesNotRetrieveMostRecentPartialSingleScanResults() throws Exception { - WifiScanner.ScanSettings fullRequestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0, + int scanBand = WifiScanner.WIFI_BAND_ALL & ~WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY; + WifiScanner.ScanSettings fullRequestSettings = createRequest(scanBand, 0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN); ScanResults expectedFullResults = - ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2412, 5160, 5175); + ScanResults.create(0, scanBand, 2412, 5160, 5175); doSuccessfulSingleScan(fullRequestSettings, computeSingleScanNativeSettings(fullRequestSettings), expectedFullResults); @@ -1890,10 +1891,10 @@ public class WifiScanningServiceTest extends WifiBaseTest { */ @Test public void doesNotRetrieveStaleScanResultsFromLastFullSingleScan() throws Exception { - WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0, + WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_ALL, 0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN); ScanResults scanResults = - ScanResults.create(0, WifiScanner.WIFI_BAND_BOTH, 2412, 5160, 5175); + ScanResults.create(0, WifiScanner.WIFI_BAND_ALL, 2412, 5160, 5175); // Out of the 3 scan results, modify the timestamp of 2 of them to be within the expiration // age and 1 out of it. @@ -1932,10 +1933,10 @@ public class WifiScanningServiceTest extends WifiBaseTest { @Test public void validateScanResultsClearedAfterDriverUnloaded() throws Exception { WifiScanner.ScanSettings requestSettings = - createRequest(WifiScanner.WIFI_BAND_BOTH_WITH_DFS, + createRequest(WifiScanner.WIFI_BAND_ALL, 0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN); ScanResults expectedResults = ScanResults.create( - 0, WifiScanner.WIFI_BAND_BOTH_WITH_DFS, 2412, 5160, 5175); + 0, WifiScanner.WIFI_BAND_ALL, 2412, 5160, 5175); doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings), expectedResults); -- cgit v1.2.3