diff options
author | Jan Nordqvist <jannq@google.com> | 2016-06-07 17:44:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-06-07 17:44:36 +0000 |
commit | 42ab3717158a00b6a9c6d8b222a38544eea4feb9 (patch) | |
tree | d7eb932a70319b28f15ef07fb27fbf7cb94a3ec8 /service | |
parent | 92eab014dbec596df62a3f49cc7abaabbcf842e2 (diff) | |
parent | fc3aa7fb6a0f2df8243eadaf4767591dbd988e9b (diff) |
Merge "Fix issue in WifiStateMachine.matchProviderWithCurrentNetwork()."
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 32 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 9 |
2 files changed, 15 insertions, 26 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index d16d8e6c1..4e55061c7 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -276,7 +276,6 @@ public class WifiConfigManager { private final boolean mEnableOsuQueries; private final SIMAccessor mSIMAccessor; private final UserManager mUserManager; - private final Object mActiveScanDetailLock = new Object(); private boolean mVerboseLoggingEnabled = false; private Context mContext; @@ -310,7 +309,8 @@ public class WifiConfigManager { */ private HashSet<String> mLostConfigsDbg = new HashSet<String>(); - private ScanDetail mActiveScanDetail; // ScanDetail associated with active network + // NetworkDetail associated with the last selected Passpoint network. + private NetworkDetail mSelectedPasspointNetwork; private class SupplicantBridgeCallbacks implements SupplicantBridge.SupplicantBridgeCallbacks { @Override @@ -663,6 +663,7 @@ public class WifiConfigManager { setNetworkPriorityNative(config, ++mLastPriority); } + NetworkDetail selectedPasspointNetwork = null; if (config.isPasspoint()) { /* need to slap on the SSID of selected bssid to work */ if (getScanDetailCache(config).size() != 0) { @@ -671,6 +672,7 @@ public class WifiConfigManager { loge("Could not find scan result for " + config.BSSID); } else { logd("Setting SSID for " + config.networkId + " to" + result.getSSID()); + selectedPasspointNetwork = result.getNetworkDetail(); setSSIDNative(config, result.getSSID()); } @@ -678,6 +680,7 @@ public class WifiConfigManager { loge("Could not find bssid for " + config); } } + mSelectedPasspointNetwork = selectedPasspointNetwork; mWifiConfigStore.enableHS20(config.isPasspoint()); @@ -799,6 +802,7 @@ public class WifiConfigManager { WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLE); break; case DISCONNECTED: + mSelectedPasspointNetwork = null; //If network is already disabled, keep the status if (config.status == Status.CURRENT) { config.status = Status.ENABLED; @@ -918,11 +922,8 @@ public class WifiConfigManager { } public int matchProviderWithCurrentNetwork(String fqdn) { - ScanDetail scanDetail = null; - synchronized (mActiveScanDetailLock) { - scanDetail = mActiveScanDetail; - } - if (scanDetail == null) { + NetworkDetail selectedPasspointNetwork = mSelectedPasspointNetwork; + if (selectedPasspointNetwork == null) { return PasspointMatch.None.ordinal(); } HomeSP homeSP = mMOManager.getHomeSP(fqdn); @@ -930,12 +931,15 @@ public class WifiConfigManager { return PasspointMatch.None.ordinal(); } - ANQPData anqpData = mAnqpCache.getEntry(scanDetail.getNetworkDetail()); + Map<Constants.ANQPElementType, ANQPElement> anqpElements + = selectedPasspointNetwork.getANQPElements(); - Map<Constants.ANQPElementType, ANQPElement> anqpElements = - anqpData != null ? anqpData.getANQPElements() : null; + if (anqpElements == null || anqpElements.isEmpty()) { + ANQPData anqpData = mAnqpCache.getEntry(selectedPasspointNetwork); + anqpElements = anqpData != null ? anqpData.getANQPElements() : null; + } - return homeSP.match(scanDetail.getNetworkDetail(), anqpElements, mSIMAccessor).ordinal(); + return homeSP.match(selectedPasspointNetwork, anqpElements, mSIMAccessor).ordinal(); } /** @@ -3267,12 +3271,6 @@ public class WifiConfigManager { mEnableAutoJoinWhenAssociated.set(enabled); } - public void setActiveScanDetail(ScanDetail activeScanDetail) { - synchronized (mActiveScanDetailLock) { - mActiveScanDetail = activeScanDetail; - } - } - /** * Check if the provided ephemeral network was deleted by the user or not. * @param ssid ssid of the network diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index e477b149c..0eec1f1c7 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -2966,17 +2966,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } synchronized (mScanResultsLock) { - ScanDetail activeScanDetail = null; mScanResults = scanResults; mNumScanResultsReturned = mScanResults.size(); for (ScanDetail resultDetail : mScanResults) { - if (connected && resultDetail.getNetworkDetail().getBSSID() == activeBssid) { - if (activeScanDetail == null - || activeScanDetail.getNetworkDetail().getBSSID() != activeBssid - || activeScanDetail.getNetworkDetail().getANQPElements() == null) { - activeScanDetail = resultDetail; - } - } // Cache DTIM values parsed from the beacon frame Traffic Indication Map (TIM) // Information Element (IE), into the associated WifiConfigurations. Most of the // time there is no TIM IE in the scan result (Probe Response instead of Beacon @@ -2995,7 +2987,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } } } - mWifiConfigManager.setActiveScanDetail(activeScanDetail); } if (linkDebouncing) { |