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

Commit 82580cae authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5457264 from db8d2e7f to qt-release

Change-Id: Ia42ecb2fca711426dd1e97bdfff30ec105d49d27
parents 43fc4a3e db8d2e7f
Loading
Loading
Loading
Loading
+73 −81
Original line number Diff line number Diff line
@@ -690,8 +690,6 @@ public class IccSmsInterfaceManager {
            }
        }

        final long ident = Binder.clearCallingIdentity();
        try {
        destAddr = filterDestAddress(destAddr);

        if (parts.size() > 1 && parts.size() < 10 && !SmsMessage.hasEmsSupport()) {
@@ -702,7 +700,8 @@ public class IccSmsInterfaceManager {
                if (SmsMessage.shouldAppendPageNumberAsPrefix()) {
                    singlePart = String.valueOf(i + 1) + '/' + parts.size() + ' ' + singlePart;
                } else {
                        singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/' + parts.size());
                    singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/'
                            + parts.size());
                }

                PendingIntent singleSentIntent = null;
@@ -731,9 +730,7 @@ public class IccSmsInterfaceManager {
                                      (ArrayList<PendingIntent>) deliveryIntents,
                                      null, callingPackage, persistMessageForNonDefaultSmsApp,
                                          priority, expectMore, validityPeriod);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }

    }

    @UnsupportedAppUsage
