summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandy Pan <zpan@google.com>2017-05-24 18:45:33 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-24 18:45:33 +0000
commit9ba0cdce88bd776e4fa3f0d799be996f72d0fe1f (patch)
tree42af1962699872086927c522eaf47420a735452d
parentb4a6453d37b24671a586508a66d1f3cd456d5f30 (diff)
parent42e4920fdc3ad70f437f7a5967169b06116f1c62 (diff)
Merge "WifiConfigManager: convert BSSID to lower case" into oc-dev
am: 42e4920fdc Change-Id: I06c8477d69f81332e8513852efd373bf1193a438
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java18
2 files changed, 19 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 87d7a100b..3f31c7ff8 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -720,7 +720,7 @@ public class WifiConfigManager {
internalConfig.SSID = externalConfig.SSID;
}
if (externalConfig.BSSID != null) {
- internalConfig.BSSID = externalConfig.BSSID;
+ internalConfig.BSSID = externalConfig.BSSID.toLowerCase();
}
internalConfig.hiddenSSID = externalConfig.hiddenSSID;
if (externalConfig.preSharedKey != null
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 987c50937..f61013841 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -3170,6 +3170,24 @@ public class WifiConfigManagerTest {
result.getNetworkId()); // Update networkID
}
+ /**
+ * Verifies that the app specified BSSID is converted and saved in lower case.
+ */
+ @Test
+ public void testAppSpecifiedBssidIsSavedInLowerCase() {
+ final String bssid = "0A:08:5C:BB:89:6D"; // upper case
+ WifiConfiguration openNetwork = WifiConfigurationTestUtil.createOpenNetwork();
+ openNetwork.BSSID = bssid;
+
+ NetworkUpdateResult result = verifyAddNetworkToWifiConfigManager(openNetwork);
+
+ WifiConfiguration retrievedNetwork = mWifiConfigManager.getConfiguredNetwork(
+ result.getNetworkId());
+
+ assertNotEquals(retrievedNetwork.BSSID, bssid);
+ assertEquals(retrievedNetwork.BSSID, bssid.toLowerCase());
+ }
+
private NetworkUpdateResult verifyAddOrUpdateNetworkWithProxySettingsAndPermissions(
boolean withConfOverride,
boolean withProfileOwnerPolicy,