diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 5 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 5fb1eac10..336ebbd16 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -431,11 +431,12 @@ public class WifiConfigManager { /** * Helper method to mask randomized MAC address from the provided WifiConfiguration Object. * This is needed when the network configurations are being requested via the public - * WifiManager API's. This method puts "0:0:0:0:0:0" as the MAC address. + * WifiManager API's. This method puts "02:00:00:00:00:00" as the MAC address. * @param configuration WifiConfiguration to hide the MAC address */ private void maskRandomizedMacAddressInWifiConfiguration(WifiConfiguration configuration) { - configuration.setRandomizedMacAddress(MacAddress.ALL_ZEROS_ADDRESS); + MacAddress defaultMac = MacAddress.fromString(WifiInfo.DEFAULT_MAC_ADDRESS); + configuration.setRandomizedMacAddress(defaultMac); } /** diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index c96ea79fe..efa93223e 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3363,7 +3363,9 @@ public class WifiStateMachine extends StateMachine { MacAddress newMac = config.getOrCreateRandomizedMacAddress(); mWifiConfigManager.setNetworkRandomizedMacAddress(config.networkId, newMac); - if (currentMac.equals(newMac)) { + if (!WifiConfiguration.isValidMacAddressForRandomization(newMac)) { + Log.wtf(TAG, "Config generated an invalid MAC address"); + } else if (currentMac.equals(newMac)) { Log.i(TAG, "No changes in MAC address"); } else { Log.i(TAG, "ConnectedMacRandomization SSID(" + config.getPrintableSsid() |