Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 095babe5 authored by Muralidhar Reddy Mule's avatar Muralidhar Reddy Mule Committed by Automerger Merge Worker
Browse files

Merge "Adding eSIM option is not disabled if the current country is not in the...

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

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



Change-Id: I7b99e0f0b465f97c2ce6446ac13805da1409a30d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f9c6f838 77381e7e
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -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<String> 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;
    }

    /**