diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java index 839a98cdb32..e769a4eed7d 100644 --- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java +++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java @@ -85,7 +85,9 @@ import com.android.settingslib.graph.SignalDrawable; import com.android.settingslib.utils.ThreadUtils; import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -711,15 +713,17 @@ public class MobileNetworkUtils { final TelephonyManager tm = (TelephonyManager) context.getSystemService(TelephonyManager.class); + Set countrySet = new HashSet<>(); for (int i = 0; i < tm.getPhoneCount(); i++) { String countryCode = tm.getNetworkCountryIso(i); - if (em.isSupportedCountry(countryCode)) { - Log.i(TAG, "isCurrentCountrySupported: eSIM is supported in " + countryCode); - return true; + if (!TextUtils.isEmpty(countryCode)) { + countrySet.add(countryCode); } } - Log.i(TAG, "isCurrentCountrySupported: eSIM is not supported in the current country."); - return false; + boolean isSupported = countrySet.stream().anyMatch(em::isSupportedCountry); + Log.i(TAG, "isCurrentCountrySupported countryCodes: " + countrySet + + " eSIMSupported: " + isSupported); + return isSupported; } /**