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

Commit 93a999c0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Avoid ArrayIndexOutOfBoundsException thrown because of unexpected slot"

parents c70a3bb9 596794bc
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -830,7 +830,17 @@ public class UiccController extends Handler {
        boolean isDefaultEuiccCardIdSet = false;
        boolean anyEuiccIsActive = false;
        mHasActiveBuiltInEuicc = false;
        for (int i = 0; i < status.size(); i++) {

        int numSlots = status.size();
        if (mUiccSlots.length < numSlots) {
            String logStr = "The number of the physical slots reported " + numSlots
                    + " is greater than the expectation " + mUiccSlots.length + ".";
            Rlog.e(LOG_TAG, logStr);
            sLocalLog.log(logStr);
            numSlots = mUiccSlots.length;
        }

        for (int i = 0; i < numSlots; i++) {
            IccSlotStatus iss = status.get(i);
            boolean isActive = (iss.slotState == IccSlotStatus.SlotState.SLOTSTATE_ACTIVE);
            if (isActive) {
@@ -895,7 +905,7 @@ public class UiccController extends Handler {
            // Note that on HAL<1.2, it's possible that a built-in eUICC exists, but does not
            // correspond to any slot in mUiccSlots. This logic is still safe in that case because
            // SlotStatus is only for HAL >= 1.2
            for (int i = 0; i < status.size(); i++) {
            for (int i = 0; i < numSlots; i++) {
                if (mUiccSlots[i].isEuicc()) {
                    String eid = status.get(i).eid;
                    if (!TextUtils.isEmpty(eid)) {