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

Commit cda186c3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix CDNR same as legacy"

parents 572a69c7 8fa4429f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -584,8 +584,8 @@ public class ServiceStateTracker extends Handler {
            }

            if (intent.getAction().equals(Intent.ACTION_LOCALE_CHANGED)) {
                // update emergency string whenever locale changed
                updateSpnDisplay();
                // Update emergency string or operator name, polling service state.
                pollState();
            } else if (intent.getAction().equals(ACTION_RADIO_OFF)) {
                mAlarmSwitch = false;
                powerOffRadioSafely();
+4 −3
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony.cdnr;

import com.android.internal.telephony.uicc.IccRecords;

import java.util.Arrays;
import java.util.List;

@@ -35,9 +37,8 @@ public final class BrandOverrideEfData implements EfData {
    }

    @Override
    public int getServiceProviderNameDisplayCondition() {
        // No SPN in roaming network, no PLMN in home network
        return 0;
    public int getServiceProviderNameDisplayCondition(boolean isRoaming) {
        return IccRecords.CARRIER_NAME_DISPLAY_CONDITION_BITMASK_SPN;
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public final class CarrierConfigEfData implements EfData {
    }

    @Override
    public int getServiceProviderNameDisplayCondition() {
    public int getServiceProviderNameDisplayCondition(boolean isRoaming) {
        int condition = mConfig.getInt(
                CarrierConfigManager.KEY_SPN_DISPLAY_CONDITION_OVERRIDE_INT,
                IccRecords.INVALID_CARRIER_NAME_DISPLAY_CONDITION_BITMASK);
+28 −22
Original line number Diff line number Diff line
@@ -197,7 +197,8 @@ public class CarrierDisplayNameResolver {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < mEf.size(); i++) {
            EfData p = mEf.valueAt(i);
            sb.append("{spnDisplayCondition = " + p.getServiceProviderNameDisplayCondition()
            sb.append("{spnDisplayCondition = "
                    + p.getServiceProviderNameDisplayCondition(isRoaming())
                    + ", spn = " + p.getServiceProviderName()
                    + ", spdiList = " + p.getServiceProviderDisplayInformation()
                    + ", pnnList = " + p.getPlmnNetworkNameList()
@@ -236,11 +237,12 @@ public class CarrierDisplayNameResolver {

    @NonNull
    private CarrierDisplayNameConditionRule getDisplayRule() {
        boolean isRoaming = isRoaming();
        for (int i = 0; i < mEf.size(); i++) {
            if (mEf.valueAt(i).getServiceProviderNameDisplayCondition()
            if (mEf.valueAt(i).getServiceProviderNameDisplayCondition(isRoaming)
                    != IccRecords.INVALID_CARRIER_NAME_DISPLAY_CONDITION_BITMASK) {
                return new CarrierDisplayNameConditionRule(
                        mEf.valueAt(i).getServiceProviderNameDisplayCondition());
                        mEf.valueAt(i).getServiceProviderNameDisplayCondition(isRoaming));
            }
        }
        return DEFAULT_CARRIER_DISPLAY_NAME_RULE;
@@ -286,19 +288,21 @@ public class CarrierDisplayNameResolver {
        return Collections.EMPTY_LIST;
    }

    private boolean isRoaming() {
        // Currently use the roaming state from ServiceState.
        // EF_SPDI is only used when determine the service provider name and PLMN network name
        // display condition rule.
        // All the PLMNs will be considered HOME PLMNs if there is a brand override.
        return getServiceState().getRoaming()
                && !getEfSpdi().contains(getServiceState().getOperatorNumeric());
    }

    private CarrierDisplayNameData getCarrierDisplayNameFromEf() {
        CarrierDisplayNameConditionRule displayRule = getDisplayRule();

        String registeredPlmnName = getServiceState().getOperatorAlpha();
        String registeredPlmnNumeric = getServiceState().getOperatorNumeric();
        List<String> efSpdi = getEfSpdi();

        // Currently use the roaming state from ServiceState.
        // EF_SPDI is only used when determine the service provider name and PLMN network name
        // display condition rule.
        // All the PLMNs will be considered HOME PLMNs if there is a brand override.
        boolean isRoaming = getServiceState().getRoaming()
                && !efSpdi.contains(registeredPlmnNumeric);
        String spn = getEfSpn();

        // Resolve the PLMN network name
@@ -306,7 +310,7 @@ public class CarrierDisplayNameResolver {
        List<PlmnNetworkName> efPnn = getEfPnn();

        String plmn = null;
        if (isRoaming) {
        if (isRoaming()) {
            plmn = registeredPlmnName;
        } else {
            if (efOpl.isEmpty()) {
@@ -320,14 +324,16 @@ public class CarrierDisplayNameResolver {
            }
        }

        // If no PLMN override is present, then the PLMN should be displayed numerically.
        // If no PLMN override is present, then the PLMN should be displayed:
        // - operator alpha if it's not empty.
        // - operator numeric.
        if (TextUtils.isEmpty(plmn)) {
            plmn = TextUtils.isEmpty(registeredPlmnName) ? registeredPlmnNumeric
                    : registeredPlmnName;
        }

        boolean showSpn = displayRule.shouldShowSpn(isRoaming, spn);
        boolean showPlmn = TextUtils.isEmpty(spn) || displayRule.shouldShowPlmn(isRoaming, plmn);
        boolean showSpn = displayRule.shouldShowSpn(spn);
        boolean showPlmn = TextUtils.isEmpty(spn) || displayRule.shouldShowPlmn(plmn);

        return new CarrierDisplayNameData.Builder()
                .setSpn(spn)
@@ -479,22 +485,22 @@ public class CarrierDisplayNameResolver {
            mDisplayConditionBitmask = carrierDisplayConditionBitmask;
        }

        boolean shouldShowSpn(boolean isRoaming, String spn) {
            //Check if show SPN is required when roaming.
            Boolean showSpnInRoaming = ((mDisplayConditionBitmask
        boolean shouldShowSpn(String spn) {
            //Check if show SPN is required.
            Boolean showSpn = ((mDisplayConditionBitmask
                    & IccRecords.CARRIER_NAME_DISPLAY_CONDITION_BITMASK_SPN)
                    == IccRecords.CARRIER_NAME_DISPLAY_CONDITION_BITMASK_SPN);

            return !TextUtils.isEmpty(spn) && (!isRoaming || showSpnInRoaming);
            return !TextUtils.isEmpty(spn) && showSpn;
        }

        boolean shouldShowPlmn(boolean isRoaming, String plmn) {
            // Check if show PLMN is required when not roaming.
            Boolean showPlmnInNotRoaming = ((mDisplayConditionBitmask
        boolean shouldShowPlmn(String plmn) {
            // Check if show PLMN is required.
            Boolean showPlmn = ((mDisplayConditionBitmask
                    & IccRecords.CARRIER_NAME_DISPLAY_CONDITION_BITMASK_PLMN)
                    == IccRecords.CARRIER_NAME_DISPLAY_CONDITION_BITMASK_PLMN);

            return !TextUtils.isEmpty(plmn) && (isRoaming || showPlmnInNotRoaming);
            return !TextUtils.isEmpty(plmn) && showPlmn;
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public interface EfData {
     * .IccRecords.INVALID_CARRIER_NAME_DISPLAY_CONDITION_BITMASK} if it's not existed.
     */
    @CarrierNameDisplayConditionBitmask
    default int getServiceProviderNameDisplayCondition() {
    default int getServiceProviderNameDisplayCondition(boolean isRoaming) {
        return IccRecords.INVALID_CARRIER_NAME_DISPLAY_CONDITION_BITMASK;
    }

Loading