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

Commit c98d2636 authored by SongFerngWang's avatar SongFerngWang
Browse files

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

1. CDNR should show "registered PLMN name" in Roaming
2. CDNR use ef_pnn as wfc carrier name if spn is null.
3. UE doesn't display operator name if sim does not have ef_spn at
home network.

Bug: 157108864
Test: 1. UE with TMO sim card to test in Roaming and WFC on, and then
check operator name "T-Mobile Wi-Fi Calling". (PASS)
2. UE with taiwan mobile sim card to test at home network, and then
check operator name "TW Mobile". (PASS)
3. UE with TMO sim card to test in Roaming, and then check operator
name "TW Mobile". (PASS)

Change-Id: I1935b76d20c01e0e8c7f2e1c80139b6bd1693bfc
Merged-In: I1935b76d20c01e0e8c7f2e1c80139b6bd1693bfc
parent 52b7f540
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