From ee780140e31af01e3e6ed380459f097633c87355 Mon Sep 17 00:00:00 2001 From: Jong Wook Kim Date: Sun, 6 May 2018 14:12:09 -0700 Subject: Update WifiInfo MAC address more frequently Currently, we reset MAC address stored in WifiInfo to 02:00:00:00:00:00 whenever we are handling disconnect with Connected MAC Randomization enabled. The disconnect handling can happen after we have started connecting to a new network and generated a new randomized MAC address. Update the MAC address to the real value once we have successfully connected to the new network. Bug: 78013990 Test: Manual Check, Unittest Change-Id: I8f3d66bef353e91d3938a74c5d0f10d746903961 --- service/java/com/android/server/wifi/WifiStateMachine.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 4a0a24a21..c969d252f 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -4321,6 +4321,7 @@ public class WifiStateMachine extends StateMachine { if (config != null) { mWifiInfo.setBSSID(mLastBssid); mWifiInfo.setNetworkId(mLastNetworkId); + mWifiInfo.setMacAddress(mWifiNative.getMacAddress(mInterfaceName)); ScanDetailCache scanDetailCache = mWifiConfigManager.getScanDetailCacheForNetwork(config.networkId); @@ -4866,6 +4867,7 @@ public class WifiStateMachine extends StateMachine { mWifiInfo.setBSSID((String) message.obj); mLastNetworkId = message.arg1; mWifiInfo.setNetworkId(mLastNetworkId); + mWifiInfo.setMacAddress(mWifiNative.getMacAddress(mInterfaceName)); if(!mLastBssid.equals(message.obj)) { mLastBssid = (String) message.obj; sendNetworkStateChangeBroadcast(mLastBssid); -- cgit v1.2.3