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

Commit cb940a62 authored by Ling Ma's avatar Ling Ma Committed by Jack Yu
Browse files

Update auto switch notification intent

Put the target subId in intent directly without being wrapped by a bundle.
Improved logs.

Test: manual
Bug: 257991417
Merged-In: I9bec0e35aa2a5eb19f3af7c3cc7ffbe77809faeb
Change-Id: I9bec0e35aa2a5eb19f3af7c3cc7ffbe77809faeb
parent 5a14644d
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -1259,6 +1259,7 @@ public class PhoneSwitcher extends Handler {
                // the alternative phone must have HOME availability
                if (mPhoneStates[phoneId].dataRegState
                        == NetworkRegistrationInfo.REGISTRATION_STATE_HOME) {
                    log("getAutoSwitchTargetSubId: found phone " + phoneId + " in HOME service");
                    Phone secondaryDataPhone = findPhoneById(phoneId);
                    if (secondaryDataPhone != null && // check auto switch feature enabled
                            secondaryDataPhone.isDataAllowed()) {
@@ -2078,6 +2079,7 @@ public class PhoneSwitcher extends Handler {
        pw.println("mAutoDataSwitchAvailabilityStabilityTimeThreshold="
                + mAutoDataSwitchAvailabilityStabilityTimeThreshold);
        pw.println("mAutoDataSwitchValidationMaxRetry=" + mAutoDataSwitchValidationMaxRetry);
        pw.println("mDisplayedAutoSwitchNotification=" + mDisplayedAutoSwitchNotification);
        pw.println("Local logs:");
        pw.increaseIndent();
        mLocalLog.dump(fd, pw, args);
@@ -2137,20 +2139,16 @@ public class PhoneSwitcher extends Handler {

        if (mDisplayedAutoSwitchNotification) {
            // cancel posted notification if any exist
            if (VDBG) {
            log("displayAutoDataSwitchNotification: canceling any notifications for subId "
                    + mAutoSelectedDataSubId);
            }
            notificationManager.cancel(AUTO_DATA_SWITCH_NOTIFICATION_TAG,
                    AUTO_DATA_SWITCH_NOTIFICATION_ID);
            return;
        }
        // proceed only the first time auto data switch occurs
        if (mLastAutoSelectedSwitchReason != DataSwitch.Reason.DATA_SWITCH_REASON_AUTO) {
            if (VDBG) {
            log("displayAutoDataSwitchNotification: Ignore DDS switch due to "
                    + switchReasonToString(mLastAutoSelectedSwitchReason));
            }
            return;
        }
        SubscriptionInfo subInfo = mSubscriptionController.getSubscriptionInfo(
@@ -2159,13 +2157,13 @@ public class PhoneSwitcher extends Handler {
            loge("displayAutoDataSwitchNotification: unexpected " + subInfo);
            return;
        }
        log("displayAutoDataSwitchNotification: displaying for subId=" + mAutoSelectedDataSubId);
        logl("displayAutoDataSwitchNotification: display for subId=" + mAutoSelectedDataSubId);
        // "Mobile network settings" screen / dialog
        Intent intent = new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS);
        final Bundle fragmentArgs = new Bundle();
        // Special contract for Settings to highlight permission row
        fragmentArgs.putString(SETTINGS_EXTRA_FRAGMENT_ARG_KEY, AUTO_DATA_SWITCH_SETTING_R_ID);
        fragmentArgs.putInt(Settings.EXTRA_SUB_ID, mAutoSelectedDataSubId);
        intent.putExtra(Settings.EXTRA_SUB_ID, mAutoSelectedDataSubId);
        intent.putExtra(SETTINGS_EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
        PendingIntent contentIntent = PendingIntent.getActivity(
                mContext, mAutoSelectedDataSubId, intent, PendingIntent.FLAG_IMMUTABLE);