Search in sources :

Example 6 with EuiccManager

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;
}
Also used : TelephonyManager(android.telephony.TelephonyManager) EuiccManager(android.telephony.euicc.EuiccManager)

Example 7 with EuiccManager

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)));
}
Also used : EuiccManager(android.telephony.euicc.EuiccManager) ContentResolver(android.content.ContentResolver)

Example 8 with EuiccManager

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);
}
Also used : EuiccManager(android.telephony.euicc.EuiccManager) ContentResolver(android.content.ContentResolver)

Example 9 with EuiccManager

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);
}
Also used : EuiccManager(android.telephony.euicc.EuiccManager) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 10 with EuiccManager

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;
}
Also used : EuiccManager(android.telephony.euicc.EuiccManager) ContentResolver(android.content.ContentResolver)

Aggregations

EuiccManager (android.telephony.euicc.EuiccManager)11 ContentResolver (android.content.ContentResolver)4 SubscriptionInfo (android.telephony.SubscriptionInfo)3 DataEnabledOverride (com.android.internal.telephony.dataconnection.DataEnabledOverride)3 PendingIntent (android.app.PendingIntent)2 Intent (android.content.Intent)2 TelephonyManager (android.telephony.TelephonyManager)2 ContentValues (android.content.ContentValues)1 UiccSlotInfo (android.telephony.UiccSlotInfo)1 Test (org.junit.Test)1 Config (org.robolectric.annotation.Config)1