diff options
author | xshu <xshu@google.com> | 2019-11-12 14:04:42 -0800 |
---|---|---|
committer | xshu <xshu@google.com> | 2019-11-18 14:10:11 -0800 |
commit | a522b345fa15716a21fd9edcf523cf3c1331dd94 (patch) | |
tree | 06cb68f37bd6420930fd3e88d414809921161136 /tests | |
parent | d8cc34290cb74db931e0fceaf3e0ec4b8a380716 (diff) |
Detect networks in SSID hotlist
Add infrastructure support to detect networks that are known to not
support randomized MACs.
Bug: 144172117
Test: atest FrameworksWifiTests
Test: Manually tested on device
Change-Id: Ie42ce853810aa5dfd4eef89dff281740dafaf3be
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index d48966143..735ff5753 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -5594,6 +5594,33 @@ public class WifiConfigManagerTest extends WifiBaseTest { } /** + * Verifies that isInFlakyRandomizationSsidHotlist returns true if the network's SSID is in + * the hotlist and the network is using randomized MAC. + */ + @Test + public void testFlakyRandomizationSsidHotlist() { + WifiConfiguration openNetwork = WifiConfigurationTestUtil.createOpenNetwork(); + NetworkUpdateResult result = verifyAddNetworkToWifiConfigManager(openNetwork); + int networkId = result.getNetworkId(); + + // should return false when there is nothing in the hotlist + assertFalse(mWifiConfigManager.isInFlakyRandomizationSsidHotlist(networkId)); + + // add the network's SSID to the hotlist and verify the method returns true + Set<String> ssidHotlist = new HashSet<>(); + ssidHotlist.add(openNetwork.SSID); + when(mDeviceConfigFacade.getRandomizationFlakySsidHotlist()).thenReturn(ssidHotlist); + assertTrue(mWifiConfigManager.isInFlakyRandomizationSsidHotlist(networkId)); + + // Now change the macRandomizationSetting to "trusted" and then verify + // isInFlakyRandomizationSsidHotlist returns false + openNetwork.macRandomizationSetting = WifiConfiguration.RANDOMIZATION_NONE; + NetworkUpdateResult networkUpdateResult = updateNetworkToWifiConfigManager(openNetwork); + assertNotEquals(WifiConfiguration.INVALID_NETWORK_ID, networkUpdateResult.getNetworkId()); + assertFalse(mWifiConfigManager.isInFlakyRandomizationSsidHotlist(networkId)); + } + + /** * Verifies that when scanning a WPA3 in transition mode AP, and there is a matching WPA2 saved * network, {@link WifiConfigManager#getConfiguredNetworkForScanDetailAndCache(ScanDetail)} * clones a new WPA3 saved network that will be used to connect to it. |