Use wear style dialog for ICC hotswap restart dialog.
b/24719054
Change-Id: If341828ef3de7f6afb955f2e5be3c6901f21c169
diff --git a/src/java/com/android/internal/telephony/uicc/UiccCard.java b/src/java/com/android/internal/telephony/uicc/UiccCard.java
index f40e7a8..c75f234 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccCard.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccCard.java
@@ -19,6 +19,8 @@
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;
@@ -68,6 +70,9 @@
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();
@@ -299,7 +304,7 @@
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");
@@ -307,7 +312,26 @@
}
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