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

Commit bb873b34 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Gerrit Code Review
Browse files

Merge changes from topic "128645056"

* changes:
  In PhoneSwitcher, retry RIL command if they fail.
  Rename non-opportunistic (nonOppt) to primary.
  Clear calling identity after permission check of setDefaultDataSubId.
  Rename variables in PhoneSwitcher.
  Clean up a few names of Telephony intent extra.
parents 1bb9e839 60482a60
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -18,11 +18,11 @@ package com.android.internal.telephony;

import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
import static android.telephony.TelephonyManager.ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_ID;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE;
import static android.telephony.TelephonyManager.EXTRA_SUBSCRIPTION_ID;

import android.content.Context;
import android.content.Intent;
@@ -31,6 +31,7 @@ import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
@@ -246,6 +247,7 @@ public class MultiSimSettingController {

    private void showSimSelectDialogIfNeeded(List<SubscriptionInfo> prevPrimarySubs,
            boolean dataSelected, boolean voiceSelected, boolean smsSelected) {
        @TelephonyManager.DefaultSubscriptionSelectType
        int dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE;
        int preferredSubId = INVALID_SUBSCRIPTION_ID;
        boolean primarySubRemoved = prevPrimarySubs != null
@@ -259,7 +261,7 @@ public class MultiSimSettingController {
        // user to select default for data as it's most important.
        if (mPrimarySubList.size() == 1 && primarySubRemoved
                && (!dataSelected || !smsSelected || !voiceSelected)) {
            dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES;
            dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL;
            preferredSubId = mPrimarySubList.get(0).getSubscriptionId();
        } else if (mPrimarySubList.size() > 1 && (!dataSelected || primarySubAdded)) {
            dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA;
@@ -272,8 +274,8 @@ public class MultiSimSettingController {
                    "com.android.settings.sim.SimSelectNotification");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.putExtra(EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE, dialogType);
            if (dialogType == EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES) {
                intent.putExtra(EXTRA_DEFAULT_SUBSCRIPTION_ID, preferredSubId);
            if (dialogType == EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL) {
                intent.putExtra(EXTRA_SUBSCRIPTION_ID, preferredSubId);
            }
            mContext.sendBroadcast(intent);
        }
+112 −79

File changed.

Preview size limit exceeded, changes collapsed.

+44 −38
Original line number Diff line number Diff line
@@ -2054,6 +2054,8 @@ public class SubscriptionController extends ISub.Stub {
    public void setDefaultDataSubId(int subId) {
        enforceModifyPhoneState("setDefaultDataSubId");

        final long identity = Binder.clearCallingIdentity();
        try {
            if (subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
                throw new RuntimeException("setDefaultDataSubId called with DEFAULT_SUB_ID");
            }
@@ -2078,7 +2080,8 @@ public class SubscriptionController extends ISub.Stub {
                        // TODO Handle the general case of N modems and M subscriptions.
                        raf = proxyController.getMinRafSupported();
                    }
                logdl("[setDefaultDataSubId] phoneId=" + phoneId + " subId=" + id + " RAF=" + raf);
                    logdl("[setDefaultDataSubId] phoneId=" + phoneId + " subId=" + id + " RAF="
                            + raf);
                    rafs[phoneId] = new RadioAccessFamily(phoneId, raf);
                }
                if (atLeastOneMatch) {
@@ -2095,6 +2098,9 @@ public class SubscriptionController extends ISub.Stub {
                    Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, subId);
            MultiSimSettingController.getInstance().onDefaultDataSettingChanged();
            broadcastDefaultDataSubIdChanged(subId);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    @UnsupportedAppUsage
@@ -2673,7 +2679,7 @@ public class SubscriptionController extends ISub.Stub {
        final long token = Binder.clearCallingIdentity();

        try {
            PhoneSwitcher.getInstance().trySetPreferredSubscription(
            PhoneSwitcher.getInstance().trySetOpportunisticDataSubscription(
                    subId, needValidation, callback);
        } finally {
            Binder.restoreCallingIdentity(token);
@@ -2686,7 +2692,7 @@ public class SubscriptionController extends ISub.Stub {
        final long token = Binder.clearCallingIdentity();

        try {
            return PhoneSwitcher.getInstance().getPreferredDataSubscriptionId();
            return PhoneSwitcher.getInstance().getOpportunisticDataSubscriptionId();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
+6 −6

File changed.

Preview size limit exceeded, changes collapsed.