diff options
author | Oscar Shu <xshu@google.com> | 2019-10-15 17:03:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-10-15 17:03:02 +0000 |
commit | 0655b2b84a2e134015757d0c5a8a57367283c416 (patch) | |
tree | bdd31c3ec1c1f2b98201914cbd3d7eb057d2e039 /service | |
parent | 5a00530815780fd21d7b120bbd471fadf60f1117 (diff) | |
parent | 4892c0b7b6b65584ce7574bf18053ecbba79e024 (diff) |
Merge "[MAC rand] Avoid null Object of mac address" into qt-qpr1-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 134977a62..438f88550 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -3385,12 +3385,14 @@ public class ClientModeImpl extends StateMachine { Log.e(TAG, "No config to change MAC address to"); return; } - MacAddress currentMac = MacAddress.fromString(mWifiNative.getMacAddress(mInterfaceName)); + String currentMacString = mWifiNative.getMacAddress(mInterfaceName); + MacAddress currentMac = currentMacString == null ? null : + MacAddress.fromString(currentMacString); MacAddress newMac = config.getOrCreateRandomizedMacAddress(); mWifiConfigManager.setNetworkRandomizedMacAddress(config.networkId, newMac); if (!WifiConfiguration.isValidMacAddressForRandomization(newMac)) { Log.wtf(TAG, "Config generated an invalid MAC address"); - } else if (currentMac.equals(newMac)) { + } else if (newMac.equals(currentMac)) { Log.d(TAG, "No changes in MAC address"); } else { mWifiMetrics.logStaEvent(StaEvent.TYPE_MAC_CHANGE, config); @@ -3398,7 +3400,7 @@ public class ClientModeImpl extends StateMachine { mWifiNative.setMacAddress(mInterfaceName, newMac); Log.d(TAG, "ConnectedMacRandomization SSID(" + config.getPrintableSsid() + "). setMacAddress(" + newMac.toString() + ") from " - + currentMac.toString() + " = " + setMacSuccess); + + currentMacString + " = " + setMacSuccess); } } |