Project: /_project.yaml Book: /_book.yaml
{% include “_versions.html” %}
Starting in Android 8.0, Android devices use random MAC addresses when probing for new networks while not currently associated to a network.
In Android {{ androidPVersionNumber }}, a developer option can be enabled (it is disabled by default) to cause the device to use a randomized MAC address when connecting to a Wi-Fi network. A different randomized MAC address is used per SSID.
MAC randomization prevents listeners from using MAC addresses to build a history of device activity, thus increasing user privacy.
Additionally, MAC addresses are randomized as part of Wi-Fi Aware and Wi-Fi RTT operations.
To implement MAC randomization on your device:
Work with a Wi-Fi chip vendor to implement the IWifiStaIface.setMacAddress()
HAL method.
Set config_wifi_support_connected_mac_randomization
{: .external} to true in the Settings config.xml
(this can be done in a device custom overlay).
Test your implementation using the methods described in Validation.
The System UI must:
Use the reference implementation{: .external} of Settings UI to implement new prompts.
To validate that the feature is working as intended, run both an integration test (ACTS) and a manual test.
To run an integration test, use the ACTS file, WifiConnectedMacRandomizationTest.py
, located in tools/test/connectivity/acts/tests/google/wifi
, to verify if the device uses the randomized MAC address and correctly stores the randomized MAC address for each network.
To run a manual test:
You may experience up to a three-second delay when connecting to networks since scan results are cleared whenever a new MAC address is set. Other delays may also occur when connecting to networks and validating internet connectivity.
If the Wi-Fi driver or firmware does not properly synchronize the MAC address state with the host kernel, internet connectivity checks will fail. If this happens, check with your silicon partners to ensure that the driver or firmware has been correctly updated with the new MAC address.