Merge "Gracefully tear down networks when SIM is disabled" into main
diff --git a/src/java/com/android/internal/telephony/MultiSimSettingController.java b/src/java/com/android/internal/telephony/MultiSimSettingController.java
index 0436ae5..e98b996 100644
--- a/src/java/com/android/internal/telephony/MultiSimSettingController.java
+++ b/src/java/com/android/internal/telephony/MultiSimSettingController.java
@@ -642,7 +642,7 @@
if (DBG) log("updateDefaultValues: change: " + change);
if (change == PRIMARY_SUB_NO_CHANGE) return;
- // If there's only one primary subscription active, we trigger PREFERRED_PICK_DIALOG
+ // If there's only one primary subscription active, we trigger mobile data
// dialog if and only if there were multiple primary SIM cards and one is removed.
// Otherwise, if user just inserted their first SIM, or there's one primary and one
// opportunistic subscription active (activeSubInfos.size() > 1), we automatically
@@ -658,7 +658,19 @@
if (hasCalling()) mSubscriptionManagerService.setDefaultVoiceSubId(subId);
if (hasMessaging()) mSubscriptionManagerService.setDefaultSmsSubId(subId);
if (!mSubscriptionManagerService.isEsimBootStrapProvisioningActivated()) {
- sendDefaultSubConfirmedNotification(subId);
+ // Determines the appropriate notification type
+ // Preconditions:
+ // - There is only one active primary subscription.
+ // - The eSIM bootstrap is NOT activated.
+ // Behavior:
+ // - If the primary subscription is not deactivated OR the device is in single SIM
+ // mode, send a notification to dismiss the SIM dialog.
+ // - Otherwise, send a notification to trigger the preferred SIM/data pick dialog.
+ @TelephonyManager.DefaultSubscriptionSelectType
+ int type = (change != PRIMARY_SUB_REMOVED || mActiveModemCount == 1)
+ ? EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DISMISS
+ : EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL;
+ sendDefaultSubConfirmedNotification(type, subId);
}
return;
}
@@ -770,14 +782,14 @@
}
}
- private void sendDefaultSubConfirmedNotification(int defaultSubId) {
+ private void sendDefaultSubConfirmedNotification(
+ @TelephonyManager.DefaultSubscriptionSelectType int type, int defaultSubId) {
Intent intent = new Intent();
intent.setAction(ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED);
intent.setClassName("com.android.settings",
"com.android.settings.sim.SimSelectNotification");
- intent.putExtra(EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE,
- EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DISMISS);
+ intent.putExtra(EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE, type);
intent.putExtra(EXTRA_SUBSCRIPTION_ID, defaultSubId);
mContext.sendBroadcast(intent);