Merge "[MEP] show the DSDS mode selection dialog for user when user insert esim" into tm-dev
diff --git a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
index 2616a69..d348b24 100644
--- a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
+++ b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
@@ -326,7 +326,7 @@
 
     /* 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 @@
     }
 
     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 @@
 
     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;
     }