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

Commit 5a200964 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5511022 from 6b954496 to qt-release

Change-Id: I5e702cc9760d18541f4fdb383299594242b9b40b
parents 475b5796 6b954496
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -2087,7 +2087,8 @@ public class GsmCdmaPhone extends Phone {
    @Override
    public void getAvailableNetworks(Message response) {
        if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) {
            mCi.getAvailableNetworks(response);
            Message msg = obtainMessage(EVENT_GET_AVAILABLE_NETWORKS_DONE, response);
            mCi.getAvailableNetworks(msg);
        } else {
            loge("getAvailableNetworks: not possible in CDMA");
        }
@@ -2747,6 +2748,34 @@ public class GsmCdmaPhone extends Phone {
            case EVENT_DEVICE_PROVISIONING_DATA_SETTING_CHANGE:
                mDataEnabledSettings.updateProvisioningDataEnabled();
                break;
            case EVENT_GET_AVAILABLE_NETWORKS_DONE:
                ar = (AsyncResult) msg.obj;
                if (ar.exception == null && ar.result != null && mSST != null) {
                    List<OperatorInfo> operatorInfoList = (List<OperatorInfo>) ar.result;
                    List<OperatorInfo> filteredInfoList = new ArrayList<>();
                    for (OperatorInfo operatorInfo : operatorInfoList) {
                        if (OperatorInfo.State.CURRENT == operatorInfo.getState()) {
                            filteredInfoList.add(new OperatorInfo(
                                    mSST.filterOperatorNameByPattern(
                                            operatorInfo.getOperatorAlphaLong()),
                                    mSST.filterOperatorNameByPattern(
                                            operatorInfo.getOperatorAlphaShort()),
                                    operatorInfo.getOperatorNumeric(),
                                    operatorInfo.getState()
                            ));
                        } else {
                            filteredInfoList.add(operatorInfo);
                        }
                    }
                    ar.result = filteredInfoList;
                }

                onComplete = (Message) ar.userObj;
                if (onComplete != null) {
                    AsyncResult.forMessage(onComplete, ar.result, ar.exception);
                    onComplete.sendToTarget();
                }
                break;
            default:
                super.handleMessage(msg);
        }
+5 −0
Original line number Diff line number Diff line
@@ -300,6 +300,11 @@ public class MultiSimSettingController {

    private void disableDataForNonDefaultNonOpportunisticSubscriptions() {
        int defaultDataSub = mSubController.getDefaultDataSubId();
        // Only disable data for non-default subscription if default sub is active.
        if (!mSubController.isActiveSubId(defaultDataSub)) {
            log("default data sub is inactive, skip disabling data for non-default subs");
            return;
        }

        for (Phone phone : mPhones) {
            if (phone.getSubId() != defaultDataSub
+13 −9
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import static android.telephony.AccessNetworkConstants.AccessNetworkType.UTRAN;
import android.content.Context;
import android.hardware.radio.V1_0.RadioError;
import android.os.AsyncResult;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -243,15 +242,15 @@ public final class NetworkScanRequestTracker {
        private boolean mIsBinderDead;

        NetworkScanRequestInfo(NetworkScanRequest r, Messenger m, IBinder b, int id, Phone phone,
                String callingPackage) {
                int callingUid, int callingPid, String callingPackage) {
            super();
            mRequest = r;
            mMessenger = m;
            mBinder = b;
            mScanId = id;
            mPhone = phone;
            mUid = Binder.getCallingUid();
            mPid = Binder.getCallingPid();
            mUid = callingUid;
            mPid = callingPid;
            mCallingPackage = callingPackage;
            mIsBinderDead = false;

@@ -437,6 +436,11 @@ public final class NetworkScanRequestTracker {
                        ? TelephonyScanManager.CALLBACK_SCAN_RESULTS
                        : TelephonyScanManager.CALLBACK_RESTRICTED_SCAN_RESULTS;
                if (nsr.scanError == NetworkScan.SUCCESS) {
                    if (nsri.mPhone.getServiceStateTracker() != null) {
                        nsri.mPhone.getServiceStateTracker().updateOperatorNameForCellInfo(
                                nsr.networkInfos);
                    }

                    notifyMessenger(nsri, notifyMsg,
                            rilErrorToScanError(nsr.scanError), nsr.networkInfos);
                    if (nsr.scanStatus == NetworkScanResult.SCAN_STATUS_COMPLETE) {
@@ -597,11 +601,11 @@ public final class NetworkScanRequestTracker {
     */
    public int startNetworkScan(
            NetworkScanRequest request, Messenger messenger, IBinder binder, Phone phone,
            String callingPackage) {
            int callingUid, int callingPid, String callingPackage) {
        int scanId = mNextNetworkScanRequestId.getAndIncrement();
        NetworkScanRequestInfo nsri =
                new NetworkScanRequestInfo(request, messenger, binder, scanId, phone,
                        callingPackage);
                        callingUid, callingPid, callingPackage);
        // nsri will be stored as Message.obj
        mHandler.obtainMessage(CMD_START_NETWORK_SCAN, nsri).sendToTarget();
        return scanId;
@@ -613,14 +617,14 @@ public final class NetworkScanRequestTracker {
     * The ongoing scan will be stopped only when the input scanId and caller's uid matches the
     * corresponding information associated with it.
     */
    public void stopNetworkScan(int scanId) {
    public void stopNetworkScan(int scanId, int callingUid) {
        synchronized (mScheduler) {
            if ((mScheduler.mLiveRequestInfo != null
                    && scanId == mScheduler.mLiveRequestInfo.mScanId
                    && Binder.getCallingUid() == mScheduler.mLiveRequestInfo.mUid)
                    && callingUid == mScheduler.mLiveRequestInfo.mUid)
                    || (mScheduler.mPendingRequestInfo != null
                    && scanId == mScheduler.mPendingRequestInfo.mScanId
                    && Binder.getCallingUid() == mScheduler.mPendingRequestInfo.mUid)) {
                    && callingUid == mScheduler.mPendingRequestInfo.mUid)) {
                // scanId will be stored at Message.arg1
                mHandler.obtainMessage(CMD_STOP_NETWORK_SCAN, scanId, 0).sendToTarget();
            } else {
+4 −2
Original line number Diff line number Diff line
@@ -179,7 +179,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected static final int EVENT_GET_CALL_FORWARD_DONE       = 13;
    protected static final int EVENT_CALL_RING                   = 14;
    private static final int EVENT_CALL_RING_CONTINUE            = 15;
    private static final int EVENT_ALL_DATA_DISCONNECTED         = 16;

    // Used to intercept the carrier selection calls so that
    // we can save the values.
@@ -223,8 +222,11 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected static final int EVENT_SET_CARRIER_DATA_ENABLED       = 48;
    protected static final int EVENT_DEVICE_PROVISIONED_CHANGE      = 49;
    protected static final int EVENT_DEVICE_PROVISIONING_DATA_SETTING_CHANGE = 50;
    protected static final int EVENT_GET_AVAILABLE_NETWORKS_DONE    = 51;

    protected static final int EVENT_LAST = EVENT_DEVICE_PROVISIONING_DATA_SETTING_CHANGE;
    private static final int EVENT_ALL_DATA_DISCONNECTED         = 52;

    protected static final int EVENT_LAST = EVENT_ALL_DATA_DISCONNECTED;

    // For shared prefs.
    private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_";
+30 −10
Original line number Diff line number Diff line
@@ -3510,7 +3510,7 @@ public class ServiceStateTracker extends Handler {
                isRoaming = ss.getRoaming();
            } else {
                String[] hplmns = mIccRecords != null ? mIccRecords.getHomePlmns() : null;
                isRoaming = ArrayUtils.contains(hplmns, ss.getOperatorNumeric());
                isRoaming = !ArrayUtils.contains(hplmns, ss.getOperatorNumeric());
            }
            int rule;
            if (isRoaming) {
@@ -4589,11 +4589,7 @@ 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);
            }
            updateOperatorNamePattern(config);
        }

        // Sometimes the network registration information comes before carrier config is ready.
@@ -5319,6 +5315,17 @@ public class ServiceStateTracker extends Handler {
        return mEriManager.getCdmaEriText(roamInd, defRoamInd);
    }

    private void updateOperatorNamePattern(PersistableBundle config) {
        String operatorNamePattern = config.getString(
                CarrierConfigManager.KEY_OPERATOR_NAME_FILTER_PATTERN_STRING);
        if (!TextUtils.isEmpty(operatorNamePattern)) {
            mOperatorNameStringPattern = Pattern.compile(operatorNamePattern);
            if (DBG) {
                log("mOperatorNameStringPattern: " + mOperatorNameStringPattern.toString());
            }
        }
    }

    private void updateOperatorNameForServiceState(ServiceState servicestate) {
        if (servicestate == null) {
            return;
@@ -5350,16 +5357,29 @@ public class ServiceStateTracker extends Handler {
                filterOperatorNameByPattern((String) cellIdentity.getOperatorAlphaShort()));
    }

    private void updateOperatorNameForCellInfo(List<CellInfo> cellInfos) {
    /**
     * To modify the operator name of CellInfo by pattern.
     *
     * @param cellInfos List of CellInfo{@link CellInfo}.
     */
    public void updateOperatorNameForCellInfo(List<CellInfo> cellInfos) {
        if (cellInfos == null || cellInfos.isEmpty()) {
            return;
        }
        for (int i = 0; i < cellInfos.size(); i++) {
            updateOperatorNameForCellIdentity(cellInfos.get(i).getCellIdentity());
        for (CellInfo cellInfo : cellInfos) {
            if (cellInfo.isRegistered()) {
                updateOperatorNameForCellIdentity(cellInfo.getCellIdentity());
            }
        }
    }

    private String filterOperatorNameByPattern(String operatorName) {
    /**
     * To modify the operator name by pattern.
     *
     * @param operatorName Registered operator name
     * @return An operator name.
     */
    public String filterOperatorNameByPattern(String operatorName) {
        if (mOperatorNameStringPattern == null || TextUtils.isEmpty(operatorName)) {
            return operatorName;
        }
Loading