From d08f40266aa4177211aeb1f315e96d7c591feef4 Mon Sep 17 00:00:00 2001 From: xshu Date: Thu, 12 Mar 2020 16:52:37 -0700 Subject: Support enhanced MAC randomization Passpoint Check the whitelist for FQDN if the network is passpoint. Bug: 151373955 Test: atest com.android.server.wifi Change-Id: I75cacbfd7ac9d838a112b20740d81731b6d4634e --- .../android/server/wifi/WifiConfigManagerTest.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index 88bf786e6..20aefe958 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -2131,6 +2131,27 @@ public class WifiConfigManagerTest extends WifiBaseTest { assertEquals(macAddress, configs.get(0).getRandomizedMacAddress().toString()); } + /** + * Verify that the aggressive randomization whitelist works for passpoints. (by checking FQDN) + */ + @Test + public void testShouldUseAggressiveRandomizationPasspoint() { + WifiConfiguration c = WifiConfigurationTestUtil.createPasspointNetwork(); + // Adds SSID to the whitelist. + Set ssidList = new HashSet<>(); + ssidList.add(c.SSID); + when(mDeviceConfigFacade.getAggressiveMacRandomizationSsidAllowlist()) + .thenReturn(ssidList); + + // Verify that if for passpoint networks we don't check for the SSID to be in the whitelist + assertFalse(mWifiConfigManager.shouldUseAggressiveRandomization(c)); + + // instead we check for the FQDN + ssidList.clear(); + ssidList.add(c.FQDN); + assertTrue(mWifiConfigManager.shouldUseAggressiveRandomization(c)); + } + /** * Verifies that getRandomizedMacAndUpdateIfNeeded updates the randomized MAC address and * |randomizedMacExpirationTimeMs| correctly. -- cgit v1.2.3