Dismissing the AlertDialog upon simremoval and app uninstall
Bug: 231930192
Test: Manual Verification done
Change-Id: Ie90512001b49062daeceac6e2f2b3c80614716b1
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 2e26a8e..52b06fb 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -175,6 +175,7 @@
private TonePlayer mTonePlayer = null;
private Vibrator mVibrator = null;
private BroadcastReceiver mUserActivityReceiver = null;
+ private AlertDialog mAlertDialog = null;
// Used for setting FLAG_ACTIVITY_NO_USER_ACTION when
// creating an intent.
@@ -404,6 +405,11 @@
unregisterHomeVisibilityObserver();
unregisterLocaleChangeReceiver();
unregisterHomeKeyEventReceiver();
+ // close the AlertDialog if any is showing upon sim remove etc cases
+ if (mAlertDialog != null && mAlertDialog.isShowing()) {
+ mAlertDialog.dismiss();
+ mAlertDialog = null;
+ }
sInstance = null;
waitForLooper();
PhoneConfigurationManager.unregisterForMultiSimConfigChange(mServiceHandler);
@@ -2356,7 +2362,7 @@
msg.text = getResources().getString(R.string.default_open_channel_msg);
}
- final AlertDialog dialog = new AlertDialog.Builder(mContext)
+ mAlertDialog = new AlertDialog.Builder(mContext)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(msg.title)
.setMessage(msg.text)
@@ -2381,13 +2387,13 @@
})
.create();
- dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ mAlertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
if (!mContext.getResources().getBoolean(
R.bool.config_sf_slowBlur)) {
- dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
+ mAlertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
- dialog.show();
+ mAlertDialog.show();
}
private void launchTransientEventMessage(int slotId) {