summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-12-04 21:43:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-12-04 21:43:03 +0000
commit27fc5ec251e42b45094604e03c578243b69d3e91 (patch)
treec798c35be42766ac8a01b7e450570d5784fd1d45
parent9a090f9497b92cceece5ed493644855d6348fc0b (diff)
parentdd67b710d037fa23a35de33814ba40bb9765f5bf (diff)
Merge "Remove references to @hide MacAddress.ALL_ZEROS_ADDRESS"
-rw-r--r--service/java/com/android/server/wifi/WifiConfigurationUtil.java9
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java11
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java28
3 files changed, 25 insertions, 23 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
index 1bff474e4..09674ecef 100644
--- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java
+++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
@@ -16,6 +16,8 @@
package com.android.server.wifi;
+import static android.net.wifi.WifiManager.ALL_ZEROS_MAC_ADDRESS;
+
import static com.android.server.wifi.util.NativeUtil.addEnclosingQuotes;
import android.net.IpConfiguration;
@@ -62,15 +64,14 @@ public class WifiConfigurationUtil {
private static final int SAE_ASCII_MIN_LEN = 1 + ENCLOSING_QUOTES_LEN;
private static final int PSK_SAE_ASCII_MAX_LEN = 63 + ENCLOSING_QUOTES_LEN;
private static final int PSK_SAE_HEX_LEN = 64;
- private static final MacAddress ALL_ZEROS_MAC_ADDRESS =
- MacAddress.fromString("00:00:00:00:00:00");
+
@VisibleForTesting
public static final String PASSWORD_MASK = "*";
private static final String MATCH_EMPTY_SSID_PATTERN_PATH = "";
private static final Pair<MacAddress, MacAddress> MATCH_NONE_BSSID_PATTERN =
- new Pair(MacAddress.BROADCAST_ADDRESS, MacAddress.BROADCAST_ADDRESS);
+ new Pair<>(MacAddress.BROADCAST_ADDRESS, MacAddress.BROADCAST_ADDRESS);
private static final Pair<MacAddress, MacAddress> MATCH_ALL_BSSID_PATTERN =
- new Pair(ALL_ZEROS_MAC_ADDRESS, ALL_ZEROS_MAC_ADDRESS);
+ new Pair<>(ALL_ZEROS_MAC_ADDRESS, ALL_ZEROS_MAC_ADDRESS);
/**
* Checks if the provided |wepKeys| array contains any non-null value;
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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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<MacAddress, MacAddress> 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();