use of android.telephony.euicc.EuiccManager in project android_packages_apps_Settings by omnirom.
the class MobileNetworkUtils method isCurrentCountrySupported.
/**
* Loop through all the device logical slots to check whether the user's current country
* supports eSIM.
*/
private static boolean isCurrentCountrySupported(Context context) {
final EuiccManager em = (EuiccManager) context.getSystemService(EuiccManager.class);
final TelephonyManager tm = (TelephonyManager) context.getSystemService(TelephonyManager.class);
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;
}
}
Log.i(TAG, "isCurrentCountrySupported: eSIM is not supported in the current country.");
return false;
}
use of android.telephony.euicc.EuiccManager in project android_packages_apps_Settings by omnirom.
the class MobileNetworkUtils method showEuiccSettingsDetecting.
// The same as #showEuiccSettings(Context context)
public static Boolean showEuiccSettingsDetecting(Context context) {
final EuiccManager euiccManager = (EuiccManager) context.getSystemService(EuiccManager.class);
if (!euiccManager.isEnabled()) {
Log.w(TAG, "EuiccManager is not enabled.");
return false;
}
final ContentResolver cr = context.getContentResolver();
final boolean esimIgnoredDevice = Arrays.asList(TextUtils.split(SystemProperties.get(KEY_ESIM_CID_IGNORE, ""), ",")).contains(SystemProperties.get(KEY_CID));
final boolean enabledEsimUiByDefault = SystemProperties.getBoolean(KEY_ENABLE_ESIM_UI_BY_DEFAULT, true);
final boolean euiccProvisioned = Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) != 0;
final boolean inDeveloperMode = DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context);
Log.i(TAG, String.format("showEuiccSettings: esimIgnoredDevice: %b, enabledEsimUiByDefault: " + "%b, euiccProvisioned: %b, inDeveloperMode: %b.", esimIgnoredDevice, enabledEsimUiByDefault, euiccProvisioned, inDeveloperMode));
return (euiccProvisioned || (!esimIgnoredDevice && inDeveloperMode) || (!esimIgnoredDevice && enabledEsimUiByDefault && isCurrentCountrySupported(context)));
}
use of android.telephony.euicc.EuiccManager in project android_packages_apps_Settings by omnirom.
the class ResetNetwork method showEuiccSettings.
private boolean showEuiccSettings(Context context) {
EuiccManager euiccManager = (EuiccManager) context.getSystemService(Context.EUICC_SERVICE);
if (!euiccManager.isEnabled()) {
return false;
}
ContentResolver resolver = context.getContentResolver();
return Settings.Global.getInt(resolver, Global.EUICC_PROVISIONED, 0) != 0 || DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context);
}
use of android.telephony.euicc.EuiccManager in project robolectric by robolectric.
the class ShadowEuiccManagerTest method createForCardId.
@Test
@Config(minSdk = Q)
public void createForCardId() {
int cardId = 1;
EuiccManager mockEuiccManager = mock(EuiccManager.class);
shadowOf(euiccManager).setEuiccManagerForCardId(cardId, mockEuiccManager);
assertThat(euiccManager.createForCardId(cardId)).isEqualTo(mockEuiccManager);
}
use of android.telephony.euicc.EuiccManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ResetNetwork method showEuiccSettings.
private boolean showEuiccSettings(Context context) {
EuiccManager euiccManager = (EuiccManager) context.getSystemService(Context.EUICC_SERVICE);
if (!euiccManager.isEnabled()) {
return false;
}
ContentResolver resolver = context.getContentResolver();
return Settings.Global.getInt(resolver, Global.EUICC_PROVISIONED, 0) != 0 || Settings.Global.getInt(resolver, Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
}
Aggregations