diff options
author | Jong Wook Kim <jongwook@google.com> | 2018-03-09 17:45:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-03-09 17:45:09 +0000 |
commit | 4250c8679d9c4e97fcbb0503d20024557fa3678e (patch) | |
tree | eca6c7d736e9ea0fa5976681f3d1d71c909cdb66 /service/java/com/android/server/wifi/WifiConfigManager.java | |
parent | ec68862a82ff1c6ad3e1e9ee7f35102b6105361f (diff) | |
parent | be1a7e114f0378bed4194f9aeb02c49cda2be29b (diff) | |
download | android_frameworks_opt_net_wifi-4250c8679d9c4e97fcbb0503d20024557fa3678e.tar.gz android_frameworks_opt_net_wifi-4250c8679d9c4e97fcbb0503d20024557fa3678e.tar.bz2 android_frameworks_opt_net_wifi-4250c8679d9c4e97fcbb0503d20024557fa3678e.zip |
Merge "WifiConfigManager: Mask Randomized MAC Address" into pi-dev
Diffstat (limited to 'service/java/com/android/server/wifi/WifiConfigManager.java')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 750b4e5c0..57e11b7bc 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -429,6 +429,16 @@ 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. + * @param configuration WifiConfiguration to hide the MAC address + */ + private void maskRandomizedMacAddressInWifiConfiguration(WifiConfiguration configuration) { + configuration.setRandomizedMacAddress(MacAddress.ALL_ZEROS_ADDRESS); + } + + /** * Helper method to create a copy of the provided internal WifiConfiguration object to be * passed to external modules. * @@ -442,6 +452,7 @@ public class WifiConfigManager { if (maskPasswords) { maskPasswordsInWifiConfiguration(network); } + maskRandomizedMacAddressInWifiConfiguration(network); return network; } @@ -553,6 +564,24 @@ public class WifiConfigManager { } /** + * Retrieves the configured network corresponding to the provided networkId + * without any masking. + * + * WARNING: Don't use this to pass network configurations except in the wifi stack, when + * there is a need for passwords and randomized MAC address. + * + * @param networkId networkId of the requested network. + * @return Copy of WifiConfiguration object if found, null otherwise. + */ + public WifiConfiguration getConfiguredNetworkWithoutMasking(int networkId) { + WifiConfiguration config = getInternalConfiguredNetwork(networkId); + if (config == null) { + return null; + } + return new WifiConfiguration(config); + } + + /** * Helper method to retrieve all the internal WifiConfiguration objects corresponding to all * the networks in our database. */ |