summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2019-11-25 16:00:36 -0800
committerDavid Su <dysu@google.com>2019-11-28 16:20:50 -0800
commita2949725ba019f99b0b18f7c75ec49ae83af44ba (patch)
treea3b20d1af5df7b7ad0f211e21e1bbe3464d9e581
parent0b1849318b7a5c94c91d9807d8145c72da381ef9 (diff)
Rename WifiScanner scan types, clean up hidden network
- Renamed WifiScanner.TYPE_* to WifiScanner.SCAN_TYPE_* - Converted hiddenNetworks from HiddenNetwork[] to final List<HiddenNetwork> Bug: 143614759 Test: atest FrameworksWifiTests Change-Id: Icf2b7040cd3514949c81c29b2cc1615b11d55770
-rw-r--r--service/java/com/android/server/wifi/ScanRequestProxy.java10
-rw-r--r--service/java/com/android/server/wifi/WakeupController.java2
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java10
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkFactory.java11
-rw-r--r--service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java29
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java39
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java10
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java9
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/BackgroundScanSchedulerTest.java8
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java31
11 files changed, 78 insertions, 83 deletions
diff --git a/service/java/com/android/server/wifi/ScanRequestProxy.java b/service/java/com/android/server/wifi/ScanRequestProxy.java
index 0a648d4b4..185523904 100644
--- a/service/java/com/android/server/wifi/ScanRequestProxy.java
+++ b/service/java/com/android/server/wifi/ScanRequestProxy.java
@@ -484,21 +484,19 @@ public class ScanRequestProxy {
WifiScanner.ScanSettings settings = new WifiScanner.ScanSettings();
// Scan requests from apps with network settings will be of high accuracy type.
if (fromSettingsOrSetupWizard) {
- settings.type = WifiScanner.TYPE_HIGH_ACCURACY;
+ settings.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
}
// always do full scans
settings.band = WifiScanner.WIFI_BAND_BOTH_WITH_DFS;
settings.reportEvents = WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN
| WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT;
if (mScanningForHiddenNetworksEnabled) {
+ settings.hiddenNetworks.clear();
// retrieve the list of hidden network SSIDs from saved network to scan for, if enabled.
- List<WifiScanner.ScanSettings.HiddenNetwork> hiddenNetworkList =
- new ArrayList<>(mWifiConfigManager.retrieveHiddenNetworkList());
+ settings.hiddenNetworks.addAll(mWifiConfigManager.retrieveHiddenNetworkList());
// retrieve the list of hidden network SSIDs from Network suggestion to scan for.
- hiddenNetworkList.addAll(
+ settings.hiddenNetworks.addAll(
mWifiInjector.getWifiNetworkSuggestionsManager().retrieveHiddenNetworkList());
- settings.hiddenNetworks = hiddenNetworkList.toArray(
- new WifiScanner.ScanSettings.HiddenNetwork[0]);
}
mWifiScanner.startScan(settings, new ScanRequestProxyScanListener(), workSource);
return true;
diff --git a/service/java/com/android/server/wifi/WakeupController.java b/service/java/com/android/server/wifi/WakeupController.java
index bf36c9482..b74a25489 100644
--- a/service/java/com/android/server/wifi/WakeupController.java
+++ b/service/java/com/android/server/wifi/WakeupController.java
@@ -276,7 +276,7 @@ public class WakeupController {
Log.d(TAG, "stop()");
mLastDisconnectTimestampMillis = 0;
mLastDisconnectInfo = null;
- mWifiInjector.getWifiScanner().deregisterScanListener(mScanListener);
+ mWifiInjector.getWifiScanner().unregisterScanListener(mScanListener);
mWakeupOnboarding.onStop();
}
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 1dd0a484e..818cc0a07 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -904,19 +904,17 @@ public class WifiConnectivityManager {
isFullBandScan = true;
}
}
- settings.type = WifiScanner.TYPE_HIGH_ACCURACY; // always do high accuracy scans.
+ settings.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY; // always do high accuracy scans.
settings.band = getScanBand(isFullBandScan);
settings.reportEvents = WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT
| WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN;
settings.numBssidsPerScan = 0;
+ settings.hiddenNetworks.clear();
// retrieve the list of hidden network SSIDs from saved network to scan for
- List<ScanSettings.HiddenNetwork> hiddenNetworkList =
- new ArrayList<>(mConfigManager.retrieveHiddenNetworkList());
+ settings.hiddenNetworks.addAll(mConfigManager.retrieveHiddenNetworkList());
// retrieve the list of hidden network SSIDs from Network suggestion to scan for
- hiddenNetworkList.addAll(
+ settings.hiddenNetworks.addAll(
mWifiInjector.getWifiNetworkSuggestionsManager().retrieveHiddenNetworkList());
- settings.hiddenNetworks =
- hiddenNetworkList.toArray(new ScanSettings.HiddenNetwork[0]);
SingleScanListener singleScanListener =
new SingleScanListener(isFullBandScan);
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java
index 257b5fa9e..a296a2807 100644
--- a/service/java/com/android/server/wifi/WifiNetworkFactory.java
+++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java
@@ -367,7 +367,7 @@ public class WifiNetworkFactory extends NetworkFactory {
mWifiMetrics = wifiMetrics;
// Create the scan settings.
mScanSettings = new WifiScanner.ScanSettings();
- mScanSettings.type = WifiScanner.TYPE_HIGH_ACCURACY;
+ mScanSettings.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
mScanSettings.band = WifiScanner.WIFI_BAND_BOTH_WITH_DFS;
mScanSettings.reportEvents = WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN;
mScanListener = new NetworkFactoryScanListener();
@@ -1046,11 +1046,10 @@ public class WifiNetworkFactory extends NetworkFactory {
WifiNetworkSpecifier wns = mActiveSpecificNetworkRequestSpecifier;
WifiConfiguration wifiConfiguration = wns.wifiConfiguration;
if (wifiConfiguration.hiddenSSID) {
- mScanSettings.hiddenNetworks = new WifiScanner.ScanSettings.HiddenNetwork[1];
// Can't search for SSID pattern in hidden networks.
- mScanSettings.hiddenNetworks[0] =
- new WifiScanner.ScanSettings.HiddenNetwork(
- addEnclosingQuotes(wns.ssidPatternMatcher.getPath()));
+ mScanSettings.hiddenNetworks.clear();
+ mScanSettings.hiddenNetworks.add(new WifiScanner.ScanSettings.HiddenNetwork(
+ addEnclosingQuotes(wns.ssidPatternMatcher.getPath())));
}
startScan();
}
@@ -1061,7 +1060,7 @@ public class WifiNetworkFactory extends NetworkFactory {
mPeriodicScanTimerSet = false;
}
// Clear the hidden networks field after each request.
- mScanSettings.hiddenNetworks = null;
+ mScanSettings.hiddenNetworks.clear();
}
private void scheduleNextPeriodicScan() {
diff --git a/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java b/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
index 27efc91fd..8a30d8f90 100644
--- a/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
+++ b/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
@@ -1010,8 +1010,9 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub {
}
boolean validateScanType(int type) {
- return (type == WifiScanner.TYPE_LOW_LATENCY || type == WifiScanner.TYPE_LOW_POWER
- || type == WifiScanner.TYPE_HIGH_ACCURACY);
+ return type == WifiScanner.SCAN_TYPE_LOW_LATENCY
+ || type == WifiScanner.SCAN_TYPE_LOW_POWER
+ || type == WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
}
boolean validateScanRequest(ClientInfo ci, int handler, ScanSettings settings) {
@@ -1037,7 +1038,7 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub {
+ " does not have permission to set hidden networks");
return false;
}
- if (settings.type != WifiScanner.TYPE_LOW_LATENCY) {
+ if (settings.type != WifiScanner.SCAN_TYPE_LOW_LATENCY) {
Log.e(TAG, "Failing single scan because app " + ci.getUid()
+ " does not have permission to set type");
return false;
@@ -1048,11 +1049,11 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub {
int getNativeScanType(int type) {
switch(type) {
- case WifiScanner.TYPE_LOW_LATENCY:
+ case WifiScanner.SCAN_TYPE_LOW_LATENCY:
return WifiNative.SCAN_TYPE_LOW_LATENCY;
- case WifiScanner.TYPE_LOW_POWER:
+ case WifiScanner.SCAN_TYPE_LOW_POWER:
return WifiNative.SCAN_TYPE_LOW_POWER;
- case WifiScanner.TYPE_HIGH_ACCURACY:
+ case WifiScanner.SCAN_TYPE_HIGH_ACCURACY:
return WifiNative.SCAN_TYPE_HIGH_ACCURACY;
default:
// This should never happen becuase we've validated the incoming type in
@@ -1176,12 +1177,10 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub {
settings.scanType =
mergeScanTypes(settings.scanType, getNativeScanType(entry.settings.type));
channels.addChannels(entry.settings);
- if (entry.settings.hiddenNetworks != null) {
- for (int i = 0; i < entry.settings.hiddenNetworks.length; i++) {
- WifiNative.HiddenNetwork hiddenNetwork = new WifiNative.HiddenNetwork();
- hiddenNetwork.ssid = entry.settings.hiddenNetworks[i].ssid;
- hiddenNetworkList.add(hiddenNetwork);
- }
+ for (ScanSettings.HiddenNetwork srcNetwork : entry.settings.hiddenNetworks) {
+ WifiNative.HiddenNetwork hiddenNetwork = new WifiNative.HiddenNetwork();
+ hiddenNetwork.ssid = srcNetwork.ssid;
+ hiddenNetworkList.add(hiddenNetwork);
}
if ((entry.settings.reportEvents & WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT)
!= 0) {
@@ -2609,11 +2608,11 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub {
static String getScanTypeString(int type) {
switch(type) {
- case WifiScanner.TYPE_LOW_LATENCY:
+ case WifiScanner.SCAN_TYPE_LOW_LATENCY:
return "LOW LATENCY";
- case WifiScanner.TYPE_LOW_POWER:
+ case WifiScanner.SCAN_TYPE_LOW_POWER:
return "LOW POWER";
- case WifiScanner.TYPE_HIGH_ACCURACY:
+ case WifiScanner.SCAN_TYPE_HIGH_ACCURACY:
return "HIGH ACCURACY";
default:
// This should never happen becuase we've validated the incoming type in
diff --git a/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java b/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java
index 0e5cbd592..465fe2046 100644
--- a/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java
@@ -33,6 +33,7 @@ import android.net.wifi.IScanResultsCallback;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiScanner;
+import android.net.wifi.WifiScanner.ScanSettings.HiddenNetwork;
import android.os.Handler;
import android.os.IBinder;
import android.os.UserHandle;
@@ -53,6 +54,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -63,16 +65,16 @@ public class ScanRequestProxyTest extends WifiBaseTest {
private static final int TEST_UID = 5;
private static final String TEST_PACKAGE_NAME_1 = "com.test.1";
private static final String TEST_PACKAGE_NAME_2 = "com.test.2";
- private static final List<WifiScanner.ScanSettings.HiddenNetwork> TEST_HIDDEN_NETWORKS_LIST =
- new ArrayList<WifiScanner.ScanSettings.HiddenNetwork>() {{
- add(new WifiScanner.ScanSettings.HiddenNetwork("test_ssid_1"));
- add(new WifiScanner.ScanSettings.HiddenNetwork("test_ssid_2"));
+ private static final List<HiddenNetwork> TEST_HIDDEN_NETWORKS_LIST =
+ new ArrayList<HiddenNetwork>() {{
+ add(new HiddenNetwork("test_ssid_1"));
+ add(new HiddenNetwork("test_ssid_2"));
}};
- private static final List<WifiScanner.ScanSettings.HiddenNetwork> TEST_HIDDEN_NETWORKS_LIST_NS =
- new ArrayList<WifiScanner.ScanSettings.HiddenNetwork>() {{
- add(new WifiScanner.ScanSettings.HiddenNetwork("test_ssid_3"));
- add(new WifiScanner.ScanSettings.HiddenNetwork("test_ssid_4"));
+ private static final List<HiddenNetwork> TEST_HIDDEN_NETWORKS_LIST_NS =
+ new ArrayList<HiddenNetwork>() {{
+ add(new HiddenNetwork("test_ssid_3"));
+ add(new HiddenNetwork("test_ssid_4"));
}};
@Mock private Context mContext;
@@ -876,31 +878,30 @@ public class ScanRequestProxyTest extends WifiBaseTest {
assertNotNull(scanSettings);
assertEquals(WifiScanner.WIFI_BAND_BOTH_WITH_DFS, scanSettings.band);
if (expectHighAccuracyType) {
- assertEquals(WifiScanner.TYPE_HIGH_ACCURACY, scanSettings.type);
+ assertEquals(WifiScanner.SCAN_TYPE_HIGH_ACCURACY, scanSettings.type);
} else {
- assertEquals(WifiScanner.TYPE_LOW_LATENCY, scanSettings.type);
+ assertEquals(WifiScanner.SCAN_TYPE_LOW_LATENCY, scanSettings.type);
}
assertEquals(WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN
| WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT, scanSettings.reportEvents);
- List<WifiScanner.ScanSettings.HiddenNetwork> hiddenNetworkList =
+ List<HiddenNetwork> hiddenNetworkList =
new ArrayList<>();
hiddenNetworkList.addAll(TEST_HIDDEN_NETWORKS_LIST);
hiddenNetworkList.addAll(TEST_HIDDEN_NETWORKS_LIST_NS);
if (expectHiddenNetworks) {
- assertNotNull(scanSettings.hiddenNetworks);
- assertEquals(hiddenNetworkList.size(), scanSettings.hiddenNetworks.length);
- for (int i = 0; i < scanSettings.hiddenNetworks.length; i++) {
- validateHiddenNetworkInList(scanSettings.hiddenNetworks[i], hiddenNetworkList);
+ assertEquals(hiddenNetworkList.size(), scanSettings.hiddenNetworks.size());
+ for (HiddenNetwork hiddenNetwork : scanSettings.hiddenNetworks) {
+ validateHiddenNetworkInList(hiddenNetwork, hiddenNetworkList);
}
} else {
- assertNull(scanSettings.hiddenNetworks);
+ assertEquals(Collections.emptyList(), scanSettings.hiddenNetworks);
}
}
private void validateHiddenNetworkInList(
- WifiScanner.ScanSettings.HiddenNetwork expectedHiddenNetwork,
- List<WifiScanner.ScanSettings.HiddenNetwork> hiddenNetworkList) {
- for (WifiScanner.ScanSettings.HiddenNetwork hiddenNetwork : hiddenNetworkList) {
+ HiddenNetwork expectedHiddenNetwork,
+ List<HiddenNetwork> hiddenNetworkList) {
+ for (HiddenNetwork hiddenNetwork : hiddenNetworkList) {
if (hiddenNetwork.ssid.equals(expectedHiddenNetwork.ssid)) {
return;
}
diff --git a/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java b/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java
index 19ebd2ddc..212937fc3 100644
--- a/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java
+++ b/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java
@@ -62,13 +62,13 @@ public class ScanTestUtil {
public static WifiScanner.ScanSettings createRequest(int type, int band, int period, int batch,
int bssidsPerScan, int reportEvents) {
- return createRequest(WifiScanner.TYPE_HIGH_ACCURACY, band, period, 0, 0,
+ return createRequest(WifiScanner.SCAN_TYPE_HIGH_ACCURACY, band, period, 0, 0,
batch, bssidsPerScan, reportEvents);
}
public static WifiScanner.ScanSettings createRequest(int band, int period, int batch,
int bssidsPerScan, int reportEvents) {
- return createRequest(WifiScanner.TYPE_HIGH_ACCURACY, band, period, 0, 0, batch,
+ return createRequest(WifiScanner.SCAN_TYPE_HIGH_ACCURACY, band, period, 0, 0, batch,
bssidsPerScan, reportEvents);
}
@@ -183,11 +183,11 @@ public class ScanTestUtil {
private static int getNativeScanType(int type) {
switch(type) {
- case WifiScanner.TYPE_LOW_LATENCY:
+ case WifiScanner.SCAN_TYPE_LOW_LATENCY:
return WifiNative.SCAN_TYPE_LOW_LATENCY;
- case WifiScanner.TYPE_LOW_POWER:
+ case WifiScanner.SCAN_TYPE_LOW_POWER:
return WifiNative.SCAN_TYPE_LOW_POWER;
- case WifiScanner.TYPE_HIGH_ACCURACY:
+ case WifiScanner.SCAN_TYPE_HIGH_ACCURACY:
return WifiNative.SCAN_TYPE_HIGH_ACCURACY;
default:
fail();
diff --git a/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java b/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java
index 6029da55f..5bfa82ccf 100644
--- a/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java
@@ -292,7 +292,7 @@ public class WakeupControllerTest extends WifiBaseTest {
initializeWakeupController(true /* enabled */);
mWakeupController.start();
mWakeupController.stop();
- verify(mWifiScanner).deregisterScanListener(any());
+ verify(mWifiScanner).unregisterScanListener(any());
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
index b1112e278..a070b0173 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
@@ -2906,14 +2906,13 @@ public class WifiNetworkFactoryTest extends WifiBaseTest {
ScanSettings scanSettings = mScanSettingsArgumentCaptor.getValue();
assertNotNull(scanSettings);
assertEquals(WifiScanner.WIFI_BAND_BOTH_WITH_DFS, scanSettings.band);
- assertEquals(WifiScanner.TYPE_HIGH_ACCURACY, scanSettings.type);
+ assertEquals(WifiScanner.SCAN_TYPE_HIGH_ACCURACY, scanSettings.type);
assertEquals(WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN, scanSettings.reportEvents);
if (hiddenSsid == null) {
- assertNull(scanSettings.hiddenNetworks);
+ assertEquals(Collections.emptyList(), scanSettings.hiddenNetworks);
} else {
- assertNotNull(scanSettings.hiddenNetworks);
- assertNotNull(scanSettings.hiddenNetworks[0]);
- assertEquals(scanSettings.hiddenNetworks[0].ssid, addEnclosingQuotes(hiddenSsid));
+ assertNotNull(scanSettings.hiddenNetworks.get(0));
+ assertEquals(scanSettings.hiddenNetworks.get(0).ssid, addEnclosingQuotes(hiddenSsid));
}
WorkSource workSource = mWorkSourceArgumentCaptor.getValue();
assertNotNull(workSource);
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/BackgroundScanSchedulerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/BackgroundScanSchedulerTest.java
index 39ecb6f6e..938ce9022 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/BackgroundScanSchedulerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/BackgroundScanSchedulerTest.java
@@ -418,8 +418,8 @@ public class BackgroundScanSchedulerTest extends WifiBaseTest {
@Test
public void singleExponentialBackOffRequest() {
Collection<ScanSettings> requests = Collections.singleton(createRequest(
- WifiScanner.TYPE_LOW_LATENCY, WifiScanner.WIFI_BAND_BOTH, 30000, 160000, 2, 0, 20,
- WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN
+ WifiScanner.SCAN_TYPE_LOW_LATENCY, WifiScanner.WIFI_BAND_BOTH,
+ 30000, 160000, 2, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN
));
mScheduler.updateSchedule(requests);
@@ -435,8 +435,8 @@ public class BackgroundScanSchedulerTest extends WifiBaseTest {
@Test
public void exponentialBackOffAndRegularRequests() {
Collection<ScanSettings> requests = new ArrayList<>();
- requests.add(createRequest(WifiScanner.TYPE_LOW_LATENCY, WifiScanner.WIFI_BAND_BOTH, 30000,
- 200000, 1, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN));
+ requests.add(createRequest(WifiScanner.SCAN_TYPE_LOW_LATENCY, WifiScanner.WIFI_BAND_BOTH,
+ 30000, 200000, 1, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN));
requests.add(createRequest(channelsToSpec(5175), 30000, 0, 20,
WifiScanner.REPORT_EVENT_AFTER_BUFFER_FULL));
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 d1cb3ba86..ce5a066d7 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
@@ -756,7 +756,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId = 33;
- requestSettings.type = WifiScanner.TYPE_HIGH_ACCURACY;
+ requestSettings.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
WorkSource workSource = new WorkSource(Binder.getCallingUid()); // don't explicitly set
when(mContext.checkPermission(
@@ -805,10 +805,11 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId = 33;
- requestSettings.hiddenNetworks = new WifiScanner.ScanSettings.HiddenNetwork[] {
- new WifiScanner.ScanSettings.HiddenNetwork("Test1"),
- new WifiScanner.ScanSettings.HiddenNetwork("Test2")
- };
+ requestSettings.hiddenNetworks.clear();
+ requestSettings.hiddenNetworks.add(
+ new WifiScanner.ScanSettings.HiddenNetwork("Test1"));
+ requestSettings.hiddenNetworks.add(
+ new WifiScanner.ScanSettings.HiddenNetwork("Test2"));
WorkSource workSource = new WorkSource(Binder.getCallingUid()); // don't explicitly set
when(mContext.checkPermission(
@@ -1327,13 +1328,13 @@ public class WifiScanningServiceTest extends WifiBaseTest {
// Create identitical scan requests other than the types being different.
WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings1.type = WifiScanner.TYPE_LOW_LATENCY;
+ requestSettings1.type = WifiScanner.SCAN_TYPE_LOW_LATENCY;
int requestId1 = 12;
ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2400), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings2.type = WifiScanner.TYPE_HIGH_ACCURACY;
+ requestSettings2.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
int requestId2 = 13;
ScanResults results2 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
@@ -1396,14 +1397,14 @@ public class WifiScanningServiceTest extends WifiBaseTest {
public void sendMultipleSingleScanRequestWhilePreviousScanRunning() throws RemoteException {
WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings1.type = WifiScanner.TYPE_LOW_LATENCY;
+ requestSettings1.type = WifiScanner.SCAN_TYPE_LOW_LATENCY;
int requestId1 = 12;
WorkSource workSource1 = new WorkSource(1121);
ScanResults results1 = ScanResults.create(0, WifiScanner.WIFI_BAND_UNSPECIFIED, 2400);
WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2450, 5175), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings2.type = WifiScanner.TYPE_HIGH_ACCURACY;
+ requestSettings2.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
int requestId2 = 13;
WorkSource workSource2 = new WorkSource(Binder.getCallingUid()); // don't explicitly set
ScanResults results2 =
@@ -1411,7 +1412,7 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(5150), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings3.type = WifiScanner.TYPE_LOW_POWER;
+ requestSettings3.type = WifiScanner.SCAN_TYPE_LOW_POWER;
int requestId3 = 15;
// Let one of the WorkSources be a chained workSource.
WorkSource workSource3 = new WorkSource();
@@ -1519,13 +1520,13 @@ public class WifiScanningServiceTest extends WifiBaseTest {
ScanResults.merge(WifiScanner.WIFI_BAND_BOTH, results24GHz, results5GHz);
WifiScanner.ScanSettings requestSettings1 = createRequest(
- WifiScanner.TYPE_HIGH_ACCURACY, WifiScanner.WIFI_BAND_BOTH, 0,
+ WifiScanner.SCAN_TYPE_HIGH_ACCURACY, WifiScanner.WIFI_BAND_BOTH, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId1 = 12;
ScanResults results1 = resultsBoth;
WifiScanner.ScanSettings requestSettings2 = createRequest(
- WifiScanner.TYPE_LOW_LATENCY, WifiScanner.WIFI_BAND_24_GHZ, 0,
+ WifiScanner.SCAN_TYPE_LOW_LATENCY, WifiScanner.WIFI_BAND_24_GHZ, 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
int requestId2 = 13;
ScanResults results2 = results24GHz;
@@ -1587,21 +1588,21 @@ public class WifiScanningServiceTest extends WifiBaseTest {
WifiScanner.ScanSettings requestSettings1 = createRequest(channelsToSpec(2400, 2450), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings1.type = WifiScanner.TYPE_LOW_LATENCY;
+ requestSettings1.type = WifiScanner.SCAN_TYPE_LOW_LATENCY;
int requestId1 = 12;
WorkSource workSource1 = new WorkSource(1121);
ScanResults results1 = results1and3;
WifiScanner.ScanSettings requestSettings2 = createRequest(channelsToSpec(2450, 5175), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings2.type = WifiScanner.TYPE_HIGH_ACCURACY;
+ requestSettings2.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY;
int requestId2 = 13;
WorkSource workSource2 = new WorkSource(Binder.getCallingUid()); // don't explicitly set
ScanResults results2 = ScanResults.create(0, 2450, 5175, 2450);
WifiScanner.ScanSettings requestSettings3 = createRequest(channelsToSpec(2400), 0,
0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
- requestSettings3.type = WifiScanner.TYPE_LOW_POWER;
+ requestSettings3.type = WifiScanner.SCAN_TYPE_LOW_POWER;
int requestId3 = 15;
WorkSource workSource3 = new WorkSource(2292);
ScanResults results3 = results2400;