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

Commit d6850d12 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed incorrect profile shown on Settings" into main am: a7277582

parents f7cbb7d8 a7277582
Loading
Loading
Loading
Loading
+105 −101
Original line number Diff line number Diff line
@@ -1242,6 +1242,7 @@ public class SubscriptionManagerService extends ISub.Stub {
            // Check if this is the final state. Only update the subscription if NOT_READY is a
            // final state.
            IccCard iccCard = PhoneFactory.getPhone(phoneId).getIccCard();
            if (iccCard.isEmptyProfile()) log("updateSubscription: iccCard has empty profile.");
            if (!iccCard.isEmptyProfile() && areUiccAppsEnabledOnCard(phoneId)) {
                log("updateSubscription: SIM_STATE_NOT_READY is not a final state. Will update "
                        + "subscription later.");
@@ -1252,19 +1253,20 @@ public class SubscriptionManagerService extends ISub.Stub {
                logl("updateSubscription: UICC app disabled on slot " + phoneId);
                markSubscriptionsInactive(phoneId);
            }
        }
        } else {

            String iccId = getIccId(phoneId);
            log("updateSubscription: Found iccId=" + SubscriptionInfo.givePrintableIccid(iccId)
                    + " on phone " + phoneId);

            // For eSIM switching, SIM absent will not happen. Below is to exam if we find ICCID
        // mismatch on the SIM slot. If that's the case, we need to mark all subscriptions on that
        // logical slot invalid first. The correct subscription will be assigned the correct slot
        // later.
            // mismatch on the SIM slot. If that's the case, we need to mark all subscriptions on
            // that logical slot invalid first. The correct subscription will be assigned the
            // correct slot later.
            SubscriptionInfoInternal subInfo = mSubscriptionDatabaseManager.getAllSubscriptions()
                    .stream()
                .filter(sub -> sub.getSimSlotIndex() == phoneId && !iccId.equals(sub.getIccId()))
                    .filter(sub -> sub.getSimSlotIndex() == phoneId && !iccId.equals(
                            sub.getIccId()))
                    .findFirst()
                    .orElse(null);
            if (subInfo != null) {
@@ -1333,7 +1335,8 @@ public class SubscriptionManagerService extends ISub.Stub {
                        setDisplayNumber(msisdn, subId);
                    }

                String imsi = mTelephonyManager.createForSubscriptionId(subId).getSubscriberId();
                    String imsi = mTelephonyManager.createForSubscriptionId(
                            subId).getSubscriberId();
                    if (imsi != null) {
                        mSubscriptionDatabaseManager.setImsi(subId, imsi);
                    }
@@ -1373,6 +1376,7 @@ public class SubscriptionManagerService extends ISub.Stub {
                mSlotIndexToSubId.remove(phoneId);
                logl("updateSubscription: current mapping " + slotMappingToString());
            }
        }

        if (areAllSubscriptionsLoaded()) {
            log("Notify all subscriptions loaded.");
+10 −0
Original line number Diff line number Diff line
@@ -2182,4 +2182,14 @@ public class SubscriptionManagerServiceTest extends TelephonyTest {
        map.clear();
        assertThat(map).hasSize(0);
    }

    @Test
    public void testSimNotReady() {
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE);
        mSubscriptionManagerServiceUT.updateSimState(
                0, TelephonyManager.SIM_STATE_NOT_READY, null, null);
        processAllMessages();

        assertThat(mSubscriptionManagerServiceUT.getActiveSubIdList(false)).isEmpty();
    }
}