[MEP] Hide the preferred SIM dialog when the user has replaced the SIM am: 286dce6b6e

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/19194541

Change-Id: I7c0faaee0483eab1f36f6ba5646366f2ab523318
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/settings/network/telephony/SubscriptionActionDialogActivity.java b/src/com/android/settings/network/telephony/SubscriptionActionDialogActivity.java
index c509bac..391158f 100644
--- a/src/com/android/settings/network/telephony/SubscriptionActionDialogActivity.java
+++ b/src/com/android/settings/network/telephony/SubscriptionActionDialogActivity.java
@@ -60,8 +60,20 @@
      * @param message The string content should be displayed in the progress dialog.
      */
     protected void showProgressDialog(String message) {
+        showProgressDialog(message,false);
+    }
+
+    /**
+     * Displays a loading dialog.
+     *
+     * @param message The string content should be displayed in the progress dialog.
+     * @param updateIfNeeded is whether to update the progress state in the SharedPreferences.
+     */
+    protected void showProgressDialog(String message, boolean updateIfNeeded) {
         ProgressDialogFragment.show(getFragmentManager(), message, null);
-        setProgressState(PROGRESS_IS_SHOWING);
+        if (updateIfNeeded) {
+            setProgressState(PROGRESS_IS_SHOWING);
+        }
     }
 
     /** Dismisses the loading dialog. */
diff --git a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
index f5f18b4..a878cb3 100644
--- a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
+++ b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
@@ -220,8 +220,8 @@
                 showProgressDialog(
                         getString(
                                 R.string.sim_action_switch_sub_dialog_progress,
-                                SubscriptionUtil.getUniqueSubscriptionDisplayName(
-                                        mSubInfo, this)));
+                                SubscriptionUtil.getUniqueSubscriptionDisplayName(mSubInfo, this)),
+                        removedSubInfo != null ? true : false);
                 if (mIsEsimOperation) {
                     mSwitchToEuiccSubscriptionSidecar.run(mSubInfo.getSubscriptionId(),
                             UiccSlotUtil.INVALID_PORT_ID,