From 1a645058a85182371b581916deba501feaa7bb86 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Thu, 25 Jun 2009 13:01:12 -0400 Subject: [PATCH] WifiService: Update all scan result values in our scan result cache. Previously only the level was being updated, resulting in out of date values being left in the cache. Patch was provided by Motorola. Signed-off-by: Mike Lockwood --- .../java/com/android/server/WifiService.java | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 969fbfea7f50c..e91798b23d5ea 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -1349,39 +1349,42 @@ public class WifiService extends IWifiManager.Stub { level = 0; } + /* + * The formatting of the results returned by + * wpa_supplicant is intended to make the fields + * line up nicely when printed, + * not to make them easy to parse. So we have to + * apply some heuristics to figure out which field + * is the SSID and which field is the flags. + */ + String ssid; + String flags; + if (result.length == 4) { + if (result[3].charAt(0) == '[') { + flags = result[3]; + ssid = ""; + } else { + flags = ""; + ssid = result[3]; + } + } else if (result.length == 5) { + flags = result[3]; + ssid = result[4]; + } else { + // Here, we must have 3 fields: no flags and ssid + // set + flags = ""; + ssid = ""; + } + // bssid is the hash key scanResult = mScanResultCache.get(bssid); if (scanResult != null) { scanResult.level = level; + scanResult.SSID = ssid; + scanResult.capabilities = flags; + scanResult.frequency = frequency; } else { - /* - * The formatting of the results returned by - * wpa_supplicant is intended to make the fields - * line up nicely when printed, - * not to make them easy to parse. So we have to - * apply some heuristics to figure out which field - * is the SSID and which field is the flags. - */ - String ssid; - String flags; - if (result.length == 4) { - if (result[3].charAt(0) == '[') { - flags = result[3]; - ssid = ""; - } else { - flags = ""; - ssid = result[3]; - } - } else if (result.length == 5) { - flags = result[3]; - ssid = result[4]; - } else { - // Here, we must have 3 fields: no flags and ssid - // set - flags = ""; - ssid = ""; - } - // Do not add scan results that have no SSID set if (0 < ssid.trim().length()) { scanResult =