MAC address updates in Android 11

Android 11 introduces the following changes related to MAC addresses. These changes affect apps only if they target Android 11.

MAC randomization

On apps that target Android 10 (API level 29) and lower, MAC randomization is per-SSID, because Passpoint can connect to different SSIDs for the same profile. On apps targeting Android 11 (API level 30) and higher, MAC randomization for Passpoint networks is changed to per fully-qualified domain name (FQDN).

On apps that target API level 30 and higher, non-privileged apps will not be able to access the device’s MAC address; only network interfaces with an IP address will be visible. This impacts the getifaddrs() and NetworkInterface.getHardwareAddress() methods, as well as sending RTM_GETLINK netlink messages.

The following is a list of the ways that apps are affected by this change:

  • NetworkInterface.getHardwareAddress() returns null for every interface.
  • Apps cannot use the bind() function on NETLINK_ROUTE sockets.
  • The ip command does not return information about interfaces.
  • Apps cannot send RTM_GETLINK messages.

These changes enforce the guidance provided in Don’t work with MAC addresses.

Note that most developers should use the higher-level APIs of ConnectivityManager rather than lower-level APIs like NetworkInterface and getifaddrs().