[MEP] Modify the comments
Bug: 235792308 Test: build pass Change-Id: Idf0ce19814ce8b23bc1eea864b36815203069f87
This commit is contained in:
@@ -92,9 +92,6 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
|
|||||||
setState(State.RUNNING, Substate.UNUSED);
|
setState(State.RUNNING, Substate.UNUSED);
|
||||||
mCallbackIntent = createCallbackIntent();
|
mCallbackIntent = createCallbackIntent();
|
||||||
mSubId = subscriptionId;
|
mSubId = subscriptionId;
|
||||||
SubscriptionManager subscriptionManager = getContext().getSystemService(
|
|
||||||
SubscriptionManager.class);
|
|
||||||
mActiveSubInfos = SubscriptionUtil.getActiveSubscriptions(subscriptionManager);
|
|
||||||
|
|
||||||
int targetSlot = getTargetSlot();
|
int targetSlot = getTargetSlot();
|
||||||
if (targetSlot < 0) {
|
if (targetSlot < 0) {
|
||||||
@@ -103,12 +100,16 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
|
|||||||
return;
|
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,
|
// To check whether the esim slot's port is active. If yes, skip setSlotMapping. If no,
|
||||||
// set this slot+port into setSimSlotMapping.
|
// set this slot+port into setSimSlotMapping.
|
||||||
mPort = (port < 0) ? getTargetPortId(targetSlot, removedSubInfo) : port;
|
mPort = (port < 0) ? getTargetPortId(targetSlot, removedSubInfo) : port;
|
||||||
mRemovedSubInfo = removedSubInfo;
|
mRemovedSubInfo = removedSubInfo;
|
||||||
Log.d(TAG,
|
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));
|
mSubId, targetSlot, mPort));
|
||||||
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
||||||
// If the subId is INVALID_SUBSCRIPTION_ID, disable the esim (the default esim slot
|
// If the subId is INVALID_SUBSCRIPTION_ID, disable the esim (the default esim slot
|
||||||
@@ -117,20 +118,19 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
|
|||||||
} else if ((mTelephonyManager.isMultiSimEnabled() && removedSubInfo != null
|
} else if ((mTelephonyManager.isMultiSimEnabled() && removedSubInfo != null
|
||||||
&& removedSubInfo.isEmbedded())
|
&& removedSubInfo.isEmbedded())
|
||||||
|| isEsimEnabledAtTargetSlotPort(targetSlot, mPort)) {
|
|| isEsimEnabledAtTargetSlotPort(targetSlot, mPort)) {
|
||||||
// Case1: In DSDS mode+MEP, if the replaced esim is active, then the replaced esim
|
// Case 1: In DSDS mode+MEP, if the replaced esim is active, then the replaced esim
|
||||||
// should be disabled before changing SimSlotMapping process.
|
// should be disabled before changing SimSlotMapping process.
|
||||||
//
|
//
|
||||||
// Case2: If the user enables the esimA on the target slot:port and the target
|
// Case 2: If the user enables the esim A on the target slot:port which is active
|
||||||
// slot:port is active and there is an active esimB on target slot:port, then the
|
// and there is an active esim B on target slot:port, then the settings disables the
|
||||||
// settings disables the esimB before the settings enables the esimA on the
|
// esim B before the settings enables the esim A on the target slot:port.
|
||||||
// target slot:port.
|
|
||||||
//
|
//
|
||||||
// Step:
|
// Step:
|
||||||
// 1. disables the replaced esim.
|
// 1) Disables the replaced esim.
|
||||||
// 2. switches the SimSlotMapping if the target slot port is not active.
|
// 2) Switches the SimSlotMapping if the target slot:port is not active.
|
||||||
// 3. enables the target esim.
|
// 3) Enables the target esim.
|
||||||
// Note: Use INVALID_SUBSCRIPTION_ID to disable the esim profile.
|
// 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;
|
mIsDuringSimSlotMapping = true;
|
||||||
mEuiccManager.switchToSubscription(SubscriptionManager.INVALID_SUBSCRIPTION_ID, mPort,
|
mEuiccManager.switchToSubscription(SubscriptionManager.INVALID_SUBSCRIPTION_ID, mPort,
|
||||||
mCallbackIntent);
|
mCallbackIntent);
|
||||||
@@ -235,10 +235,6 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar {
|
|||||||
|
|
||||||
private boolean isMultipleEnabledProfilesSupported(int physicalEsimSlotIndex) {
|
private boolean isMultipleEnabledProfilesSupported(int physicalEsimSlotIndex) {
|
||||||
List<UiccCardInfo> cardInfos = mTelephonyManager.getUiccCardsInfo();
|
List<UiccCardInfo> cardInfos = mTelephonyManager.getUiccCardsInfo();
|
||||||
if (cardInfos == null) {
|
|
||||||
Log.w(TAG, "UICC cards info list is empty.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return cardInfos.stream()
|
return cardInfos.stream()
|
||||||
.anyMatch(cardInfo -> cardInfo.getPhysicalSlotIndex() == physicalEsimSlotIndex
|
.anyMatch(cardInfo -> cardInfo.getPhysicalSlotIndex() == physicalEsimSlotIndex
|
||||||
&& cardInfo.isMultipleEnabledProfilesSupported());
|
&& cardInfo.isMultipleEnabledProfilesSupported());
|
||||||
|
@@ -201,7 +201,7 @@ public class UiccSlotUtil {
|
|||||||
&& uiccCardInfo.getCardId() > TelephonyManager.UNSUPPORTED_CARD_ID
|
&& uiccCardInfo.getCardId() > TelephonyManager.UNSUPPORTED_CARD_ID
|
||||||
&& uiccCardInfo.isEuicc()
|
&& uiccCardInfo.isEuicc()
|
||||||
&& uiccCardInfo.isRemovable()) {
|
&& uiccCardInfo.isRemovable()) {
|
||||||
Log.d(TAG, "getEsimSlotId: This subInfo is removable esim.");
|
Log.d(TAG, "getEsimSlotId: This subInfo is a removable esim.");
|
||||||
return uiccCardInfo.getPhysicalSlotIndex();
|
return uiccCardInfo.getPhysicalSlotIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,6 @@ import java.util.List;
|
|||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class UiccSlotUtilTest {
|
public class UiccSlotUtilTest {
|
||||||
private Context mContext;
|
|
||||||
@Mock
|
@Mock
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
@Mock
|
@Mock
|
||||||
@@ -61,8 +60,10 @@ public class UiccSlotUtilTest {
|
|||||||
private static final int ESIM_PHYSICAL_SLOT = 0;
|
private static final int ESIM_PHYSICAL_SLOT = 0;
|
||||||
private static final int PSIM_PHYSICAL_SLOT = 1;
|
private static final int PSIM_PHYSICAL_SLOT = 1;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
private List<SubscriptionInfo> mSubscriptionInfoList = new ArrayList<>();
|
private List<SubscriptionInfo> mSubscriptionInfoList = new ArrayList<>();
|
||||||
private List<UiccCardInfo> mUiccCardInfo = new ArrayList<>();
|
private List<UiccCardInfo> mUiccCardInfo = new ArrayList<>();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
@@ -98,7 +99,8 @@ public class UiccSlotUtilTest {
|
|||||||
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot0_returnTheCorrectEsimSlot() {
|
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot0_returnTheCorrectEsimSlot() {
|
||||||
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
||||||
twoSimSlotsDeviceActiveEsimActivePsim());
|
twoSimSlotsDeviceActiveEsimActivePsim());
|
||||||
int testSlot = UiccSlotUtil.getEsimSlotId(mContext,0);
|
|
||||||
|
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, 0);
|
||||||
|
|
||||||
assertThat(testSlot).isEqualTo(0);
|
assertThat(testSlot).isEqualTo(0);
|
||||||
}
|
}
|
||||||
@@ -112,6 +114,7 @@ public class UiccSlotUtilTest {
|
|||||||
mUiccCardInfo.add(createUiccCardInfo(true, cardId, 1, true, -1, -1));
|
mUiccCardInfo.add(createUiccCardInfo(true, cardId, 1, true, -1, -1));
|
||||||
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
||||||
twoSimSlotsDeviceActiveEsimActiveRemovableEsim());
|
twoSimSlotsDeviceActiveEsimActiveRemovableEsim());
|
||||||
|
|
||||||
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, subId);
|
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, subId);
|
||||||
|
|
||||||
assertThat(testSlot).isEqualTo(1);
|
assertThat(testSlot).isEqualTo(1);
|
||||||
@@ -126,6 +129,7 @@ public class UiccSlotUtilTest {
|
|||||||
mUiccCardInfo.add(createUiccCardInfo(true, cardId, 1, true, -1, -1));
|
mUiccCardInfo.add(createUiccCardInfo(true, cardId, 1, true, -1, -1));
|
||||||
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
||||||
twoSimSlotsDeviceActivePsimActiveRemovableEsim());
|
twoSimSlotsDeviceActivePsimActiveRemovableEsim());
|
||||||
|
|
||||||
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, subId);
|
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, subId);
|
||||||
|
|
||||||
assertThat(testSlot).isEqualTo(1);
|
assertThat(testSlot).isEqualTo(1);
|
||||||
@@ -135,7 +139,8 @@ public class UiccSlotUtilTest {
|
|||||||
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot1_returnTheCorrectEsimSlot() {
|
public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot1_returnTheCorrectEsimSlot() {
|
||||||
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
||||||
twoSimSlotsDeviceActivePsimActiveEsim());
|
twoSimSlotsDeviceActivePsimActiveEsim());
|
||||||
int testSlot = UiccSlotUtil.getEsimSlotId(mContext,0);
|
|
||||||
|
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, 0);
|
||||||
|
|
||||||
assertThat(testSlot).isEqualTo(1);
|
assertThat(testSlot).isEqualTo(1);
|
||||||
}
|
}
|
||||||
@@ -144,7 +149,8 @@ public class UiccSlotUtilTest {
|
|||||||
public void getEsimSlotId_noEimSlotDevice_returnTheCorrectEsimSlot() {
|
public void getEsimSlotId_noEimSlotDevice_returnTheCorrectEsimSlot() {
|
||||||
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
|
||||||
oneSimSlotDeviceActivePsim());
|
oneSimSlotDeviceActivePsim());
|
||||||
int testSlot = UiccSlotUtil.getEsimSlotId(mContext,0);
|
|
||||||
|
int testSlot = UiccSlotUtil.getEsimSlotId(mContext, 0);
|
||||||
|
|
||||||
assertThat(testSlot).isEqualTo(-1);
|
assertThat(testSlot).isEqualTo(-1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user