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

Commit af71f44d authored by Jordan Liu's avatar Jordan Liu Committed by Gerrit Code Review
Browse files

Merge "Do not filter by UiccSlot.isEuicc"

parents 53da6fd6 491ce647
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));