Merge "Adding eSIM option is not disabled if the current country is not in the allowed list" into tm-d1-dev am: 77381e7e35

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/18671508

Change-Id: Ie6673d39e96342de744f7ffad2bf3f49b8ff1805
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Muralidhar Reddy Mule
2022-06-02 17:02:19 +00:00
committed by Automerger Merge Worker

View File

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