@@ -1183,9 +1180,6 @@ public class IccSmsInterfaceManager {
            returnUnspecifiedFailure(sentIntents);
            return;
        }

        final long ident = Binder.clearCallingIdentity();
        try {
        textAndAddress[1] = filterDestAddress(textAndAddress[1]);

        if (parts.size() > 1 && parts.size() < 10 && !SmsMessage.hasEmsSupport()) {
@@ -1196,7 +1190,8 @@ public class IccSmsInterfaceManager {
                if (SmsMessage.shouldAppendPageNumberAsPrefix()) {
                    singlePart = String.valueOf(i + 1) + '/' + parts.size() + ' ' + singlePart;
                } else {
                        singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/' + parts.size());
                    singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/'
                            + parts.size());
                }

                PendingIntent singleSentIntent = null;
@@ -1230,9 +1225,6 @@ public class IccSmsInterfaceManager {
                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                false /* expectMore */,
                SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    private boolean isFailedOrDraft(ContentResolver resolver, Uri messageUri) {
+4 −3
Original line number Diff line number Diff line
@@ -194,11 +194,12 @@ public final class NetworkScanRequestTracker {

        if (result != null) {
            if (what == TelephonyScanManager.CALLBACK_RESTRICTED_SCAN_RESULTS) {
                List<String> allowedMccMncs =
                        getAllowedMccMncsForLocationRestrictedScan(nsri.mPhone.getContext());
                //List<String> allowedMccMncs =
                //        getAllowedMccMncsForLocationRestrictedScan(nsri.mPhone.getContext());

                result = result.stream().map(CellInfo::sanitizeLocationInfo)
                        .filter(ci -> doesCellInfoCorrespondToKnownMccMnc(ci, allowedMccMncs))
                        // STOPSHIP Revisit PLMN check (b/130253962).
                        //.filter(ci -> doesCellInfoCorrespondToKnownMccMnc(ci, allowedMccMncs))
                        .collect(Collectors.toList());
            }

+14 −8
Original line number Diff line number Diff line
@@ -2012,6 +2012,9 @@ public abstract class SMSDispatcher extends Handler {
    }

    private boolean isAscii7bitSupportedForLongMessage() {
        //TODO: Do not rely on calling identity here, we should store UID & clear identity earlier.
        long token = Binder.clearCallingIdentity();
        try {
            CarrierConfigManager configManager = (CarrierConfigManager) mContext.getSystemService(
                    Context.CARRIER_CONFIG_SERVICE);
            PersistableBundle pb = null;
@@ -2021,5 +2024,8 @@ public abstract class SMSDispatcher extends Handler {
                        .KEY_ASCII_7_BIT_SUPPORT_FOR_LONG_MESSAGE_BOOL);
            }
            return false;
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
}
+69 −0
Original line number Diff line number Diff line
@@ -113,6 +113,8 @@ import java.util.List;
import java.util.Objects;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/**
@@ -322,6 +324,8 @@ public class ServiceStateTracker extends Handler {
    private final LocalLog mRadioPowerLog = new LocalLog(20);
    private final LocalLog mMdnLog = new LocalLog(20);

    private Pattern mOperatorNameStringPattern;

    private class SstSubscriptionsChangedListener extends OnSubscriptionsChangedListener {
        public final AtomicInteger mPreviousSubId =
                new AtomicInteger(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -1076,6 +1080,7 @@ public class ServiceStateTracker extends Handler {
                        loge("Invalid CellInfo result");
                    } else {
                        cellInfo = (List<CellInfo>) ar.result;
                        updateOperatorNameForCellInfo(cellInfo);
                        mLastCellInfoList = cellInfo;
                        mPhone.notifyCellInfo(cellInfo);
                        if (VDBG) {
@@ -1188,6 +1193,7 @@ public class ServiceStateTracker extends Handler {
                if (ar.exception == null) {
                    CellIdentity cellIdentity = ((NetworkRegistrationInfo) ar.result)
                            .getCellIdentity();
                    updateOperatorNameForCellIdentity(cellIdentity);
                    mCellIdentity = cellIdentity;
                    mPhone.notifyLocationChanged(getCellLocation());
                }
@@ -1776,6 +1782,7 @@ public class ServiceStateTracker extends Handler {
        if (mPollingContext[0] == 0) {
            mNewSS.setEmergencyOnly(mEmergencyOnly);
            combinePsRegistrationStates(mNewSS);
            updateOperatorNameForServiceState(mNewSS);
            if (mPhone.isPhoneTypeGsm()) {
                updateRoamingState();
            } else {
@@ -2158,6 +2165,8 @@ public class ServiceStateTracker extends Handler {
                    String opNames[] = (String[]) ar.result;

                    if (opNames != null && opNames.length >= 3) {
                        mNewSS.setOperatorAlphaLongRaw(opNames[0]);
                        mNewSS.setOperatorAlphaShortRaw(opNames[1]);
                        // FIXME: Giving brandOverride higher precedence, is this desired?
                        String brandOverride = mUiccController.getUiccCard(getPhoneId()) != null
                                ? mUiccController.getUiccCard(getPhoneId())
@@ -4481,6 +4490,11 @@ public class ServiceStateTracker extends Handler {
        if (config != null) {
            updateLteEarfcnLists(config);
            updateReportingCriteria(config);
            String operatorNamePattern = config.getString(
                    CarrierConfigManager.KEY_OPERATOR_NAME_FILTER_PATTERN_STRING);
            if (!TextUtils.isEmpty(operatorNamePattern)) {
                mOperatorNameStringPattern = Pattern.compile(operatorNamePattern);
            }
        }

        // Sometimes the network registration information comes before carrier config is ready.
@@ -5205,4 +5219,59 @@ public class ServiceStateTracker extends Handler {
    String getCdmaEriText(int roamInd, int defRoamInd) {
        return mEriManager.getCdmaEriText(roamInd, defRoamInd);
    }

    private void updateOperatorNameForServiceState(ServiceState servicestate) {
        if (servicestate == null) {
            return;
        }

        servicestate.setOperatorName(
                filterOperatorNameByPattern(servicestate.getOperatorAlphaLong()),
                filterOperatorNameByPattern(servicestate.getOperatorAlphaShort()),
                servicestate.getOperatorNumeric());

        List<NetworkRegistrationInfo> networkRegistrationInfos =
                servicestate.getNetworkRegistrationInfoList();

        for (int i = 0; i < networkRegistrationInfos.size(); i++) {
            if (networkRegistrationInfos.get(i) != null) {
                updateOperatorNameForCellIdentity(
                        networkRegistrationInfos.get(i).getCellIdentity());
            }
        }
    }

    private void updateOperatorNameForCellIdentity(CellIdentity cellIdentity) {
        if (cellIdentity == null) {
            return;
        }
        cellIdentity.setOperatorAlphaLong(
                filterOperatorNameByPattern((String) cellIdentity.getOperatorAlphaLong()));
        cellIdentity.setOperatorAlphaShort(
                filterOperatorNameByPattern((String) cellIdentity.getOperatorAlphaShort()));
    }

    private void updateOperatorNameForCellInfo(List<CellInfo> cellInfos) {
        if (cellInfos == null || cellInfos.isEmpty()) {
            return;
        }
        for (int i = 0; i < cellInfos.size(); i++) {
            updateOperatorNameForCellIdentity(cellInfos.get(i).getCellIdentity());
        }
    }

    private String filterOperatorNameByPattern(String operatorName) {
        if (mOperatorNameStringPattern == null || TextUtils.isEmpty(operatorName)) {
            return operatorName;
        }
        Matcher matcher = mOperatorNameStringPattern.matcher(operatorName);
        if (matcher.find()) {
            if (matcher.groupCount() > 0) {
                operatorName = matcher.group(1);
            } else {
                log("filterOperatorNameByPattern: pattern no group");
            }
        }
        return operatorName;
    }
}
+2 −13
Original line number Diff line number Diff line
@@ -1550,27 +1550,16 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    /**
     * Set display name by simInfo index
     * @param displayName the display name of SIM card
     * @param subId the unique SubInfoRecord index in database
     * @return the number of records updated
     */
    @Override
    public int setDisplayName(String displayName, int subId) {
        return setDisplayNameUsingSrc(displayName, subId, -1);
    }

    /**
     * Set display name by simInfo index with name source
     * @param displayName the display name of SIM card
     * @param subId the unique SubInfoRecord index in database
     * @param nameSource 0: NAME_SOURCE_DEFAULT_SOURCE, 1: NAME_SOURCE_SIM_SOURCE,
     *                   2: NAME_SOURCE_USER_INPUT, -1 NAME_SOURCE_UNDEFINED
     *                   2: NAME_SOURCE_USER_INPUT
     * @return the number of records updated
     */
    @Override
    public int setDisplayNameUsingSrc(String displayName, int subId, long nameSource) {
    public int setDisplayNameUsingSrc(String displayName, int subId, int nameSource) {
        if (DBG) {
            logd("[setDisplayName]+  displayName:" + displayName + " subId:" + subId
                + " nameSource:" + nameSource);
Loading