Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1f6fabe authored by xshu's avatar xshu
Browse files

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
parent 2c89638c
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -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.
+3 −3
Original line number Diff line number Diff line
@@ -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()