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

Commit 1742fa2e authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "To avoid the NullPointerException of UiccSlotInfo" into main

parents bd01c839 0ba519f1
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -171,8 +171,11 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> {
        }
        int activePorts = 0;
        for (UiccSlotInfo slotInfo : slotsInfo) {
            if (slotInfo == null) {
                continue;
            }
            for (UiccPortInfo portInfo : slotInfo.getPorts()) {
                if (slotInfo != null && portInfo.isActive()) {
                if (portInfo.isActive()) {
                    activePorts++;
                }
            }
@@ -189,8 +192,11 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> {
        }
        Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>();
        for (UiccSlotInfo info : infos) {
            if (info == null) {
                continue;
            }
            for (UiccPortInfo portInfo : info.getPorts()) {
                if (info != null && portInfo.isActive() && info.isRemovable()) {
                if (portInfo.isActive() && info.isRemovable()) {
                    activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex());
                }
            }
+2 −2
Original line number Diff line number Diff line
@@ -378,11 +378,11 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions
        return mMobileNetworkInfoDao.queryMobileNetworkInfoBySubId(subId);
    }

    private void getUiccInfoBySubscriptionInfo(UiccSlotInfo[] uiccSlotInfos,
    private void getUiccInfoBySubscriptionInfo(@NonNull UiccSlotInfo[] uiccSlotInfos,
            SubscriptionInfo subInfo) {
        for (int i = 0; i < uiccSlotInfos.length; i++) {
            UiccSlotInfo curSlotInfo = uiccSlotInfos[i];
            if (curSlotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT) {
            if (curSlotInfo != null && curSlotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT) {
                final int index = i;
                mIsEuicc = curSlotInfo.getIsEuicc();
                mCardState = curSlotInfo.getCardStateInfo();
+5 −3
Original line number Diff line number Diff line
@@ -301,7 +301,8 @@ public class UiccSlotUtil {
        }
        if (slotId == INVALID_PHYSICAL_SLOT_ID) {
            for (int i = 0; i < slots.length; i++) {
                if (slots[i].isRemovable()
                if (slots[i] != null
                        && slots[i].isRemovable()
                        && !slots[i].getIsEuicc()
                        && !slots[i].getPorts().stream().findFirst().get().isActive()
                        && slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR
@@ -310,8 +311,9 @@ public class UiccSlotUtil {
                }
            }
        } else {
            if (slotId >= slots.length || !slots[slotId].isRemovable()) {
                throw new UiccSlotsException("The given slotId is not a removable slot: " + slotId);
            if (slotId >= slots.length || slots[slotId] == null || !slots[slotId].isRemovable()) {
                Log.d(TAG, "The given slotId is not a removable slot: " + slotId);
                return INVALID_PHYSICAL_SLOT_ID;
            }
            if (!slots[slotId].getPorts().stream().findFirst().get().isActive()) {
                return slotId;