Loading src/java/com/android/internal/telephony/MultiSimSettingController.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading
src/java/com/android/internal/telephony/MultiSimSettingController.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading
tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading