Loading src/java/com/android/internal/telephony/MultiSimSettingController.java +5 −1 Original line number Diff line number Diff line Loading @@ -725,8 +725,12 @@ public class MultiSimSettingController extends Handler { && (!dataSelected || !smsSelected || !voiceSelected)) { dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL; } else if (mPrimarySubList.size() > 1 && (isUserVisibleChange(change) || (change == PRIMARY_SUB_INITIALIZED && !dataSelected))) { || (change == PRIMARY_SUB_INITIALIZED && !dataSelected && Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0))) { // If change is SWAPPED_IN_GROUP or MARKED_OPPT, don't ask user again. // In default DSDS devices, do not show data selection dialog during SuW as there is // fullscreen activity to choose data preference. dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA; } Loading tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java +29 −0 Original line number Diff line number Diff line Loading @@ -462,6 +462,35 @@ public class MultiSimSettingControllerTest extends TelephonyTest { verify(mDataEnabledSettingsMock2, times(1)).setDataEnabled(anyInt(), anyBoolean()); } @Test @SmallTest public void testSimpleDsdsInSuW() { // at first boot default is not set doReturn(-1).when(mSubControllerMock).getDefaultDataSubId(); doReturn(true).when(mPhoneMock1).isUserDataEnabled(); doReturn(true).when(mPhoneMock2).isUserDataEnabled(); // setting DEVICE_PROVISIONED as 0 to indicate SuW is running. Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0); // After initialization, sub 2 should have mobile data off. mMultiSimSettingControllerUT.notifyAllSubscriptionLoaded(); mMultiSimSettingControllerUT.notifyCarrierConfigChanged(0, 1); mMultiSimSettingControllerUT.notifyCarrierConfigChanged(1, 2); processAllMessages(); verify(mDataEnabledSettingsMock1).setDataEnabled( TelephonyManager.DATA_ENABLED_REASON_USER, false); verify(mDataEnabledSettingsMock2).setDataEnabled( TelephonyManager.DATA_ENABLED_REASON_USER, false); // as a result of the above calls, update new values to be returned doReturn(false).when(mPhoneMock1).isUserDataEnabled(); doReturn(false).when(mPhoneMock2).isUserDataEnabled(); // No user selection needed, no intent should be sent. verify(mContext, never()).sendBroadcast(any()); } @Test @SmallTest public void testDsdsGrouping() { Loading Loading
src/java/com/android/internal/telephony/MultiSimSettingController.java +5 −1 Original line number Diff line number Diff line Loading @@ -725,8 +725,12 @@ public class MultiSimSettingController extends Handler { && (!dataSelected || !smsSelected || !voiceSelected)) { dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL; } else if (mPrimarySubList.size() > 1 && (isUserVisibleChange(change) || (change == PRIMARY_SUB_INITIALIZED && !dataSelected))) { || (change == PRIMARY_SUB_INITIALIZED && !dataSelected && Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0))) { // If change is SWAPPED_IN_GROUP or MARKED_OPPT, don't ask user again. // In default DSDS devices, do not show data selection dialog during SuW as there is // fullscreen activity to choose data preference. dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA; } Loading
tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java +29 −0 Original line number Diff line number Diff line Loading @@ -462,6 +462,35 @@ public class MultiSimSettingControllerTest extends TelephonyTest { verify(mDataEnabledSettingsMock2, times(1)).setDataEnabled(anyInt(), anyBoolean()); } @Test @SmallTest public void testSimpleDsdsInSuW() { // at first boot default is not set doReturn(-1).when(mSubControllerMock).getDefaultDataSubId(); doReturn(true).when(mPhoneMock1).isUserDataEnabled(); doReturn(true).when(mPhoneMock2).isUserDataEnabled(); // setting DEVICE_PROVISIONED as 0 to indicate SuW is running. Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0); // After initialization, sub 2 should have mobile data off. mMultiSimSettingControllerUT.notifyAllSubscriptionLoaded(); mMultiSimSettingControllerUT.notifyCarrierConfigChanged(0, 1); mMultiSimSettingControllerUT.notifyCarrierConfigChanged(1, 2); processAllMessages(); verify(mDataEnabledSettingsMock1).setDataEnabled( TelephonyManager.DATA_ENABLED_REASON_USER, false); verify(mDataEnabledSettingsMock2).setDataEnabled( TelephonyManager.DATA_ENABLED_REASON_USER, false); // as a result of the above calls, update new values to be returned doReturn(false).when(mPhoneMock1).isUserDataEnabled(); doReturn(false).when(mPhoneMock2).isUserDataEnabled(); // No user selection needed, no intent should be sent. verify(mContext, never()).sendBroadcast(any()); } @Test @SmallTest public void testDsdsGrouping() { Loading