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

Commit f743c43b authored by Jayachandran C's avatar Jayachandran C Committed by Automerger Merge Worker
Browse files

Merge "Initial sim state unknown is not updated during cardstate absent...

Merge "Initial sim state unknown is not updated during cardstate absent event." into udc-dev am: 1a97b19d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/22850201



Change-Id: I7d5031486689befc3f9fd809718a1d30e3a7f0c2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c2607422 1a97b19d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -379,13 +379,15 @@ public class UiccSlot extends Handler {
    }

    private void disposeUiccCardIfNeeded(boolean isStateUnknown, int portIndex) {
        // First dispose UiccPort corresponding to the portIndex
        if (mUiccCard != null) {
            // First dispose UiccPort corresponding to the portIndex
            mUiccCard.disposePort(portIndex);
            if (ArrayUtils.isEmpty(mUiccCard.getUiccPortList())) {
                // No UiccPort objects are found, safe to dispose the card
                nullifyUiccCard(isStateUnknown);
            }
        } else {
            mStateIsUnknown = isStateUnknown;
        }
    }

+18 −0
Original line number Diff line number Diff line
@@ -561,4 +561,22 @@ public class UiccSlotTest extends TelephonyTest {
        assertEquals(IccSlotStatus.MultipleEnabledProfilesMode.MEP_B,
                mUiccSlot.getSupportedMepMode());
    }

    @Test
    @SmallTest
    public void testSimStateUnknown() {
        int phoneId = 0;
        int slotIndex = 0;
        // Initially state is unknown
        assertTrue(mUiccSlot.isStateUnknown());
        mIccCardStatus.mCardState = IccCardStatus.CardState.CARDSTATE_ABSENT;
        mUiccSlot.update(mSimulatedCommands, mIccCardStatus, phoneId, slotIndex);
        assertNull(mUiccSlot.getUiccCard());
        // As CardState is absent, state should not be unknown
        assertFalse(mUiccSlot.isStateUnknown());
        // radio state unavailable
        mUiccSlot.onRadioStateUnavailable(phoneId);
        // When radio is not available, state is unknown
        assertTrue(mUiccSlot.isStateUnknown());
    }
}