diff options
author | Vinit Deshpande <vinitd@google.com> | 2015-03-27 11:40:17 -0700 |
---|---|---|
committer | Vinit Deshpande <vinitd@google.com> | 2015-03-31 15:51:55 -0700 |
commit | 6f6c781cca66cabc1f06be368a6dfedceb88ed0e (patch) | |
tree | 5cd304721c7788eb08f01078778d361ee7883255 /wifi | |
parent | fbeeccc354c6fadde035ecc3188a07c8ccb778f3 (diff) | |
download | frameworks_base-6f6c781cca66cabc1f06be368a6dfedceb88ed0e.zip frameworks_base-6f6c781cca66cabc1f06be368a6dfedceb88ed0e.tar.gz frameworks_base-6f6c781cca66cabc1f06be368a6dfedceb88ed0e.tar.bz2 |
Remove scanResultCache from WifiConfiguration
This is in preparation to use ScanDetail - which is a superset
of ScanResult - in wifi stack. There are no external users of
scanResultCache; so it can be safely removed.
Also fixed a javadoc comment for getPlmn()
Change-Id: I7c49532664ffe2e3e5e134bfcd42615d5999d02f
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 185 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiEnterpriseConfig.java | 2 |
2 files changed, 3 insertions, 184 deletions
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index 34ae386..5baa3e8 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -401,13 +401,6 @@ public class WifiConfiguration implements Parcelable { */ public String autoJoinBSSID; - /** - * @hide - * BSSID list on which this configuration was seen. - * TODO: prevent this list to grow infinitely, age-out the results - */ - public HashMap<String, ScanResult> scanResultCache; - /** The Below RSSI thresholds are used to configure AutoJoin * - GOOD/LOW/BAD thresholds are used so as to calculate link score * - UNWANTED_SOFT are used by the blacklisting logic so as to handle @@ -497,7 +490,7 @@ public class WifiConfiguration implements Parcelable { * A summary of the RSSI and Band status for that configuration * This is used as a temporary value by the auto-join controller */ - public final class Visibility { + public static final class Visibility { public int rssi5; // strongest 5GHz RSSI public int rssi24; // strongest 2.4GHz RSSI public int num5; // number of BSSIDs on 5GHz @@ -573,47 +566,8 @@ public class WifiConfiguration implements Parcelable { * age in milliseconds: we will consider only ScanResults that are more recent, * i.e. younger. ***/ - public Visibility setVisibility(long age) { - if (scanResultCache == null) { - visibility = null; - return null; - } - - Visibility status = new Visibility(); - - long now_ms = System.currentTimeMillis(); - for(ScanResult result : scanResultCache.values()) { - if (result.seen == 0) - continue; - - if (result.is5GHz()) { - //strictly speaking: [4915, 5825] - //number of known BSSID on 5GHz band - status.num5 = status.num5 + 1; - } else if (result.is24GHz()) { - //strictly speaking: [2412, 2482] - //number of known BSSID on 2.4Ghz band - status.num24 = status.num24 + 1; - } - - if ((now_ms - result.seen) > age) continue; - - if (result.is5GHz()) { - if (result.level > status.rssi5) { - status.rssi5 = result.level; - status.age5 = result.seen; - status.BSSID5 = result.BSSID; - } - } else if (result.is24GHz()) { - if (result.level > status.rssi24) { - status.rssi24 = result.level; - status.age24 = result.seen; - status.BSSID24 = result.BSSID; - } - } - } + public void setVisibility(Visibility status) { visibility = status; - return status; } /** @hide */ @@ -970,31 +924,6 @@ public class WifiConfiguration implements Parcelable { return false; } - /** - * most recent time we have seen this configuration - * @return most recent scanResult - * @hide - */ - public ScanResult lastSeen() { - ScanResult mostRecent = null; - - if (scanResultCache == null) { - return null; - } - - for (ScanResult result : scanResultCache.values()) { - if (mostRecent == null) { - if (result.seen != 0) - mostRecent = result; - } else { - if (result.seen > mostRecent.seen) { - mostRecent = result; - } - } - } - return mostRecent; - } - /** @hide **/ public void setAutoJoinStatus(int status) { if (status < 0) status = 0; @@ -1009,75 +938,6 @@ public class WifiConfiguration implements Parcelable { } } - /** @hide - * trim the scan Result Cache - * @param: number of entries to keep in the cache - */ - public void trimScanResultsCache(int num) { - if (this.scanResultCache == null) { - return; - } - int currenSize = this.scanResultCache.size(); - if (currenSize <= num) { - return; // Nothing to trim - } - ArrayList<ScanResult> list = new ArrayList<ScanResult>(this.scanResultCache.values()); - if (list.size() != 0) { - // Sort by descending timestamp - Collections.sort(list, new Comparator() { - public int compare(Object o1, Object o2) { - ScanResult a = (ScanResult)o1; - ScanResult b = (ScanResult)o2; - if (a.seen > b.seen) { - return 1; - } - if (a.seen < b.seen) { - return -1; - } - return a.BSSID.compareTo(b.BSSID); - } - }); - } - for (int i = 0; i < currenSize - num ; i++) { - // Remove oldest results from scan cache - ScanResult result = list.get(i); - this.scanResultCache.remove(result.BSSID); - } - } - - /* @hide */ - private ArrayList<ScanResult> sortScanResults() { - ArrayList<ScanResult> list = new ArrayList<ScanResult>(this.scanResultCache.values()); - if (list.size() != 0) { - Collections.sort(list, new Comparator() { - public int compare(Object o1, Object o2) { - ScanResult a = (ScanResult)o1; - ScanResult b = (ScanResult)o2; - if (a.numIpConfigFailures > b.numIpConfigFailures) { - return 1; - } - if (a.numIpConfigFailures < b.numIpConfigFailures) { - return -1; - } - if (a.seen > b.seen) { - return -1; - } - if (a.seen < b.seen) { - return 1; - } - if (a.level > b.level) { - return -1; - } - if (a.level < b.level) { - return 1; - } - return a.BSSID.compareTo(b.BSSID); - } - }); - } - return list; - } - @Override public String toString() { StringBuilder sbuf = new StringBuilder(); @@ -1248,42 +1108,6 @@ public class WifiConfiguration implements Parcelable { } } } - if (this.scanResultCache != null) { - sbuf.append("Scan Cache: ").append('\n'); - ArrayList<ScanResult> list = sortScanResults(); - if (list.size() > 0) { - for (ScanResult result : list) { - long milli = now_ms - result.seen; - long ageSec = 0; - long ageMin = 0; - long ageHour = 0; - long ageMilli = 0; - long ageDay = 0; - if (now_ms > result.seen && result.seen > 0) { - ageMilli = milli % 1000; - ageSec = (milli / 1000) % 60; - ageMin = (milli / (60*1000)) % 60; - ageHour = (milli / (60*60*1000)) % 24; - ageDay = (milli / (24*60*60*1000)); - } - sbuf.append("{").append(result.BSSID).append(",").append(result.frequency); - sbuf.append(",").append(String.format("%3d", result.level)); - if (result.autoJoinStatus > 0) { - sbuf.append(",st=").append(result.autoJoinStatus); - } - if (ageSec > 0 || ageMilli > 0) { - sbuf.append(String.format(",%4d.%02d.%02d.%02d.%03dms", ageDay, - ageHour, ageMin, ageSec, ageMilli)); - } - if (result.numIpConfigFailures > 0) { - sbuf.append(",ipfail="); - sbuf.append(result.numIpConfigFailures); - } - sbuf.append("} "); - } - sbuf.append('\n'); - } - } sbuf.append("triggeredLow: ").append(this.numUserTriggeredWifiDisableLowRSSI); sbuf.append(" triggeredBad: ").append(this.numUserTriggeredWifiDisableBadRSSI); sbuf.append(" triggeredNotHigh: ").append(this.numUserTriggeredWifiDisableNotHighRSSI); @@ -1577,11 +1401,6 @@ public class WifiConfiguration implements Parcelable { mIpConfiguration = new IpConfiguration(source.mIpConfiguration); - if ((source.scanResultCache != null) && (source.scanResultCache.size() > 0)) { - scanResultCache = new HashMap<String, ScanResult>(); - scanResultCache.putAll(source.scanResultCache); - } - if ((source.connectChoices != null) && (source.connectChoices.size() > 0)) { connectChoices = new HashMap<String, Integer>(); connectChoices.putAll(source.connectChoices); diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java index 440ad61..6917971 100644 --- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java +++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java @@ -601,7 +601,7 @@ public class WifiEnterpriseConfig implements Parcelable { } /** - * Set plmn for passpoint credential + * Get plmn for passpoint credential * @return the plmn */ public String getPlmn() { |