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

Commit 05024a2d authored by Jordan Liu's avatar Jordan Liu
Browse files

Do not filter by UiccSlot.isEuicc

This value is not guarenteed to be correct on old HALs.

Also, convert the slotId into a cardId in the EVENT_SIM_NOT_READY
handler case.

Bug: 124328566
Test: manual
Change-Id: I68c4769eb7e31b120c75f60e68961dfb1255fee6
parent d4ddbe3d
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.internal.telephony.euicc.EuiccController;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UiccSlot;

@@ -260,7 +261,13 @@ public class SubscriptionInfoUpdater extends Handler {

            case EVENT_SIM_NOT_READY:
                handleSimNotReady(msg.arg1);
                // intentional fall through
                int cardId = getCardIdFromPhoneId(msg.arg1);
                // an eUICC with no active subscriptions never becomes ready, so we need to trigger
                // the embedded subscriptions update here
                if (updateEmbeddedSubscriptions(cardId)) {
                    SubscriptionController.getInstance().notifySubscriptionInfoChanged();
                }
                break;

            case EVENT_REFRESH_EMBEDDED_SUBSCRIPTIONS:
                if (updateEmbeddedSubscriptions(msg.arg1)) {
@@ -276,6 +283,15 @@ public class SubscriptionInfoUpdater extends Handler {
        }
    }

    private int getCardIdFromPhoneId(int phoneId) {
        UiccController uiccController = UiccController.getInstance();
        UiccCard card = uiccController.getUiccCardForPhone(phoneId);
        if (card != null) {
            return uiccController.convertToPublicCardId(card.getCardId());
        }
        return TelephonyManager.UNINITIALIZED_CARD_ID;
    }

    void requestEmbeddedSubscriptionInfoListRefresh(int cardId, @Nullable Runnable callback) {
        sendMessage(obtainMessage(
                EVENT_REFRESH_EMBEDDED_SUBSCRIPTIONS, cardId, 0 /* arg2 */, callback));
@@ -580,7 +596,7 @@ public class SubscriptionInfoUpdater extends Handler {
            UiccSlot[] uiccSlots = uiccController.getUiccSlots();
            if (uiccSlots != null) {
                Arrays.stream(uiccSlots)
                        .filter(uiccSlot -> uiccSlot.isEuicc() && uiccSlot.getUiccCard() != null)
                        .filter(uiccSlot -> uiccSlot.getUiccCard() != null)
                        .map(uiccSlot -> uiccController.convertToPublicCardId(
                                uiccSlot.getUiccCard().getCardId()))
                        .forEach(cardId -> updateEmbeddedSubscriptions(cardId));