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

Commit 20270f21 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by android-build-merger
Browse files

Merge "Use carrier display name from carrerId as backup."

am: afc161ee

Change-Id: I054d29d6eeec9da7417bd6195a9d8bd2128b52e8
parents 8ae31c80 afc161ee
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();
        }