From dd67b710d037fa23a35de33814ba40bb9765f5bf Mon Sep 17 00:00:00 2001 From: David Su Date: Wed, 4 Dec 2019 11:34:40 -0800 Subject: Remove references to @hide MacAddress.ALL_ZEROS_ADDRESS Migrate to WifiManager.ALL_ZEROS_MAC_ADDRESS. Bug: 145409537 Test: atest FrameworksWifiTests Change-Id: I88027bcb49bed6977a42f5bf107bf3fd36cfe868 --- .../server/wifi/WifiConfigurationUtilTest.java | 11 +++++---- .../server/wifi/WifiNetworkFactoryTest.java | 28 +++++++++++----------- 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java index 567a2b7ad..d2e6f1f78 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java @@ -23,6 +23,7 @@ import android.net.IpConfiguration; import android.net.MacAddress; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiEnterpriseConfig; +import android.net.wifi.WifiManager; import android.net.wifi.WifiNetworkSpecifier; import android.net.wifi.WifiScanner; import android.os.PatternMatcher; @@ -569,7 +570,7 @@ public class WifiConfigurationUtilTest extends WifiBaseTest { public void testValidateNetworkSpecifierPositiveCases_SsidPattern() { WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL), - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS), + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS), WifiConfigurationTestUtil.createOpenNetwork(), TEST_UID, TEST_PACKAGE); assertTrue(WifiConfigurationUtil.validateNetworkSpecifier(specifier)); @@ -611,7 +612,7 @@ public class WifiConfigurationUtilTest extends WifiBaseTest { public void testValidateNetworkSpecifierNegativeCases_NoSsidBssid() { WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( new PatternMatcher(".*", PatternMatcher.PATTERN_SIMPLE_GLOB), - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS), + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS), WifiConfigurationTestUtil.createOpenNetwork(), TEST_UID, TEST_PACKAGE); assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier)); @@ -625,7 +626,7 @@ public class WifiConfigurationUtilTest extends WifiBaseTest { public void testValidateNetworkSpecifierNegativeCases_MatchNoneSsidPattern() { WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( new PatternMatcher("", PatternMatcher.PATTERN_LITERAL), - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS), + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS), WifiConfigurationTestUtil.createOpenNetwork(), TEST_UID, TEST_PACKAGE); assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier)); @@ -653,7 +654,7 @@ public class WifiConfigurationUtilTest extends WifiBaseTest { public void testValidateNetworkSpecifierNegativeCases_InvalidBssidPattern() { WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL), - Pair.create(MacAddress.fromString(TEST_BSSID), MacAddress.ALL_ZEROS_ADDRESS), + Pair.create(MacAddress.fromString(TEST_BSSID), WifiManager.ALL_ZEROS_MAC_ADDRESS), WifiConfigurationTestUtil.createOpenNetwork(), TEST_UID, TEST_PACKAGE); assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier)); @@ -667,7 +668,7 @@ public class WifiConfigurationUtilTest extends WifiBaseTest { public void testValidateNetworkSpecifierNegativeCases_NoSsidPatternForHiddenNetwork() { WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_PREFIX), - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS), + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS), WifiConfigurationTestUtil.createOpenHiddenNetwork(), TEST_UID, TEST_PACKAGE); assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier)); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java index 461476fce..8a8d52efe 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java @@ -723,7 +723,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -766,7 +766,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -809,7 +809,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_PREFIX); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -942,7 +942,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -989,7 +989,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_3, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -1029,7 +1029,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -1150,7 +1150,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_PREFIX); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = WifiConfigurationTestUtil.createPskNetwork(); wifiConfiguration.preSharedKey = TEST_WPA_PRESHARED_KEY; WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -1303,7 +1303,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); wifiConfiguration.preSharedKey = TEST_WPA_PRESHARED_KEY; @@ -2263,7 +2263,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); // match-all. Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( ssidPatternMatch, bssidPatternMatch, WifiConfigurationTestUtil.createPskNetwork(), TEST_UID_1, TEST_PACKAGE_NAME_1); @@ -2307,7 +2307,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = Pair.create(MacAddress.fromString(matchingScanResult.BSSID), - MacAddress.ALL_ZEROS_ADDRESS); + WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( ssidPatternMatch, bssidPatternMatch, WifiConfigurationTestUtil.createPskNetwork(), TEST_UID_1, TEST_PACKAGE_NAME_1); @@ -2350,7 +2350,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = Pair.create(MacAddress.fromString(matchingScanResult.BSSID), - MacAddress.ALL_ZEROS_ADDRESS); + WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( ssidPatternMatch, bssidPatternMatch, WifiConfigurationTestUtil.createPskNetwork(), TEST_UID_1, TEST_PACKAGE_NAME_1); @@ -2644,7 +2644,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -2730,7 +2730,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(targetSsid, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration = WifiConfigurationTestUtil.createPskNetwork(); wifiConfiguration.preSharedKey = TEST_WPA_PRESHARED_KEY; WifiNetworkSpecifier specifier = new WifiNetworkSpecifier( @@ -2799,7 +2799,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { PatternMatcher ssidPatternMatch = new PatternMatcher(TEST_SSID_1, PatternMatcher.PATTERN_LITERAL); Pair bssidPatternMatch = - Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + Pair.create(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS); WifiConfiguration wifiConfiguration; if (isHidden) { wifiConfiguration = WifiConfigurationTestUtil.createPskHiddenNetwork(); -- cgit v1.2.3