[MEP] show the DSDS mode selection dialog for user when user insert esim

If device has esim, then user inserts esim in SS mode. Then, UI should show
the DSDS mode selection dialog for user.

Bug: 230050990
Test: build pass and manual test.
Change-Id: Ia4e695ae2c4e86d6039e03738378989a0879cc71
This commit is contained in:
SongFerngWang
2022-04-25 21:07:26 +08:00
parent fd7153ed39
commit e5fff060a2

View File

@@ -326,7 +326,7 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
/* Handles the enabling SIM action. */
private void showEnableSubDialog() {
Log.i(TAG, "Handle subscription enabling.");
Log.d(TAG, "Handle subscription enabling.");
if (isDsdsConditionSatisfied()) {
showEnableDsdsConfirmDialog();
return;
@@ -452,7 +452,7 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
}
private void showMepSwitchSimConfirmDialog() {
Log.i(TAG, "showMepSwitchSimConfirmDialog");
Log.d(TAG, "showMepSwitchSimConfirmDialog");
final CharSequence displayName = SubscriptionUtil.getUniqueSubscriptionDisplayName(
mSubInfo, this);
String title = getString(R.string.sim_action_switch_sub_dialog_mep_title, displayName);
@@ -556,27 +556,35 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
private boolean isDsdsConditionSatisfied() {
if (mTelMgr.isMultiSimEnabled()) {
Log.i(TAG, "DSDS is already enabled. Condition not satisfied.");
Log.d(TAG, "DSDS is already enabled. Condition not satisfied.");
return false;
}
if (mTelMgr.isMultiSimSupported() != TelephonyManager.MULTISIM_ALLOWED) {
Log.i(TAG, "Hardware does not support DSDS.");
Log.d(TAG, "Hardware does not support DSDS.");
return false;
}
boolean isActiveSim = SubscriptionUtil.getActiveSubscriptions(
mSubscriptionManager).size() > 0;
if (isMultipleEnabledProfilesSupported() && isActiveSim) {
Log.d(TAG,
"Device supports MEP and eSIM operation and eSIM profile is enabled."
+ " DSDS condition satisfied.");
return true;
}
boolean isRemovableSimEnabled = isRemovableSimEnabled();
if (mIsEsimOperation && isRemovableSimEnabled) {
Log.i(TAG, "eSIM operation and removable SIM is enabled. DSDS condition satisfied.");
Log.d(TAG, "eSIM operation and removable SIM is enabled. DSDS condition satisfied.");
return true;
}
boolean isEsimProfileEnabled =
SubscriptionUtil.getActiveSubscriptions(mSubscriptionManager).stream()
.anyMatch(SubscriptionInfo::isEmbedded);
if (!mIsEsimOperation && isEsimProfileEnabled) {
Log.i(TAG, "Removable SIM operation and eSIM profile is enabled. DSDS condition"
Log.d(TAG, "Removable SIM operation and eSIM profile is enabled. DSDS condition"
+ " satisfied.");
return true;
}
Log.i(TAG, "DSDS condition not satisfied.");
Log.d(TAG, "DSDS condition not satisfied.");
return false;
}