Merge "[MEP] the user can't enable the psim when revmovable esim is enabled" into tm-qpr-dev am: 2cd07f51ef
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20116277 Change-Id: Ib62e9adf0e2bdac25821c9f70634c27b26515056 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -28,7 +28,6 @@ import android.telephony.UiccSlotMapping;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.telephony.uicc.UiccController;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -273,6 +272,7 @@ public class UiccSlotUtil {
|
||||
if (slotId == INVALID_PHYSICAL_SLOT_ID) {
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
if (slots[i].isRemovable()
|
||||
&& !slots[i].getIsEuicc()
|
||||
&& !slots[i].getPorts().stream().findFirst().get().isActive()
|
||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR
|
||||
&& slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) {
|
||||
@@ -413,4 +413,29 @@ public class UiccSlotUtil {
|
||||
.findFirst()
|
||||
.orElse(INVALID_LOGICAL_SLOT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the removable psim is enabled.
|
||||
*
|
||||
* @param telMgr is a TelephonyManager.
|
||||
* @return whether the removable psim is enabled.
|
||||
*/
|
||||
public static boolean isRemovableSimEnabled(TelephonyManager telMgr) {
|
||||
if (telMgr == null) {
|
||||
return false;
|
||||
}
|
||||
ImmutableList<UiccSlotInfo> slotInfos = UiccSlotUtil.getSlotInfos(telMgr);
|
||||
boolean isRemovableSimEnabled =
|
||||
slotInfos.stream()
|
||||
.anyMatch(
|
||||
slot -> slot != null
|
||||
&& slot.isRemovable()
|
||||
&& !slot.getIsEuicc()
|
||||
&& slot.getPorts().stream().anyMatch(
|
||||
port -> port.isActive())
|
||||
&& slot.getCardStateInfo()
|
||||
== UiccSlotInfo.CARD_STATE_INFO_PRESENT);
|
||||
Log.i(TAG, "isRemovableSimEnabled: " + isRemovableSimEnabled);
|
||||
return isRemovableSimEnabled;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user