Loading src/java/com/android/internal/telephony/uicc/UiccCard.java +25 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.telephony.uicc; import static android.Manifest.permission.READ_PHONE_STATE; import android.app.ActivityManagerNative; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; Loading Loading @@ -68,6 +70,9 @@ public class UiccCard { protected static final String LOG_TAG = "UiccCard"; protected static final boolean DBG = true; public static final String EXTRA_ICC_CARD_ADDED = "com.android.internal.telephony.uicc.ICC_CARD_ADDED"; private static final String OPERATOR_BRAND_OVERRIDE_PREFIX = "operator_branding_"; private final Object mLock = new Object(); Loading Loading @@ -299,7 +304,7 @@ public class UiccCard { private void onIccSwap(boolean isAdded) { boolean isHotSwapSupported = mContext.getResources().getBoolean( com.android.internal.R.bool.config_hotswapCapable); R.bool.config_hotswapCapable); if (isHotSwapSupported) { log("onIccSwap: isHotSwapSupported is true, don't prompt for rebooting"); Loading @@ -307,7 +312,26 @@ public class UiccCard { } log("onIccSwap: isHotSwapSupported is false, prompt for rebooting"); promptForRestart(isAdded); } private void promptForRestart(boolean isAdded) { synchronized (mLock) { final Resources res = mContext.getResources(); final String dialogComponent = res.getString( R.string.config_iccHotswapPromptForRestartDialogComponent); if (dialogComponent != null) { Intent intent = new Intent().setComponent(ComponentName.unflattenFromString( dialogComponent)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(EXTRA_ICC_CARD_ADDED, isAdded); try { mContext.startActivity(intent); return; } catch (ActivityNotFoundException e) { loge("Unable to find ICC hotswap prompt for restart activity: " + e); } } // TODO: Here we assume the device can't handle SIM hot-swap // and has to reboot. We may want to add a property, // e.g. REBOOT_ON_SIM_SWAP, to indicate if modem support Loading Loading
src/java/com/android/internal/telephony/uicc/UiccCard.java +25 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.telephony.uicc; import static android.Manifest.permission.READ_PHONE_STATE; import android.app.ActivityManagerNative; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; Loading Loading @@ -68,6 +70,9 @@ public class UiccCard { protected static final String LOG_TAG = "UiccCard"; protected static final boolean DBG = true; public static final String EXTRA_ICC_CARD_ADDED = "com.android.internal.telephony.uicc.ICC_CARD_ADDED"; private static final String OPERATOR_BRAND_OVERRIDE_PREFIX = "operator_branding_"; private final Object mLock = new Object(); Loading Loading @@ -299,7 +304,7 @@ public class UiccCard { private void onIccSwap(boolean isAdded) { boolean isHotSwapSupported = mContext.getResources().getBoolean( com.android.internal.R.bool.config_hotswapCapable); R.bool.config_hotswapCapable); if (isHotSwapSupported) { log("onIccSwap: isHotSwapSupported is true, don't prompt for rebooting"); Loading @@ -307,7 +312,26 @@ public class UiccCard { } log("onIccSwap: isHotSwapSupported is false, prompt for rebooting"); promptForRestart(isAdded); } private void promptForRestart(boolean isAdded) { synchronized (mLock) { final Resources res = mContext.getResources(); final String dialogComponent = res.getString( R.string.config_iccHotswapPromptForRestartDialogComponent); if (dialogComponent != null) { Intent intent = new Intent().setComponent(ComponentName.unflattenFromString( dialogComponent)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(EXTRA_ICC_CARD_ADDED, isAdded); try { mContext.startActivity(intent); return; } catch (ActivityNotFoundException e) { loge("Unable to find ICC hotswap prompt for restart activity: " + e); } } // TODO: Here we assume the device can't handle SIM hot-swap // and has to reboot. We may want to add a property, // e.g. REBOOT_ON_SIM_SWAP, to indicate if modem support Loading