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

Commit d726be4d authored by chen xu's avatar chen xu
Browse files

only update carrierid from updated esim profile if there is no valid id

since esim profile metadata doesn't support IMSI, carrier id identified
here might not be accurate for carriers who differentiate themselves
by IMSI prefix. Prioritize carrier id from CarrierResolver and only update if
there is no valid carrier id present.

Bug: 134440411
Test: Manaul test
Change-Id: Ief3a7e42e9a78d9c4e4125efbb9aac15607de4a7
parent e22fb382
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -792,6 +792,7 @@ public class SubscriptionInfoUpdater extends Handler {
        for (EuiccProfileInfo embeddedProfile : embeddedProfiles) {
            int index =
                    findSubscriptionInfoForIccid(existingSubscriptions, embeddedProfile.getIccid());
            int prevCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
            int nameSource = SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE;
            if (index < 0) {
                // No existing entry for this ICCID; create an empty one.
@@ -799,6 +800,7 @@ public class SubscriptionInfoUpdater extends Handler {
                        embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED);
            } else {
                nameSource = existingSubscriptions.get(index).getNameSource();
                prevCarrierId = existingSubscriptions.get(index).getCarrierId();
                existingSubscriptions.remove(index);
            }

@@ -829,8 +831,13 @@ public class SubscriptionInfoUpdater extends Handler {
            values.put(SubscriptionManager.PROFILE_CLASS, embeddedProfile.getProfileClass());
            CarrierIdentifier cid = embeddedProfile.getCarrierIdentifier();
            if (cid != null) {
                // Due to the limited subscription information, carrier id identified here might
                // not be accurate compared with CarrierResolver. Only update carrier id if there
                // is no valid carrier id present.
                if (prevCarrierId == TelephonyManager.UNKNOWN_CARRIER_ID) {
                    values.put(SubscriptionManager.CARRIER_ID,
                            CarrierResolver.getCarrierIdFromIdentifier(mContext, cid));
                }
                String mcc = cid.getMcc();
                String mnc = cid.getMnc();
                values.put(SubscriptionManager.MCC_STRING, mcc);