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

Commit a65a0672 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Gerrit Code Review
Browse files

Merge "Handle default boot profile on eSIM where it's never READY."

parents b5c1b9d7 e52d649b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -275,6 +275,14 @@ public class IccCard {
        return false;
    }

    /**
     * @return whether the card is an empty profile, meaning there's no UiccCardApplication,
     * and that we don't need to wait for LOADED state.
     */
    public boolean isEmptyProfile() {
        return false;
    }

    private void sendMessageWithCardAbsentException(Message onComplete) {
        AsyncResult ret = AsyncResult.forMessage(onComplete);
        ret.exception = new RuntimeException("No valid IccCard");
+21 −9
Original line number Diff line number Diff line
@@ -276,16 +276,8 @@ public class SubscriptionInfoUpdater extends Handler {
                break;

            case EVENT_SIM_NOT_READY:
                broadcastSimStateChanged(msg.arg1, IccCardConstants.INTENT_VALUE_ICC_NOT_READY,
                        null);
                broadcastSimCardStateChanged(msg.arg1, TelephonyManager.SIM_STATE_PRESENT);
                broadcastSimApplicationStateChanged(msg.arg1, TelephonyManager.SIM_STATE_NOT_READY);
                handleSimNotReady(msg.arg1);
                // intentional fall through
                // ICC_NOT_READY is a terminal state for an eSIM on the boot profile. At this
                // phase, the subscription list is accessible.
                // TODO(b/64216093): Clean up this special case, likely by treating NOT_READY
                // as equivalent to ABSENT, once the rest of the system can handle it. Currently
                // this breaks SystemUI which shows a "No SIM" icon.

            case EVENT_REFRESH_EMBEDDED_SUBSCRIPTIONS:
                if (updateEmbeddedSubscriptions()) {
@@ -359,6 +351,26 @@ public class SubscriptionInfoUpdater extends Handler {
        }
    }

    private void handleSimNotReady(int slotId) {
        logd("handleSimNotReady: slotId: " + slotId);

        IccCard iccCard = mPhone[slotId].getIccCard();
        if (iccCard.isEmptyProfile()) {
            // ICC_NOT_READY is a terminal state for an eSIM on the boot profile. At this
            // phase, the subscription list is accessible. Treating NOT_READY
            // as equivalent to ABSENT, once the rest of the system can handle it.
            mIccId[slotId] = ICCID_STRING_FOR_NO_SIM;
            if (isAllIccIdQueryDone()) {
                updateSubscriptionInfoByIccId();
            }
        }

        broadcastSimStateChanged(slotId, IccCardConstants.INTENT_VALUE_ICC_NOT_READY,
                null);
        broadcastSimCardStateChanged(slotId, TelephonyManager.SIM_STATE_PRESENT);
        broadcastSimApplicationStateChanged(slotId, TelephonyManager.SIM_STATE_NOT_READY);
    }

    private void handleSimLoaded(int slotId) {
        logd("handleSimLoaded: slotId: " + slotId);

+10 −0
Original line number Diff line number Diff line
@@ -823,6 +823,16 @@ public class UiccProfile extends IccCard {
        return mUiccApplication != null && mUiccApplication.getIccPuk2Blocked();
    }

    @Override
    public boolean isEmptyProfile() {
        // If there's no UiccCardApplication, it's an empty profile.
        // Empty profile is a valid case of eSIM (default boot profile).
        for (UiccCardApplication app : mUiccApplications) {
            if (app != null) return false;
        }
        return true;
    }

    @Override
    public void setIccLockEnabled(boolean enabled, String password, Message onComplete) {
        synchronized (mLock) {