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

Commit 723a90b8 authored by Xin Li's avatar Xin Li Committed by Gerrit Code Review
Browse files

Merge "Merge Android 12 QPR1"

parents 40d224be e9f9b66c
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -12,4 +12,3 @@ jayachandranc@google.com
chinmayd@google.com
amruthr@google.com
sasindran@google.com
+27 −16
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.IntentFilter;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
import android.provider.Telephony;
@@ -164,7 +165,7 @@ public class CarrierResolver extends Handler {
                updateCarrierIdAndName(
                    carrierId, carrierName != null ? carrierName : "",
                    specificCarrierId, specificCarrierName != null ? carrierName : "",
                    mnoCarrierId);
                    mnoCarrierId, false);
            }
        }
    };
@@ -215,12 +216,12 @@ public class CarrierResolver extends Handler {
                handleSimAbsent();
                break;
            case IccCardConstants.INTENT_VALUE_ICC_LOADED:
                handleSimLoaded();
                handleSimLoaded(false);
                break;
        }
    }

    private void handleSimLoaded() {
    private void handleSimLoaded(boolean isSimOverride) {
        if (mIccRecords != null) {
            /**
             * returns empty string to be consistent with
@@ -232,7 +233,9 @@ public class CarrierResolver extends Handler {
            loge("mIccRecords is null on SIM_LOAD_EVENT, could not get SPN");
        }
        mPreferApn = getPreferApn();
        loadCarrierMatchingRulesOnMccMnc(false /* update carrier config */);
        loadCarrierMatchingRulesOnMccMnc(
                false /* update carrier config */,
                isSimOverride);
    }

    private void handleSimAbsent() {
@@ -241,7 +244,7 @@ public class CarrierResolver extends Handler {
        mPreferApn = null;
        updateCarrierIdAndName(TelephonyManager.UNKNOWN_CARRIER_ID, null,
                TelephonyManager.UNKNOWN_CARRIER_ID, null,
                TelephonyManager.UNKNOWN_CARRIER_ID);
                TelephonyManager.UNKNOWN_CARRIER_ID, false);
    }

    private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
@@ -274,19 +277,24 @@ public class CarrierResolver extends Handler {
        if (DBG) logd("handleMessage: " + msg.what);
        switch (msg.what) {
            case SIM_LOAD_EVENT:
                handleSimLoaded();
                AsyncResult result = (AsyncResult) msg.obj;
                boolean isSimOverride = false;
                if (result != null) {
                    isSimOverride = result.userObj instanceof Boolean && (Boolean) result.userObj;
                }
                handleSimLoaded(isSimOverride);
                break;
            case CARRIER_ID_DB_UPDATE_EVENT:
                // clean the cached carrier list version, so that a new one will be queried.
                mCarrierListVersion = null;
                loadCarrierMatchingRulesOnMccMnc(true /* update carrier config*/);
                loadCarrierMatchingRulesOnMccMnc(true /* update carrier config*/, false);
                break;
            case PREFER_APN_UPDATE_EVENT:
                String preferApn = getPreferApn();
                if (!equals(mPreferApn, preferApn, true)) {
                    logd("[updatePreferApn] from:" + mPreferApn + " to:" + preferApn);
                    mPreferApn = preferApn;
                    matchSubscriptionCarrier(true /* update carrier config*/);
                    matchSubscriptionCarrier(true /* update carrier config*/, false);
                }
                break;
            case ICC_CHANGED_EVENT:
@@ -301,7 +309,8 @@ public class CarrierResolver extends Handler {
                    }
                    if (newIccRecords != null) {
                        logd("new Icc object");
                        newIccRecords.registerForRecordsOverride(this, SIM_LOAD_EVENT, null);
                        newIccRecords.registerForRecordsOverride(this, SIM_LOAD_EVENT,
                                /* is sim override*/true);
                        mIccRecords = newIccRecords;
                    }
                }
@@ -312,7 +321,9 @@ public class CarrierResolver extends Handler {
        }
    }

    private void loadCarrierMatchingRulesOnMccMnc(boolean updateCarrierConfig) {
    private void loadCarrierMatchingRulesOnMccMnc(
            boolean updateCarrierConfig,
            boolean isSimOverride) {
        try {
            String mccmnc = mTelephonyMgr.getSimOperatorNumericForPhone(mPhone.getPhoneId());
            Cursor cursor = mContext.getContentResolver().query(
@@ -330,7 +341,7 @@ public class CarrierResolver extends Handler {
                    while (cursor.moveToNext()) {
                        mCarrierMatchingRulesOnMccMnc.add(makeCarrierMatchingRule(cursor));
                    }
                    matchSubscriptionCarrier(updateCarrierConfig);
                    matchSubscriptionCarrier(updateCarrierConfig, isSimOverride);

                    // Generate metrics related to carrier ID table version.
                    CarrierIdMatchStats.sendCarrierIdTableVersion(getCarrierListVersion());
@@ -465,7 +476,7 @@ public class CarrierResolver extends Handler {

    private void updateCarrierIdAndName(int cid, String name,
                                        int specificCarrierId, String specificCarrierName,
                                        int mnoCid) {
                                        int mnoCid, boolean isSimOverride) {
        boolean update = false;
        if (specificCarrierId != mSpecificCarrierId) {
            logd("[updateSpecificCarrierId] from:" + mSpecificCarrierId + " to:"
@@ -534,7 +545,7 @@ public class CarrierResolver extends Handler {
        // during esim profile switch, there is no sim absent thus carrier id will persist and
        // might not trigger an update if switch profiles for the same carrier. thus always update
        // subscriptioninfo db to make sure we have correct carrier id set.
        if (SubscriptionManager.isValidSubscriptionId(mPhone.getSubId())) {
        if (SubscriptionManager.isValidSubscriptionId(mPhone.getSubId()) && !isSimOverride) {
            // only persist carrier id to simInfo db when subId is valid.
            SubscriptionController.getInstance().setCarrierId(mCarrierId, mPhone.getSubId());
        }
@@ -827,7 +838,7 @@ public class CarrierResolver extends Handler {
    /**
     * find the best matching carrier from candidates with matched subscription MCCMNC.
     */
    private void matchSubscriptionCarrier(boolean updateCarrierConfig) {
    private void matchSubscriptionCarrier(boolean updateCarrierConfig, boolean isSimOverride) {
        if (!SubscriptionManager.isValidSubscriptionId(mPhone.getSubId())) {
            logd("[matchSubscriptionCarrier]" + "skip before sim records loaded");
            return;
@@ -870,7 +881,7 @@ public class CarrierResolver extends Handler {
                    + " name: " + null);
            updateCarrierIdAndName(TelephonyManager.UNKNOWN_CARRIER_ID, null,
                    TelephonyManager.UNKNOWN_CARRIER_ID, null,
                    TelephonyManager.UNKNOWN_CARRIER_ID);
                    TelephonyManager.UNKNOWN_CARRIER_ID, isSimOverride);
        } else {
            // if there is a single matching result, check if this rule has parent cid assigned.
            if ((maxRule == maxRuleParent)
@@ -884,7 +895,7 @@ public class CarrierResolver extends Handler {
                    + " name: " + maxRuleParent.mName);
            updateCarrierIdAndName(maxRuleParent.mCid, maxRuleParent.mName,
                    maxRule.mCid, maxRule.mName,
                    (mnoRule == null) ? maxRule.mCid : mnoRule.mCid);
                    (mnoRule == null) ? maxRule.mCid : mnoRule.mCid, isSimOverride);

            if (updateCarrierConfig) {
                logd("[matchSubscriptionCarrier] - Calling updateCarrierConfig()");
+9 −0
Original line number Diff line number Diff line
@@ -2205,6 +2205,15 @@ public interface CommandsInterface {
    public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus,
            Message result);

    /**
     * Whether the device modem supports reporting the EID in either the slot or card status or
     * through ATR.
     * @return true if the modem supports EID.
     */
    default boolean supportsEid() {
        return false;
    }

    /**
     * Tells the modem if data is allowed or not.
     *
+12 −7
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.telephony.Rlog;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

/**
 * {@hide}
@@ -141,7 +141,10 @@ public class GsmCdmaConnection extends Connection {
        mAddress = dc.number;
        setEmergencyCallInfo(mOwner);

        mForwardedNumber = new ArrayList<String>(Arrays.asList(dc.forwardedNumber));
        String forwardedNumber = TextUtils.isEmpty(dc.forwardedNumber) ? null : dc.forwardedNumber;
        Rlog.i(LOG_TAG, "create, forwardedNumber=" + Rlog.pii(LOG_TAG, forwardedNumber));
        mForwardedNumber =  forwardedNumber == null ? null :
                new ArrayList<>(Collections.singletonList(dc.forwardedNumber));
        mIsIncoming = dc.isMT;
        mCreateTime = System.currentTimeMillis();
        mCnapName = dc.name;
@@ -710,11 +713,13 @@ public class GsmCdmaConnection extends Connection {
            mOwner.getPhone().getVoiceCallSessionStats().onAudioCodecChanged(this, dc.audioQuality);
        }

        ArrayList<String> forwardedNumber =
                new ArrayList<String>(Arrays.asList(dc.forwardedNumber));
        if (!equalsHandlesNulls(mForwardedNumber, forwardedNumber)) {
            if (Phone.DEBUG_PHONE) log("update: mForwardedNumber, # changed!");
            mForwardedNumber = forwardedNumber;
        String forwardedNumber = TextUtils.isEmpty(dc.forwardedNumber) ? null : dc.forwardedNumber;
        Rlog.i(LOG_TAG, "update: forwardedNumber=" + Rlog.pii(LOG_TAG, forwardedNumber));
        ArrayList<String> forwardedNumbers =  forwardedNumber == null ? null :
                new ArrayList<>(Collections.singletonList(dc.forwardedNumber));
        if (!equalsHandlesNulls(mForwardedNumber, forwardedNumbers)) {
            if (Phone.DEBUG_PHONE) log("update: mForwardedNumber, # changed");
            mForwardedNumber = forwardedNumbers;
            changed = true;
        }

+7 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static android.service.carrier.CarrierMessagingService.RECEIVE_OPTIONS_SK
import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Activity;
import android.app.AppOpsManager;
@@ -1704,10 +1705,15 @@ public abstract class InboundSmsHandler extends StateMachine {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent == null) {
                logeWithLocalLog("onReceive: received null intent, faking " + mWaitingForIntent,
                        mInboundSmsTracker.getMessageId());
                return;
            }
            handleAction(intent, true);
        }

        private synchronized void handleAction(Intent intent, boolean onReceive) {
        private synchronized void handleAction(@NonNull Intent intent, boolean onReceive) {
            String action = intent.getAction();
            if (mWaitingForIntent == null || !mWaitingForIntent.getAction().equals(action)) {
                logeWithLocalLog("handleAction: Received " + action + " when expecting "
Loading