Merge "SettingsLib: wifi: Fixed AccessPoint tracking for Passpoint networks"

am: b13de64a11

Change-Id: I0e45cb17f11e8991d0d2c58cf7630f1e33296d97
This commit is contained in:
Peter Qiu
2017-02-21 18:39:01 +00:00
committed by android-build-merger
2 changed files with 16 additions and 31 deletions

View File

@@ -687,11 +687,7 @@ public class AccessPoint implements Comparable<AccessPoint> {
} }
void loadConfig(WifiConfiguration config) { void loadConfig(WifiConfiguration config) {
if (config.isPasspoint()) ssid = (config.SSID == null ? "" : removeDoubleQuotes(config.SSID));
ssid = config.providerFriendlyName;
else
ssid = (config.SSID == null ? "" : removeDoubleQuotes(config.SSID));
bssid = config.BSSID; bssid = config.BSSID;
security = getSecurity(config); security = getSecurity(config);
networkId = config.networkId; networkId = config.networkId;

View File

@@ -344,29 +344,22 @@ public class WifiTracker {
} }
AccessPoint accessPoint = getCachedOrCreate(config, cachedAccessPoints); AccessPoint accessPoint = getCachedOrCreate(config, cachedAccessPoints);
if (mLastInfo != null && mLastNetworkInfo != null) { if (mLastInfo != null && mLastNetworkInfo != null) {
if (config.isPasspoint() == false) { accessPoint.update(connectionConfig, mLastInfo, mLastNetworkInfo);
accessPoint.update(connectionConfig, mLastInfo, mLastNetworkInfo);
}
} }
if (mIncludeSaved) { if (mIncludeSaved) {
if (!config.isPasspoint() || mIncludePasspoints) { // If saved network not present in scan result then set its Rssi to MAX_VALUE
// If saved network not present in scan result then set its Rssi to MAX_VALUE boolean apFound = false;
boolean apFound = false; for (ScanResult result : results) {
for (ScanResult result : results) { if (result.SSID.equals(accessPoint.getSsidStr())) {
if (result.SSID.equals(accessPoint.getSsidStr())) { apFound = true;
apFound = true; break;
break;
}
} }
if (!apFound) {
accessPoint.setRssi(Integer.MAX_VALUE);
}
accessPoints.add(accessPoint);
} }
if (!apFound) {
if (config.isPasspoint() == false) { accessPoint.setRssi(Integer.MAX_VALUE);
apMap.put(accessPoint.getSsidStr(), accessPoint);
} }
accessPoints.add(accessPoint);
apMap.put(accessPoint.getSsidStr(), accessPoint);
} else { } else {
// If we aren't using saved networks, drop them into the cache so that // If we aren't using saved networks, drop them into the cache so that
// we have access to their saved info. // we have access to their saved info.
@@ -397,20 +390,16 @@ public class WifiTracker {
} }
if (result.isPasspointNetwork()) { 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); WifiConfiguration config = mWifiManager.getMatchingWifiConfig(result);
if (config != null) { if (config != null) {
accessPoint.update(config); 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); accessPoints.add(accessPoint);
apMap.put(accessPoint.getSsidStr(), accessPoint); apMap.put(accessPoint.getSsidStr(), accessPoint);
} }