Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45d498e4 authored by SongFerng Wang's avatar SongFerng Wang Committed by Automerger Merge Worker
Browse files

Merge "[MEP] show the DSDS mode selection dialog for user when user insert...

Merge "[MEP] show the DSDS mode selection dialog for user when user insert esim" into tm-dev am: 1bc14277

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17904395



Change-Id: Ib83808167690f7b67cef48ef53764a1f7e500897
Ignore-AOSP-First: this is an automerge
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 61a35e7b 1bc14277
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -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;
    }