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

Commit 11e89fa2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ignore MCC/MNC from RIL operator indication for locale" into main

parents cd5be376 d80717a8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -110,3 +110,14 @@ flag {
  description: "guard system API onCellularIdentifierDisclosedChanged"
  bug: "355062720"
}

# OWNER=jackyu TARGET=25Q3
flag {
    name: "ignore_mcc_mnc_from_operator_for_locale"
    namespace: "telephony"
    description: "Ignoring mcc/mnc from RIL indication OPERATOR but only relying MCC/MNC from registered or nearby cells."
    bug:"374589521"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+24 −17
Original line number Diff line number Diff line
@@ -360,6 +360,9 @@ public class ServiceStateTracker extends Handler {
    private Pattern mOperatorNameStringPattern;
    private PersistableBundle mCarrierConfig;

    @NonNull
    private final FeatureFlags mFeatureFlags;

    private class SstSubscriptionsChangedListener extends OnSubscriptionsChangedListener {

        /**
@@ -705,6 +708,7 @@ public class ServiceStateTracker extends Handler {
                .makeNitzStateMachine(phone);
        mPhone = phone;
        mCi = ci;
        mFeatureFlags = featureFlags;

        mServiceStateStats = new ServiceStateStats(mPhone);

@@ -3867,24 +3871,27 @@ public class ServiceStateTracker extends Handler {

            tm.setNetworkOperatorNumericForPhone(mPhone.getPhoneId(), operatorNumeric);

            // If the OPERATOR command hasn't returned a valid operator or the device is on IWLAN (
            // because operatorNumeric would be SIM's mcc/mnc when device is on IWLAN), but if the
            // device has camped on a cell either to attempt registration or for emergency services,
            // then for purposes of setting the locale, we don't care if registration fails or is
            // incomplete. Additionally, if there is no cellular service and ims is registered over
            // the IWLAN, the locale will not be updated.
            String localeOperator = null;
            if (!mFeatureFlags.ignoreMccMncFromOperatorForLocale()) {
                // If the OPERATOR command hasn't returned a valid operator or the device is on
                // IWLAN (because operatorNumeric would be SIM's mcc/mnc when device is on IWLAN),
                // but if the device has camped on a cell either to attempt registration or for
                // emergency services, then for purposes of setting the locale, we don't care if
                // registration fails or is incomplete. Additionally, if there is no cellular
                // service and ims is registered over the IWLAN, the locale will not be updated.
                // CellIdentity can return a null MCC and MNC in CDMA
            String localeOperator = operatorNumeric;
                localeOperator = operatorNumeric;
                int dataNetworkType = mSS.getDataNetworkType();
                if (dataNetworkType == TelephonyManager.NETWORK_TYPE_IWLAN
                        || (dataNetworkType == TelephonyManager.NETWORK_TYPE_UNKNOWN
                        && getImsRegistrationTech()
                        == ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)) {
                // TODO(b/333346537#comment10): Complete solution would be ignore mcc/mnc reported
                //  by the unsolicited indication OPERATOR from RIL, but only relies on MCC/MNC from
                //  data registration or voice registration.
                    // TODO(b/333346537#comment10): Complete solution would be ignore mcc/mnc
                    //  reported by the unsolicited indication OPERATOR from RIL, but only relies on
                    //  MCC/MNC from data registration or voice registration.
                    localeOperator = null;
                }
            }
            if (isInvalidOperatorNumeric(localeOperator)) {
                for (CellIdentity cid : prioritizedCids) {
                    if (!TextUtils.isEmpty(cid.getPlmn())) {