diff options
author | Ecco Park <eccopark@google.com> | 2019-04-18 13:43:31 -0700 |
---|---|---|
committer | Ecco Park <eccopark@google.com> | 2019-04-18 13:55:57 -0700 |
commit | 7ff67da9e133ec06bf75b441d65c33212761a638 (patch) | |
tree | 28adf388ef2f0d7c4fa4e9dbe0633ee17fa25351 /service | |
parent | f61e141c8f344e9e92dfdc4203b7dee0762a8a09 (diff) |
PasspointNetworkEvaluator: filter Scanresults globally
Currently we only filter out the scan results for the installed profiles
It needs to be applied to auto connection logic for sim credential as well.
Bug: 130309348
Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I1313de629aba0f952af022fd7fb93399a96ddd5b
Signed-off-by: Ecco Park <eccopark@google.com>
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java index 30352814a..4abcf8446 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java @@ -39,6 +39,7 @@ import com.android.server.wifi.util.TelephonyUtil; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * This class is the WifiNetworkSelector.NetworkEvaluator implementation for @@ -105,6 +106,19 @@ public class PasspointNetworkEvaluator implements WifiNetworkSelector.NetworkEva @NonNull OnConnectableListener onConnectableListener) { // Sweep the ANQP cache to remove any expired ANQP entries. mPasspointManager.sweepCache(); + List<ScanDetail> filteredScanDetails = scanDetails.stream() + .filter(s -> s.getNetworkDetail().isInterworking()) + .filter(s -> { + if (!mWifiConfigManager.wasEphemeralNetworkDeleted( + ScanResultUtil.createQuotedSSID(s.getScanResult().SSID))) { + return true; + } else { + // If the user previously disconnects this network, don't select it. + mLocalLog.log("Ignoring disabled the SSID of Passpoint AP: " + + WifiNetworkSelector.toScanId(s.getScanResult())); + return false; + } + }).collect(Collectors.toList()); // Creates an ephemeral Passpoint profile if it finds a matching Passpoint AP for MCC/MNC // of the current MNO carrier on the device. @@ -114,7 +128,7 @@ public class PasspointNetworkEvaluator implements WifiNetworkSelector.NetworkEva && mCarrierNetworkConfig.isCarrierEncryptionInfoAvailable() && !mPasspointManager.hasCarrierProvider(mTelephonyManager.getSimOperator())) { int eapMethod = mPasspointManager.findEapMethodFromNAIRealmMatchedWithCarrier( - scanDetails); + filteredScanDetails); if (isCarrierEapMethod(eapMethod)) { PasspointConfiguration carrierConfig = mPasspointManager.createEphemeralPasspointConfigForCarrier( @@ -127,21 +141,9 @@ public class PasspointNetworkEvaluator implements WifiNetworkSelector.NetworkEva // Go through each ScanDetail and find the best provider for each ScanDetail. List<PasspointNetworkCandidate> candidateList = new ArrayList<>(); - for (ScanDetail scanDetail : scanDetails) { - // Skip non-Passpoint APs. - if (!scanDetail.getNetworkDetail().isInterworking()) { - continue; - } + for (ScanDetail scanDetail : filteredScanDetails) { ScanResult scanResult = scanDetail.getScanResult(); - // If the user previously disconnects this network, don't select it. - if (mWifiConfigManager.wasEphemeralNetworkDeleted( - ScanResultUtil.createQuotedSSID(scanResult.SSID))) { - mLocalLog.log("Ignoring disabled the SSID of Passpoint AP: " - + WifiNetworkSelector.toScanId(scanResult)); - continue; - } - // Find the best provider for this ScanDetail. Pair<PasspointProvider, PasspointMatch> bestProvider = mPasspointManager.matchProvider(scanResult); |