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
This commit is contained in:
xshu
2020-09-03 19:37:21 -07:00
parent 2c89638cd1
commit e1f6fabe31
2 changed files with 10 additions and 9 deletions

View File

@@ -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:
* <li> 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. </li>
* <li> Enhanced MAC randomization (true - the default): periodically generates a new MAC
* address new connections. Under this option, the randomized MAC address should change
* <li> 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. </li>
* <li> 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. </li>
*
* @param enabled {@code true} to periodically change the randomized MAC address.

View File

@@ -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()