Loading src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java +1 −1 Original line number Diff line number Diff line Loading @@ -631,7 +631,7 @@ public class SimStatusDialogController implements LifecycleObserver { final List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); for (UiccCardInfo info : infos) { if (info.getSlotIndex() == pSlotId) { if (info.getPhysicalSlotIndex() == pSlotId) { if (info.isEuicc()) { shouldHaveEid = true; eid = info.getEid(); Loading src/com/android/settings/network/EnableMultiSimSidecar.java +20 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.IntentFilter; import android.provider.Settings; import android.telephony.CarrierConfigManager; import android.telephony.TelephonyManager; import android.telephony.UiccPortInfo; import android.telephony.UiccSlotInfo; import android.util.ArraySet; import android.util.Log; Loading Loading @@ -62,23 +63,23 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> { @Override public void onReceive(Context context, Intent intent) { int readySimsCount = getReadySimsCount(); int activeSlotsCount = getActiveSlotsCount(); // If the number of ready SIM count and active slots equal to the number of SIMs int activePortsCount = getActivePortsCount(); // If the number of ready SIM count and active ports equal to the number of SIMs // need to be activated, the device is successfully switched to multiple active // SIM mode. if (readySimsCount == mNumOfActiveSim && activeSlotsCount == mNumOfActiveSim) { if (readySimsCount == mNumOfActiveSim && activePortsCount == mNumOfActiveSim) { Log.i( TAG, String.format("%d slots are active and ready.", mNumOfActiveSim)); String.format("%d ports are active and ready.", mNumOfActiveSim)); mSimCardStateChangedLatch.countDown(); return; } Log.i( TAG, String.format( "%d slots are active and %d SIMs are ready. Keep waiting until" "%d ports are active and %d SIMs are ready. Keep waiting until" + " timeout.", activeSlotsCount, readySimsCount)); activePortsCount, readySimsCount)); } }; Loading Loading @@ -162,19 +163,22 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> { return readyCardsCount; } // Get active slots count from {@code TelephonyManager#getUiccSlotsInfo}. private int getActiveSlotsCount() { // Get active port count from {@code TelephonyManager#getUiccSlotsInfo}. private int getActivePortsCount() { UiccSlotInfo[] slotsInfo = mTelephonyManager.getUiccSlotsInfo(); if (slotsInfo == null) { return 0; } int activeSlots = 0; int activePorts = 0; for (UiccSlotInfo slotInfo : slotsInfo) { if (slotInfo != null && slotInfo.getIsActive()) { activeSlots++; for (UiccPortInfo portInfo : slotInfo.getPorts()) { if (slotInfo != null && portInfo.isActive()) { activePorts++; } } return activeSlots; } return activePorts; } /** Returns a list of active removable logical slot ids. */ Loading @@ -185,8 +189,10 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> { } Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>(); for (UiccSlotInfo info : infos) { if (info != null && info.getIsActive() && info.isRemovable()) { activeRemovableLogicalSlotIds.add(info.getLogicalSlotIdx()); for (UiccPortInfo portInfo :info.getPorts()) { if (info != null && portInfo.isActive() && info.isRemovable()) { activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex()); } } } return activeRemovableLogicalSlotIds; Loading src/com/android/settings/network/SubscriptionUtil.java +5 −4 Original line number Diff line number Diff line Loading @@ -87,8 +87,8 @@ public class SubscriptionUtil { if (slotInfo == null) { return false; } return !slotInfo.getIsEuicc() && !slotInfo.getIsActive() && slotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT; return !slotInfo.getIsEuicc() && !slotInfo.getPorts().stream().findFirst().get() .isActive() && slotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT; } /** Loading Loading @@ -179,7 +179,8 @@ public class SubscriptionUtil { // verify if subscription is inserted within slot for (UiccSlotInfo slotInfo : slotsInfo) { if ((slotInfo != null) && (!slotInfo.getIsEuicc()) && (slotInfo.getLogicalSlotIdx() == subInfo.getSimSlotIndex())) { && (slotInfo.getPorts().stream().findFirst().get().getLogicalSlotIndex() == subInfo.getSimSlotIndex())) { return true; } } Loading Loading @@ -576,7 +577,7 @@ public class SubscriptionUtil { if (!cardInfo.isRemovable() || cardInfo.getCardId() == TelephonyManager.UNSUPPORTED_CARD_ID) { Log.i(TAG, "Skip embedded card or invalid cardId on slot: " + cardInfo.getSlotIndex()); + cardInfo.getPhysicalSlotIndex()); continue; } Log.i(TAG, "Target removable cardId :" + cardInfo.getCardId()); Loading src/com/android/settings/network/UiccSlotUtil.java +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public class UiccSlotUtil { if (slotId == INVALID_PHYSICAL_SLOT_ID) { for (int i = 0; i < slots.length; i++) { if (slots[i].isRemovable() && !slots[i].getIsActive() && !slots[i].getPorts().stream().findFirst().get().isActive() && slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR && slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) { performSwitchToRemovableSlot(i, context); Loading @@ -107,7 +107,7 @@ public class UiccSlotUtil { if (slotId >= slots.length || !slots[slotId].isRemovable()) { throw new UiccSlotsException("The given slotId is not a removable slot: " + slotId); } if (!slots[slotId].getIsActive()) { if (!slots[slotId].getPorts().stream().findFirst().get().isActive()) { performSwitchToRemovableSlot(slotId, context); } } Loading src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -462,7 +462,8 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc slot -> slot != null && slot.isRemovable() && slot.getIsActive() && slot.getPorts().stream().anyMatch( port -> port.isActive()) && slot.getCardStateInfo() == UiccSlotInfo.CARD_STATE_INFO_PRESENT); if (mIsEsimOperation && isRemovableSimEnabled) { Loading Loading
src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java +1 −1 Original line number Diff line number Diff line Loading @@ -631,7 +631,7 @@ public class SimStatusDialogController implements LifecycleObserver { final List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); for (UiccCardInfo info : infos) { if (info.getSlotIndex() == pSlotId) { if (info.getPhysicalSlotIndex() == pSlotId) { if (info.isEuicc()) { shouldHaveEid = true; eid = info.getEid(); Loading
src/com/android/settings/network/EnableMultiSimSidecar.java +20 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.IntentFilter; import android.provider.Settings; import android.telephony.CarrierConfigManager; import android.telephony.TelephonyManager; import android.telephony.UiccPortInfo; import android.telephony.UiccSlotInfo; import android.util.ArraySet; import android.util.Log; Loading Loading @@ -62,23 +63,23 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> { @Override public void onReceive(Context context, Intent intent) { int readySimsCount = getReadySimsCount(); int activeSlotsCount = getActiveSlotsCount(); // If the number of ready SIM count and active slots equal to the number of SIMs int activePortsCount = getActivePortsCount(); // If the number of ready SIM count and active ports equal to the number of SIMs // need to be activated, the device is successfully switched to multiple active // SIM mode. if (readySimsCount == mNumOfActiveSim && activeSlotsCount == mNumOfActiveSim) { if (readySimsCount == mNumOfActiveSim && activePortsCount == mNumOfActiveSim) { Log.i( TAG, String.format("%d slots are active and ready.", mNumOfActiveSim)); String.format("%d ports are active and ready.", mNumOfActiveSim)); mSimCardStateChangedLatch.countDown(); return; } Log.i( TAG, String.format( "%d slots are active and %d SIMs are ready. Keep waiting until" "%d ports are active and %d SIMs are ready. Keep waiting until" + " timeout.", activeSlotsCount, readySimsCount)); activePortsCount, readySimsCount)); } }; Loading Loading @@ -162,19 +163,22 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> { return readyCardsCount; } // Get active slots count from {@code TelephonyManager#getUiccSlotsInfo}. private int getActiveSlotsCount() { // Get active port count from {@code TelephonyManager#getUiccSlotsInfo}. private int getActivePortsCount() { UiccSlotInfo[] slotsInfo = mTelephonyManager.getUiccSlotsInfo(); if (slotsInfo == null) { return 0; } int activeSlots = 0; int activePorts = 0; for (UiccSlotInfo slotInfo : slotsInfo) { if (slotInfo != null && slotInfo.getIsActive()) { activeSlots++; for (UiccPortInfo portInfo : slotInfo.getPorts()) { if (slotInfo != null && portInfo.isActive()) { activePorts++; } } return activeSlots; } return activePorts; } /** Returns a list of active removable logical slot ids. */ Loading @@ -185,8 +189,10 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> { } Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>(); for (UiccSlotInfo info : infos) { if (info != null && info.getIsActive() && info.isRemovable()) { activeRemovableLogicalSlotIds.add(info.getLogicalSlotIdx()); for (UiccPortInfo portInfo :info.getPorts()) { if (info != null && portInfo.isActive() && info.isRemovable()) { activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex()); } } } return activeRemovableLogicalSlotIds; Loading
src/com/android/settings/network/SubscriptionUtil.java +5 −4 Original line number Diff line number Diff line Loading @@ -87,8 +87,8 @@ public class SubscriptionUtil { if (slotInfo == null) { return false; } return !slotInfo.getIsEuicc() && !slotInfo.getIsActive() && slotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT; return !slotInfo.getIsEuicc() && !slotInfo.getPorts().stream().findFirst().get() .isActive() && slotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT; } /** Loading Loading @@ -179,7 +179,8 @@ public class SubscriptionUtil { // verify if subscription is inserted within slot for (UiccSlotInfo slotInfo : slotsInfo) { if ((slotInfo != null) && (!slotInfo.getIsEuicc()) && (slotInfo.getLogicalSlotIdx() == subInfo.getSimSlotIndex())) { && (slotInfo.getPorts().stream().findFirst().get().getLogicalSlotIndex() == subInfo.getSimSlotIndex())) { return true; } } Loading Loading @@ -576,7 +577,7 @@ public class SubscriptionUtil { if (!cardInfo.isRemovable() || cardInfo.getCardId() == TelephonyManager.UNSUPPORTED_CARD_ID) { Log.i(TAG, "Skip embedded card or invalid cardId on slot: " + cardInfo.getSlotIndex()); + cardInfo.getPhysicalSlotIndex()); continue; } Log.i(TAG, "Target removable cardId :" + cardInfo.getCardId()); Loading
src/com/android/settings/network/UiccSlotUtil.java +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public class UiccSlotUtil { if (slotId == INVALID_PHYSICAL_SLOT_ID) { for (int i = 0; i < slots.length; i++) { if (slots[i].isRemovable() && !slots[i].getIsActive() && !slots[i].getPorts().stream().findFirst().get().isActive() && slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_ERROR && slots[i].getCardStateInfo() != UiccSlotInfo.CARD_STATE_INFO_RESTRICTED) { performSwitchToRemovableSlot(i, context); Loading @@ -107,7 +107,7 @@ public class UiccSlotUtil { if (slotId >= slots.length || !slots[slotId].isRemovable()) { throw new UiccSlotsException("The given slotId is not a removable slot: " + slotId); } if (!slots[slotId].getIsActive()) { if (!slots[slotId].getPorts().stream().findFirst().get().isActive()) { performSwitchToRemovableSlot(slotId, context); } } Loading
src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -462,7 +462,8 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc slot -> slot != null && slot.isRemovable() && slot.getIsActive() && slot.getPorts().stream().anyMatch( port -> port.isActive()) && slot.getCardStateInfo() == UiccSlotInfo.CARD_STATE_INFO_PRESENT); if (mIsEsimOperation && isRemovableSimEnabled) { Loading