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

Commit 7cc0fec6 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Use carrier display name from carrerId as backup.

Test: manually by hacking the code
Bug: 130225369
Change-Id: I3bce4ae0440bd34d6ecf673fbe687a3bb7564fb6
parent b5b81e57
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -338,16 +338,28 @@ public class UiccProfile extends IccCard {
        boolean preferCcName = config.getBoolean(
                CarrierConfigManager.KEY_CARRIER_NAME_OVERRIDE_BOOL, false);
        String ccName = config.getString(CarrierConfigManager.KEY_CARRIER_NAME_STRING);

        String newCarrierName = null;
        String currSpn = getServiceProviderName();
        // If carrier config is priority, use it regardless - the preference
        // and the name were both set by the carrier, so this is safe;
        // otherwise, if the SPN is priority but we don't have one *and* we have
        // a name in carrier config, use the carrier config name as a backup.
        if (preferCcName || (TextUtils.isEmpty(getServiceProviderName())
                && !TextUtils.isEmpty(ccName))) {
        if (preferCcName || (TextUtils.isEmpty(currSpn) && !TextUtils.isEmpty(ccName))) {
            newCarrierName = ccName;
        } else if (TextUtils.isEmpty(currSpn)) {
            // currSpn is empty and could not get name from carrier config; get name from carrier id
            Phone phone = PhoneFactory.getPhone(mPhoneId);
            if (phone != null) {
                newCarrierName = phone.getCarrierName();
            }
        }

        if (!TextUtils.isEmpty(newCarrierName)) {
            if (mIccRecords != null) {
                mIccRecords.setServiceProviderName(ccName);
                mIccRecords.setServiceProviderName(newCarrierName);
            }
            mTelephonyManager.setSimOperatorNameForPhone(mPhoneId, ccName);
            mTelephonyManager.setSimOperatorNameForPhone(mPhoneId, newCarrierName);
            mOperatorBrandOverrideRegistrants.notifyRegistrants();
        }