From e5fff060a28a98d77ef68ef19b8b9fab4473b2cc Mon Sep 17 00:00:00 2001 From: SongFerngWang Date: Mon, 25 Apr 2022 21:07:26 +0800 Subject: [PATCH] [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 --- .../ToggleSubscriptionDialogActivity.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java index 2616a69ba1d..d348b24e58f 100644 --- a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java +++ b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java @@ -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; }