Merge changes Ic2ac6a5c,I47dc068e

* changes:
  [MEP] The removale slot can read the esim card
  Changing the condition since the esim may be removable
This commit is contained in:
SongFerng Wang
2022-05-27 14:59:48 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 1 deletions

View File

@@ -193,7 +193,7 @@ public class UiccSlotUtil {
if (slotInfo == null) { if (slotInfo == null) {
return false; return false;
} }
return !slotInfo.isRemovable(); return slotInfo.getIsEuicc();
}) })
.findFirst().orElse(-1); .findFirst().orElse(-1);

View File

@@ -92,6 +92,14 @@ public class UiccSlotUtilTest {
assertThat(testSlot).isEqualTo(0); assertThat(testSlot).isEqualTo(0);
} }
@Test
public void getEsimSlotId_twoSimSlotsDeviceAndRemovableEsimIsSlot1_returnTheCorrectEsimSlot() {
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
twoSimSlotsDeviceActivePsimActiveRemovableEsim());
int testSlot = UiccSlotUtil.getEsimSlotId(mContext);
assertThat(testSlot).isEqualTo(1);
}
@Test @Test
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot1_returnTheCorrectEsimSlot() { public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot1_returnTheCorrectEsimSlot() {
@@ -729,6 +737,12 @@ public class UiccSlotUtilTest {
createUiccSlotInfo(true, false, 1, true)}; createUiccSlotInfo(true, false, 1, true)};
} }
private UiccSlotInfo[] twoSimSlotsDeviceActivePsimActiveRemovableEsim() {
return new UiccSlotInfo[]{
createUiccSlotInfo(false, true, 0, true),
createUiccSlotInfo(true, true, 1, true)};
}
private UiccSlotInfo[] twoSimSlotsDeviceActiveEsimActivePsim() { private UiccSlotInfo[] twoSimSlotsDeviceActiveEsimActivePsim() {
return new UiccSlotInfo[]{ return new UiccSlotInfo[]{
createUiccSlotInfo(true, false, 0, true), createUiccSlotInfo(true, false, 0, true),