diff options
author | Prem Kumar <premk@google.com> | 2014-12-14 19:53:28 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-14 19:53:29 +0000 |
commit | ff8ab9f723c8ecf04aedfc3102676ab498cb14fb (patch) | |
tree | 8da492d8ba3d54bcae19eae5a5bb21c77d5bb6b8 /service | |
parent | 4ff7838d595d2be641da1892507d3333707291e2 (diff) | |
parent | 63105d275289943504a292de18e6516e79b15148 (diff) | |
download | android_frameworks_opt_net_wifi-ff8ab9f723c8ecf04aedfc3102676ab498cb14fb.tar.gz android_frameworks_opt_net_wifi-ff8ab9f723c8ecf04aedfc3102676ab498cb14fb.tar.bz2 android_frameworks_opt_net_wifi-ff8ab9f723c8ecf04aedfc3102676ab498cb14fb.zip |
Merge "make sure wificonfiguration scan cache doesnt grow unbounded Bug:18703749" into lmp-mr1-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigStore.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java index cf4163557..cd7cb5789 100644 --- a/service/java/com/android/server/wifi/WifiConfigStore.java +++ b/service/java/com/android/server/wifi/WifiConfigStore.java @@ -389,6 +389,8 @@ public class WifiConfigStore extends IpConfigStore { public int currentNetworkBoost = 25; public int scanResultRssiLevelPatchUp = -85; + public static final int maxNumScanCacheEntries = 128; + /** * Regex pattern for extracting a connect choice. * Matches a strings like the following: @@ -2103,7 +2105,6 @@ public class WifiConfigStore extends IpConfigStore { } if (key.startsWith(BSSID_KEY_END)) { - if ((bssid != null) && (ssid != null)) { if (config.scanResultCache == null) { @@ -3358,6 +3359,13 @@ public class WifiConfigStore extends IpConfigStore { scanResult.untrusted = true; } + if (config.scanResultCache.size() > (maxNumScanCacheEntries+64)) { + // Trim the scan result cache to maxNumScanCacheEntries entries max + // Since this operation is expensive, make sure it is not performed + // until the cache has grown significantly above the trim treshold + config.trimScanResultsCache(maxNumScanCacheEntries); + } + // Add the scan result to this WifiConfiguration config.scanResultCache.put(scanResult.BSSID, scanResult); // Since we added a scan result to this configuration, re-attempt linking |