From 7ff67da9e133ec06bf75b441d65c33212761a638 Mon Sep 17 00:00:00 2001 From: Ecco Park Date: Thu, 18 Apr 2019 13:43:31 -0700 Subject: 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 --- .../wifi/hotspot2/PasspointNetworkEvaluator.java | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'service') 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 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 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 bestProvider = mPasspointManager.matchProvider(scanResult); -- cgit v1.2.3