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

Commit bc5228ed authored by songferngwang's avatar songferngwang
Browse files

To notify the ueser "Use mobile data"

After the telephony flag resetPrimarySimDefaultValues on, the telephony
set the preferred default subscription to remaining sim. Therefore, here
can ask whether the user uses [remaining SIM] for mobile data or not

Bug: 349783684
Test: atest MultiSimSettingControllerTest
Flag: EXEMPT bugfix
Change-Id: If8133d88dea31ebd35cc8f335a0a9f0a7b035c31
parent 5170c3ff
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);