diff options
author | Oscar Shu <xshu@google.com> | 2019-11-20 19:17:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-11-20 19:17:51 +0000 |
commit | 174cd54dd6f84414dcc8d4b354dd679f450b1c80 (patch) | |
tree | 8d3431ff9a5f40d21d6eb7364555a230a14a06d4 /service | |
parent | 7be5a9d761365d4654565837fc51e207396fdc54 (diff) | |
parent | a522b345fa15716a21fd9edcf523cf3c1331dd94 (diff) |
Merge changes from topic "macRandNotification"
* changes:
Detect networks in SSID hotlist
Add SSID hotlist in DeviceConfig
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/DeviceConfigFacade.java | 30 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 13 |
2 files changed, 43 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/DeviceConfigFacade.java b/service/java/com/android/server/wifi/DeviceConfigFacade.java index c5ca3c913..1c59797fe 100644 --- a/service/java/com/android/server/wifi/DeviceConfigFacade.java +++ b/service/java/com/android/server/wifi/DeviceConfigFacade.java @@ -19,10 +19,13 @@ package com.android.server.wifi; import android.content.Context; import android.os.Handler; import android.provider.DeviceConfig; +import android.util.ArraySet; import com.android.internal.annotations.VisibleForTesting; import com.android.wifi.R; +import java.util.Collections; +import java.util.Set; import java.util.concurrent.TimeUnit; /** @@ -60,6 +63,7 @@ public class DeviceConfigFacade { private int mDataStallRxTputThrKbps; private int mDataStallTxPerThr; private int mDataStallCcaLevelThr; + private Set<String> mRandomizationFlakySsidHotlist; public DeviceConfigFacade(Context context, Handler handler, WifiMetrics wifiMetrics) { mContext = context; @@ -101,6 +105,25 @@ public class DeviceConfigFacade { mWifiMetrics.setDataStallRxTputThrKbps(mDataStallRxTputThrKbps); mWifiMetrics.setDataStallTxPerThr(mDataStallTxPerThr); mWifiMetrics.setDataStallCcaLevelThr(mDataStallCcaLevelThr); + + createUnmodifiableRandomizationFlakySsidHotlist(); + } + + private void createUnmodifiableRandomizationFlakySsidHotlist() { + String ssidHotlist = DeviceConfig.getString(NAMESPACE, + "randomization_flaky_ssid_hotlist", ""); + mRandomizationFlakySsidHotlist = new ArraySet<String>(); + String[] ssidHotlistArray = ssidHotlist.split(","); + for (int i = 0; i < ssidHotlistArray.length; i++) { + String cur = ssidHotlistArray[i]; + if (cur.length() == 0) { + continue; + } + // Make sure the SSIDs are quoted. Server side should not quote ssids. + mRandomizationFlakySsidHotlist.add("\"" + cur + "\""); + } + mRandomizationFlakySsidHotlist = + Collections.unmodifiableSet(mRandomizationFlakySsidHotlist); } /** @@ -158,4 +181,11 @@ public class DeviceConfigFacade { public int getDataStallCcaLevelThr() { return mDataStallCcaLevelThr; } + + /** + * Gets the Set of SSIDs in the flaky SSID hotlist. + */ + public Set<String> getRandomizationFlakySsidHotlist() { + return mRandomizationFlakySsidHotlist; + } } diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 0b4ea8811..18b5562b3 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -1675,6 +1675,19 @@ public class WifiConfigManager { } /** + * Check whether a network belong to a known list of networks that may not support randomized + * MAC. + * @param networkId + * @return true if the network is in the hotlist and MAC randomization is enabled. + */ + public boolean isInFlakyRandomizationSsidHotlist(int networkId) { + WifiConfiguration config = getConfiguredNetwork(networkId); + return config != null + && config.macRandomizationSetting == WifiConfiguration.RANDOMIZATION_PERSISTENT + && mDeviceConfigFacade.getRandomizationFlakySsidHotlist().contains(config.SSID); + } + + /** * Helper method to mark a network enabled for network selection. */ private void setNetworkSelectionEnabled(WifiConfiguration config) { |