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

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

Merge "Fixed incorrect profile shown on Settings" into udc-dev

parents 5487f903 1ff1d1fa
Loading
Loading
Loading
Loading
+106 −103
Original line number Diff line number Diff line
@@ -1246,7 +1246,7 @@ public class SubscriptionManagerService extends ISub.Stub {
                + TelephonyManager.simStateToString(simState));
        for (UiccSlot slot : mUiccController.getUiccSlots()) {
            if (slot != null) {
                log("  " + slot.toString());
                log("  " + slot);
            }
        }

@@ -1266,6 +1266,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.");
@@ -1276,19 +1277,19 @@ 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.getPrintableId(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) {
@@ -1357,7 +1358,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);
                    }
@@ -1397,6 +1399,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
@@ -2173,4 +2173,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();
    }
}