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

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

Merge "CDNR use ef_pnn as wfc carrier name if spn is null."

parents 87a70c96 c98d2636
Loading
Loading
Loading
Loading
+32 −15
Original line number Diff line number Diff line
@@ -288,6 +288,7 @@ public class CarrierDisplayNameResolver {
    private CarrierDisplayNameData getCarrierDisplayNameFromEf() {
        CarrierDisplayNameConditionRule displayRule = getDisplayRule();

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

@@ -297,8 +298,6 @@ public class CarrierDisplayNameResolver {
        // All the PLMNs will be considered HOME PLMNs if there is a brand override.
        boolean isRoaming = getServiceState().getRoaming()
                && !efSpdi.contains(registeredPlmnNumeric);
        boolean showSpn = displayRule.shouldShowSpn(isRoaming);
        boolean showPlmn = displayRule.shouldShowPnn(isRoaming);
        String spn = getEfSpn();

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

        String plmn = null;
        if (isRoaming) {
            plmn = registeredPlmnName;
        } else {
            if (efOpl.isEmpty()) {
                // If the EF_OPL is not present, then the first record in EF_PNN is used for the
            // default network name when registered in the HPLMN or an EHPLMN(if the EHPLMN list
            // is present).
                // default network name when registered in the HPLMN or an EHPLMN(if the EHPLMN
                // list is present).
                plmn = efPnn.isEmpty() ? "" : getPlmnNetworkName(efPnn.get(0));
            } else {
                // TODO: Check the TAC/LAC & registered PLMN numeric in OPL list to determine which
                // PLMN name should be used to override the current one.
            }
        }

        // If no PLMN override is present, then the PLMN should be displayed numerically.
        if (TextUtils.isEmpty(plmn)) {
            plmn = registeredPlmnNumeric;
            plmn = TextUtils.isEmpty(registeredPlmnName) ? registeredPlmnNumeric
                    : registeredPlmnName;
        }

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

        return new CarrierDisplayNameData.Builder()
                .setSpn(spn)
                .setShowSpn(showSpn)
@@ -342,7 +349,11 @@ public class CarrierDisplayNameResolver {
        // Override the spn, data spn, plmn by wifi-calling
        String wfcSpn = wfcFormatter.formatVoiceName(rawCarrierDisplayNameData.getSpn());
        String wfcDataSpn = wfcFormatter.formatDataName(rawCarrierDisplayNameData.getSpn());
        String wfcPlmn = wfcFormatter.formatVoiceName(rawCarrierDisplayNameData.getPlmn());
        List<PlmnNetworkName> efPnn = getEfPnn();
        String plmn = efPnn.isEmpty() ? "" : getPlmnNetworkName(efPnn.get(0));
        String wfcPlmn = wfcFormatter.formatVoiceName(
                TextUtils.isEmpty(plmn) ? rawCarrierDisplayNameData.getPlmn() : plmn);

        CarrierDisplayNameData result = rawCarrierDisplayNameData;
        if (!TextUtils.isEmpty(wfcSpn) && !TextUtils.isEmpty(wfcDataSpn)) {
            result = new CarrierDisplayNameData.Builder()
@@ -452,16 +463,22 @@ public class CarrierDisplayNameResolver {
            mDisplayConditionBitmask = carrierDisplayConditionBitmask;
        }

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

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

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

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

        @Override