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

Commit e65593f1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use carrier display name from carrerId as backup." into qt-dev

parents 3f7c5d57 7cc0fec6
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();
        }