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

Commit e725a9f3 authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Upon dual-SIM -> single-SIM switch, auto set default subs.

Bug: 142514392
Test: unittest
Change-Id: Ic008f6eea646806c2db2410c4d5bfd0091ed24c5
parent 68613495
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_T
import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_TYPE_DUAL_CDMA;
import static android.telephony.TelephonyManager.EXTRA_SIM_COMBINATION_WARNING_TYPE_NONE;
import static android.telephony.TelephonyManager.EXTRA_SUBSCRIPTION_ID;
import static android.telephony.TelephonyManager.MODEM_COUNT_SINGLE_MODEM;

import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -473,7 +474,9 @@ public class MultiSimSettingController extends Handler {
        // Otherwise, if user just inserted their first SIM, or there's one primary and one
        // opportunistic subscription active (activeSubInfos.size() > 1), we automatically
        // set the primary to be default SIM and return.
        if (mPrimarySubList.size() == 1 && change != PRIMARY_SUB_REMOVED) {
        if (mPrimarySubList.size() == 1 && (change != PRIMARY_SUB_REMOVED
                || ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE))
                .getActiveModemCount() == MODEM_COUNT_SINGLE_MODEM)) {
            int subId = mPrimarySubList.get(0);
            if (DBG) log("[updateDefaultValues] to only primary sub " + subId);
            mSubController.setDefaultDataSubId(subId);
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ public class MultiSimSettingControllerTest extends TelephonyTest {
        // Sub 1 is the default sub.
        // Sub 1 is in slot 0; sub 2 is in slot 1.
        doReturn(DUAL_SIM).when(mTelephonyManager).getPhoneCount();
        doReturn(DUAL_SIM).when(mTelephonyManager).getActiveModemCount();
        doReturn(1).when(mSubControllerMock).getDefaultDataSubId();
        doReturn(1).when(mSubControllerMock).getDefaultVoiceSubId();
        doReturn(1).when(mSubControllerMock).getDefaultSmsSubId();