diff options
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointManager.java | 15 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointNetworkNominateHelper.java | 4 |
2 files changed, 18 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java index 755a9b3a9..02c691cce 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java @@ -67,6 +67,7 @@ import com.android.server.wifi.util.TelephonyUtil; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -1010,9 +1011,12 @@ public class PasspointManager { * @return List of {@link WifiConfiguration} converted from {@link PasspointProvider} */ public List<WifiConfiguration> getWifiConfigsForPasspointProfiles(List<String> idList) { + if (mProviders.isEmpty()) { + return Collections.emptyList(); + } + List<WifiConfiguration> configs = new ArrayList<>(); Set<String> uniqueIdSet = new HashSet<>(); uniqueIdSet.addAll(idList); - List<WifiConfiguration> configs = new ArrayList<>(); for (String uniqueId : uniqueIdSet) { PasspointProvider provider = mProviders.get(uniqueId); if (provider == null) { @@ -1192,4 +1196,13 @@ public class PasspointManager { return filteredScanResults; } + + /** + * Check if the providers list is empty + * + * @return true if the providers list is empty, false otherwise + */ + public boolean isProvidersListEmpty() { + return mProviders.isEmpty(); + } } diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkNominateHelper.java b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkNominateHelper.java index 0fadd3c84..e319c0014 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkNominateHelper.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkNominateHelper.java @@ -32,6 +32,7 @@ import com.android.server.wifi.hotspot2.anqp.HSWanMetricsElement; import com.android.server.wifi.util.ScanResultUtil; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -135,6 +136,9 @@ public class PasspointNetworkNominateHelper { */ private @NonNull List<Pair<ScanDetail, WifiConfiguration>> findBestMatchScanDetailForProviders( List<ScanDetail> scanDetails, boolean isFromSuggestion) { + if (mPasspointManager.isProvidersListEmpty()) { + return Collections.emptyList(); + } List<Pair<ScanDetail, WifiConfiguration>> results = new ArrayList<>(); Map<PasspointProvider, List<PasspointNetworkCandidate>> candidatesPerProvider = new HashMap<>(); |