Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6db10297 authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "To notify the ueser "Use mobile data"" into main

parents 44b3dbaa bc5228ed
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -642,7 +642,7 @@ public class MultiSimSettingController extends Handler {
        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 @@ public class MultiSimSettingController extends Handler {
            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 @@ public class MultiSimSettingController extends Handler {
        }
    }

    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);