[MEP] Modify the comments

Bug: 235792308
Test: build pass
Change-Id: Idf0ce19814ce8b23bc1eea864b36815203069f87
This commit is contained in:
SongFerngWang
2022-06-13 17:59:17 +08:00
parent 56e1297abe
commit e63dfcbd90
3 changed files with 24 additions and 22 deletions

View File

@@ -92,9 +92,6 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
setState(State.RUNNING, Substate.UNUSED);
mCallbackIntent = createCallbackIntent();
mSubId = subscriptionId;
SubscriptionManager subscriptionManager = getContext().getSystemService(
SubscriptionManager.class);
mActiveSubInfos = SubscriptionUtil.getActiveSubscriptions(subscriptionManager);
int targetSlot = getTargetSlot();
if (targetSlot < 0) {
@@ -103,12 +100,16 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
return;
}
SubscriptionManager subscriptionManager = getContext().getSystemService(
SubscriptionManager.class);
mActiveSubInfos = SubscriptionUtil.getActiveSubscriptions(subscriptionManager);
// To check whether the esim slot's port is active. If yes, skip setSlotMapping. If no,
// set this slot+port into setSimSlotMapping.
mPort = (port < 0) ? getTargetPortId(targetSlot, removedSubInfo) : port;
mRemovedSubInfo = removedSubInfo;
Log.d(TAG,
String.format("set esim into the SubId%d Physical Slot%d:Port%d",
String.format("Set esim into the SubId%d Physical Slot%d:Port%d",
mSubId, targetSlot, mPort));
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
// If the subId is INVALID_SUBSCRIPTION_ID, disable the esim (the default esim slot
@@ -120,17 +121,16 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
// Case 1: In DSDS mode+MEP, if the replaced esim is active, then the replaced esim
// should be disabled before changing SimSlotMapping process.
//
// Case2: If the user enables the esimA on the target slot:port and the target
// slot:port is active and there is an active esimB on target slot:port, then the
// settings disables the esimB before the settings enables the esimA on the
// target slot:port.
// Case 2: If the user enables the esim A on the target slot:port which is active
// and there is an active esim B on target slot:port, then the settings disables the
// esim B before the settings enables the esim A on the target slot:port.
//
// Step:
// 1. disables the replaced esim.
// 2. switches the SimSlotMapping if the target slot port is not active.
// 3. enables the target esim.
// 1) Disables the replaced esim.
// 2) Switches the SimSlotMapping if the target slot:port is not active.
// 3) Enables the target esim.
// Note: Use INVALID_SUBSCRIPTION_ID to disable the esim profile.
Log.d(TAG, "disable the enabled esim before the settings enables the target esim");
Log.d(TAG, "Disable the enabled esim before the settings enables the target esim");
mIsDuringSimSlotMapping = true;
mEuiccManager.switchToSubscription(SubscriptionManager.INVALID_SUBSCRIPTION_ID, mPort,
mCallbackIntent);
@@ -235,10 +235,6 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
private boolean isMultipleEnabledProfilesSupported(int physicalEsimSlotIndex) {
List<UiccCardInfo> cardInfos = mTelephonyManager.getUiccCardsInfo();
if (cardInfos == null) {
Log.w(TAG, "UICC cards info list is empty.");
return false;
}
return cardInfos.stream()
.anyMatch(cardInfo -> cardInfo.getPhysicalSlotIndex() == physicalEsimSlotIndex
&& cardInfo.isMultipleEnabledProfilesSupported());

View File

@@ -201,7 +201,7 @@ public class UiccSlotUtil {
&& uiccCardInfo.getCardId() > TelephonyManager.UNSUPPORTED_CARD_ID
&& uiccCardInfo.isEuicc()
&& uiccCardInfo.isRemovable()) {
Log.d(TAG, "getEsimSlotId: This subInfo is removable esim.");
Log.d(TAG, "getEsimSlotId: This subInfo is a removable esim.");
return uiccCardInfo.getPhysicalSlotIndex();
}
}

View File

@@ -52,7 +52,6 @@ import java.util.List;
@RunWith(AndroidJUnit4.class)
public class UiccSlotUtilTest {
private Context mContext;
@Mock
private TelephonyManager mTelephonyManager;
@Mock
@@ -61,8 +60,10 @@ public class UiccSlotUtilTest {
private static final int ESIM_PHYSICAL_SLOT = 0;
private static final int PSIM_PHYSICAL_SLOT = 1;
private Context mContext;
private List<SubscriptionInfo> mSubscriptionInfoList = new ArrayList<>();
private List<UiccCardInfo> mUiccCardInfo = new ArrayList<>();
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
@@ -98,6 +99,7 @@ public class UiccSlotUtilTest {
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot0_returnTheCorrectEsimSlot() {
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
twoSimSlotsDeviceActiveEsimActivePsim());
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, 0);
assertThat(testSlot).isEqualTo(0);
@@ -112,6 +114,7 @@ public class UiccSlotUtilTest {
mUiccCardInfo.add(createUiccCardInfo(true, cardId, 1, true, -1, -1));
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
twoSimSlotsDeviceActiveEsimActiveRemovableEsim());
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, subId);
assertThat(testSlot).isEqualTo(1);
@@ -126,6 +129,7 @@ public class UiccSlotUtilTest {
mUiccCardInfo.add(createUiccCardInfo(true, cardId, 1, true, -1, -1));
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
twoSimSlotsDeviceActivePsimActiveRemovableEsim());
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, subId);
assertThat(testSlot).isEqualTo(1);
@@ -135,6 +139,7 @@ public class UiccSlotUtilTest {
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot1_returnTheCorrectEsimSlot() {
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
twoSimSlotsDeviceActivePsimActiveEsim());
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, 0);
assertThat(testSlot).isEqualTo(1);
@@ -144,6 +149,7 @@ public class UiccSlotUtilTest {
public void getEsimSlotId_noEimSlotDevice_returnTheCorrectEsimSlot() {
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
oneSimSlotDeviceActivePsim());
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, 0);
assertThat(testSlot).isEqualTo(-1);