[MEP] disable enabled esim profile before set simSlotMapping
This is the modem request to disable enabled esim profile before set simSlotMapping. Since the framework still do API refactor ag/16494924. The switchToSub API will be changed, so here modify two callback. the one of callback will be removed after the framework complete the API refactor. Bug: 210063749 Test: Build pass. Local test: do sim switch in SS mode and DSDS mode. Change-Id: Iee650897b81c96b5febb0413649629b1a1971b18 Merged-In: Iee650897b81c96b5febb0413649629b1a1971b18
This commit is contained in:
committed by
SongFerng Wang
parent
ba9d26696b
commit
eaec059551
@@ -31,8 +31,7 @@ import com.android.settings.network.telephony.EuiccOperationSidecar;
|
||||
*/
|
||||
public class SwitchToRemovableSlotSidecar extends EuiccOperationSidecar
|
||||
implements SidecarFragment.Listener {
|
||||
|
||||
private static final String TAG = "DisableSubscriptionAndSwitchSlotSidecar";
|
||||
private static final String TAG = "SwitchRemovableSidecar";
|
||||
private static final String ACTION_DISABLE_SUBSCRIPTION_AND_SWITCH_SLOT =
|
||||
"disable_subscription_and_switch_slot_sidecar";
|
||||
|
||||
@@ -115,9 +114,25 @@ public class SwitchToRemovableSlotSidecar extends EuiccOperationSidecar
|
||||
public void run(int physicalSlotId, SubscriptionInfo removedSubInfo) {
|
||||
mPhysicalSlotId = physicalSlotId;
|
||||
mRemovedSubInfo = removedSubInfo;
|
||||
|
||||
Log.i(TAG, "Start to switch to removable slot.");
|
||||
mSwitchSlotSidecar.runSwitchToRemovableSlot(mPhysicalSlotId, mRemovedSubInfo);
|
||||
SubscriptionManager subscriptionManager =
|
||||
getContext().getSystemService(SubscriptionManager.class);
|
||||
if (!mTelephonyManager.isMultiSimEnabled()
|
||||
&& SubscriptionUtil.getActiveSubscriptions(subscriptionManager).stream().anyMatch(
|
||||
SubscriptionInfo::isEmbedded)) {
|
||||
// In SS mode, the esim is active, then inactivate the esim.
|
||||
Log.i(TAG, "There is an active eSIM profile. Disable the profile first.");
|
||||
// Use INVALID_SUBSCRIPTION_ID to disable the only active profile.
|
||||
mSwitchToSubscriptionSidecar.run(SubscriptionManager.INVALID_SUBSCRIPTION_ID, 0, null);
|
||||
} else if (mTelephonyManager.isMultiSimEnabled() && mRemovedSubInfo != null) {
|
||||
// In DSDS mode+MEP, if the replaced esim is active, then it should be disabled esim
|
||||
// profile before changing SimSlotMapping process.
|
||||
// Use INVALID_SUBSCRIPTION_ID to disable the esim profile.
|
||||
mSwitchToSubscriptionSidecar.run(SubscriptionManager.INVALID_SUBSCRIPTION_ID,
|
||||
mRemovedSubInfo.getPortIndex(), null);
|
||||
} else {
|
||||
Log.i(TAG, "Start to switch to removable slot.");
|
||||
mSwitchSlotSidecar.runSwitchToRemovableSlot(mPhysicalSlotId, mRemovedSubInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void onSwitchToSubscriptionSidecarStateChange() {
|
||||
|
Reference in New Issue
Block a user