Adding eSIM option is not disabled if the current country is not in the allowed list

When both stack 1(pSIM) and stack 2(eSIM) are not available, stack 1 starts for emergency calls only. For eSIM, modem keeps on stopped state due to power consumption concern which is as per DSDS design.
Modified the logic to not call platform API if the countryCode is empty.

Bug: 231952356
Test: 1) Manually verified on C10P10 and Pixel 4a Device and eSIM option is enabled.
2) Modified not allowed country list and verified the eSIM option is disabled.

Change-Id: I99750f80fb2e2e180950b743ecbbbcb7a912528f
This commit is contained in:
Muralidhar Reddy
2022-06-01 04:45:21 +00:00
parent 15c33001a2
commit 396e2fd7d8

View File

@@ -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;
}
/**