From e1f6fabe311af8f73b70d7b58bbc1f7d843ec7a0 Mon Sep 17 00:00:00 2001 From: xshu Date: Thu, 3 Sep 2020 19:37:21 -0700 Subject: [PATCH] Default suggestion network to persist randomization This will avoid enhanced randomization breaking any apps unintentionally. Bug: 162801581 Test: atest android.net.wifi Change-Id: I19f87eea062a7dad81e12d4cd07493883eaf154f --- .../android/net/wifi/WifiNetworkSuggestion.java | 13 +++++++------ .../android/net/wifi/WifiNetworkSuggestionTest.java | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java index aa699634dac48..145c39d754f94 100644 --- a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java +++ b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java @@ -176,7 +176,7 @@ public final class WifiNetworkSuggestion implements Parcelable { mWapiEnterpriseConfig = null; mIsNetworkUntrusted = false; mPriorityGroup = 0; - mIsEnhancedMacRandomizationEnabled = true; + mIsEnhancedMacRandomizationEnabled = false; } /** @@ -409,11 +409,12 @@ public final class WifiNetworkSuggestion implements Parcelable { * Suggested networks will never use the device (factory) MAC address to associate to the * network - instead they use a locally generated random MAC address. This method controls * the strategy for generating the random MAC address: - *
  • Persisted MAC randomization (false): generates the MAC address from a secret seed - * and information from the Wi-Fi configuration (SSID or Passpoint profile). That means that - * the same generated MAC address will be used for each subsequent association.
  • - *
  • Enhanced MAC randomization (true - the default): periodically generates a new MAC - * address new connections. Under this option, the randomized MAC address should change + *
  • Persisted MAC randomization (false - the default): generates the MAC address from a + * secret seed and information from the Wi-Fi configuration (SSID or Passpoint profile). + * This means that the same generated MAC address will be used for each subsequent + * association.
  • + *
  • Enhanced MAC randomization (true): periodically generates a new MAC + * address for new connections. Under this option, the randomized MAC address should change * if the suggestion is removed and then added back.
  • * * @param enabled {@code true} to periodically change the randomized MAC address. diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java index abb9ce6762626..631e5e23a9b86 100644 --- a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java +++ b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java @@ -682,15 +682,15 @@ public class WifiNetworkSuggestionTest { } /** - * Verify that the macRandomizationSetting defaults to RANDOMIZATION_ENHANCED and could be set - * to RANDOMIZATION_PERSISTENT. + * Verify that the macRandomizationSetting defaults to RANDOMIZATION_PERSISTENT and could be set + * to RANDOMIZATION_ENHANCED. */ @Test public void testWifiNetworkSuggestionBuilderSetMacRandomization() { WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder() .setSsid(TEST_SSID) .build(); - assertEquals(WifiConfiguration.RANDOMIZATION_ENHANCED, + assertEquals(WifiConfiguration.RANDOMIZATION_PERSISTENT, suggestion.wifiConfiguration.macRandomizationSetting); suggestion = new WifiNetworkSuggestion.Builder()