From 6ee49f2245ad0062d178cbdabb8398138b50b890 Mon Sep 17 00:00:00 2001 From: Peter Qiu Date: Wed, 1 Feb 2017 11:49:15 -0800 Subject: [PATCH] SettingsLib: wifi: Fixed AccessPoint tracking for Passpoint networks Previously, we were using provider name as the "SSID" for Passpoint networks, and use it to compare against real SSIDs, which obvious doesn't match. So fix it. Also removed the Passpoint specific logics in WifiTracker for tracking Passpoint networks, since there shouldn't any difference in tracking Passpoint APs and normal APs. Additional work is still needed for managing installed Passpoint configurations in the "Saved networks" page, and it is being tracked by b/34207710. The Passpoint configuration is not an "Access Point" per se, it is a network profile. Bug: 34455883 Test: Install a Globla Reach Passpoint profile on a bullhead, verify device auto connects to a Global Reach AP and UI (QS, QS+, and Settings) correctly reflects it. Change-Id: I63e66f683f8cb96e664516b130f5e7bc02358a10 Merged-In: I63e66f683f8cb96e664516b130f5e7bc02358a10 --- .../android/settingslib/wifi/AccessPoint.java | 6 +-- .../android/settingslib/wifi/WifiTracker.java | 41 +++++++------------ 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java index 252aaab1522ab..dac151c892f19 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java @@ -682,11 +682,7 @@ public class AccessPoint implements Comparable { } void loadConfig(WifiConfiguration config) { - if (config.isPasspoint()) - ssid = config.providerFriendlyName; - else - ssid = (config.SSID == null ? "" : removeDoubleQuotes(config.SSID)); - + ssid = (config.SSID == null ? "" : removeDoubleQuotes(config.SSID)); bssid = config.BSSID; security = getSecurity(config); networkId = config.networkId; diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java index 7d279eb1aac61..3435d1d9629dc 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java @@ -344,29 +344,22 @@ public class WifiTracker { } AccessPoint accessPoint = getCachedOrCreate(config, cachedAccessPoints); if (mLastInfo != null && mLastNetworkInfo != null) { - if (config.isPasspoint() == false) { - accessPoint.update(connectionConfig, mLastInfo, mLastNetworkInfo); - } + accessPoint.update(connectionConfig, mLastInfo, mLastNetworkInfo); } if (mIncludeSaved) { - if (!config.isPasspoint() || mIncludePasspoints) { - // If saved network not present in scan result then set its Rssi to MAX_VALUE - boolean apFound = false; - for (ScanResult result : results) { - if (result.SSID.equals(accessPoint.getSsidStr())) { - apFound = true; - break; - } + // If saved network not present in scan result then set its Rssi to MAX_VALUE + boolean apFound = false; + for (ScanResult result : results) { + if (result.SSID.equals(accessPoint.getSsidStr())) { + apFound = true; + break; } - if (!apFound) { - accessPoint.setRssi(Integer.MAX_VALUE); - } - accessPoints.add(accessPoint); } - - if (config.isPasspoint() == false) { - apMap.put(accessPoint.getSsidStr(), accessPoint); + if (!apFound) { + accessPoint.setRssi(Integer.MAX_VALUE); } + accessPoints.add(accessPoint); + apMap.put(accessPoint.getSsidStr(), accessPoint); } else { // If we aren't using saved networks, drop them into the cache so that // we have access to their saved info. @@ -397,20 +390,16 @@ public class WifiTracker { } if (result.isPasspointNetwork()) { + // Retrieve a WifiConfiguration for a Passpoint provider that matches + // the given ScanResult. This is used for showing that a given AP + // (ScanResult) is available via a Passpoint provider (provider friendly + // name). WifiConfiguration config = mWifiManager.getMatchingWifiConfig(result); if (config != null) { accessPoint.update(config); } } - if (mLastInfo != null && mLastInfo.getBSSID() != null - && mLastInfo.getBSSID().equals(result.BSSID) - && connectionConfig != null && connectionConfig.isPasspoint()) { - /* This network is connected via this passpoint config */ - /* SSID match is not going to work for it; so update explicitly */ - accessPoint.update(connectionConfig); - } - accessPoints.add(accessPoint); apMap.put(accessPoint.getSsidStr(), accessPoint); }