Changing the condition since the esim may be removable
The condition whether the slot is esim slot should use getIsEuicc api since the esim may be removable. Bug: 233338345 Test: atest UiccSlotUtilTest Change-Id: I47dc068e57a0faa7f7ce85af7933a48caa2c93e4
This commit is contained in:
@@ -190,7 +190,8 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> {
|
|||||||
Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>();
|
Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>();
|
||||||
for (UiccSlotInfo info : infos) {
|
for (UiccSlotInfo info : infos) {
|
||||||
for (UiccPortInfo portInfo :info.getPorts()) {
|
for (UiccPortInfo portInfo :info.getPorts()) {
|
||||||
if (info != null && portInfo.isActive() && info.isRemovable()) {
|
if (info != null && portInfo.isActive() && info.isRemovable()
|
||||||
|
&& !info.getIsEuicc()) {
|
||||||
activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex());
|
activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
|
|
||||||
@@ -249,6 +249,7 @@ public class UiccSlotUtil {
|
|||||||
if (slotId == INVALID_PHYSICAL_SLOT_ID) {
|
if (slotId == INVALID_PHYSICAL_SLOT_ID) {
|
||||||
for (int i = 0; i < slots.length; i++) {
|
for (int i = 0; i < slots.length; i++) {
|
||||||
if (slots[i].isRemovable()
|
if (slots[i].isRemovable()
|
||||||
|
&& !slots[i].getIsEuicc()
|
||||||
&& !slots[i].getPorts().stream().findFirst().get().isActive()
|
&& !slots[i].getPorts().stream().findFirst().get().isActive()
|
||||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR
|
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR
|
||||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) {
|
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) {
|
||||||
|
@@ -592,6 +592,7 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
|
|||||||
.anyMatch(
|
.anyMatch(
|
||||||
slot -> slot != null
|
slot -> slot != null
|
||||||
&& slot.isRemovable()
|
&& slot.isRemovable()
|
||||||
|
&& !slot.getIsEuicc()
|
||||||
&& slot.getPorts().stream().anyMatch(
|
&& slot.getPorts().stream().anyMatch(
|
||||||
port -> port.isActive())
|
port -> port.isActive())
|
||||||
&& slot.getCardStateInfo()
|
&& slot.getCardStateInfo()
|
||||||
|
@@ -294,7 +294,7 @@ public class SimSlotChangeHandler {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (UiccSlotInfo slotInfo : slotInfos) {
|
for (UiccSlotInfo slotInfo : slotInfos) {
|
||||||
if (slotInfo != null && slotInfo.isRemovable()) {
|
if (slotInfo != null && slotInfo.isRemovable() && !slotInfo.getIsEuicc()) {
|
||||||
return slotInfo;
|
return slotInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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),
|
||||||
|
Reference in New Issue
Block a user