From c4d0de0346332a43155580c28097c3bdc9976875 Mon Sep 17 00:00:00 2001 From: Rebecca Silberstein Date: Thu, 5 Jan 2017 13:27:51 -0800 Subject: WifiApConfigStore: randomize default soft ap SSID Add a suffix to the default SSID for SoftAp configurations. This results in the default SSID name (currently AndroidAP) followed by and underscore and four randomized ints. The WifiApConfigStoreTest methods were also updated to reflect this change. Bug: 31076622 Test: manually tested with a newly flashed device Test: frameworks/base/wifi/tests/runtests.sh Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: If3032ff97d76cbd0bf24950aeb01a9d30568496f --- .../src/com/android/server/wifi/WifiApConfigStoreTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java index a942a0828..42161fa54 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java @@ -49,6 +49,8 @@ public class WifiApConfigStoreTest { private static final String TEST_DEFAULT_2G_CHANNEL_LIST = "1,2,3,4,5,6"; private static final String TEST_DEFAULT_AP_SSID = "TestAP"; private static final String TEST_CONFIGURED_AP_SSID = "ConfiguredAP"; + private static final int RAND_SSID_INT_MIN = 1000; + private static final int RAND_SSID_INT_MAX = 9999; @Mock Context mContext; @Mock BackupManagerProxy mBackupManagerProxy; @@ -106,7 +108,11 @@ public class WifiApConfigStoreTest { } private void verifyDefaultApConfig(WifiConfiguration config) { - assertEquals(TEST_DEFAULT_AP_SSID, config.SSID); + String[] splitSsid = config.SSID.split("_"); + assertEquals(2, splitSsid.length); + assertEquals(TEST_DEFAULT_AP_SSID, splitSsid[0]); + int randomPortion = Integer.parseInt(splitSsid[1]); + assertTrue(randomPortion >= RAND_SSID_INT_MIN && randomPortion <= RAND_SSID_INT_MAX); assertTrue(config.allowedKeyManagement.get(KeyMgmt.WPA2_PSK)); } -- cgit v1.2.3