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

Commit 9a1c5901 authored by Devci Telephony's avatar Devci Telephony Committed by Gerrit - the friendly Code Review server
Browse files

Merge "MSIM: Fix to update display name in subinfo record" into atel.lnx.2.0-dev

parents ce6117e5 936b18f3
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -1478,6 +1478,31 @@ public class SIMRecords extends IccRecords {
        } else {
            setSpnFromConfig(getOperatorNumeric());
        }
        setDisplayName();
    }

    private void setDisplayName() {
        SubscriptionManager subManager = SubscriptionManager.from(mContext);
        int[] subId = subManager.getSubId(mParentApp.getPhoneId());

        if ((subId == null) || subId.length <= 0) {
            log("subId not valid for Phone " + mParentApp.getPhoneId());
            return;
        }

        SubscriptionInfo subInfo = subManager.getActiveSubscriptionInfo(subId[0]);
        if (subInfo != null && subInfo.getNameSource() !=
                    SubscriptionManager.NAME_SOURCE_USER_INPUT) {
            CharSequence oldSubName = subInfo.getDisplayName();
            String newCarrierName = mTelephonyManager.getSimOperatorName(subId[0]);

            if (!TextUtils.isEmpty(newCarrierName) && !newCarrierName.equals(oldSubName)) {
                log("sim name[" + mParentApp.getPhoneId() + "] = " + newCarrierName);
                SubscriptionController.getInstance().setDisplayName(newCarrierName, subId[0]);
            }
        } else {
            log("SUB[" + mParentApp.getPhoneId() + "] " + subId[0] + " SubInfo not created yet");
        }
    }

    private void setSpnFromConfig(String carrier) {