[Settings] "Data during calls" in DDS SUB is still in advanced option.

The DataDuringCallsPreferenceController didn't listen the mobile data changed and update the preference.

Bug: 149344454
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataDuringCallsPreferenceControllerTest

Change-Id: I0121f06efb5257dccc05ad06b93a9db263f012b5
This commit is contained in:
James.cf Lin
2020-02-27 15:16:08 +08:00
parent 2f492604e5
commit 64ac0d4a74
2 changed files with 45 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.network;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
import static com.google.common.truth.Truth.assertThat;
@@ -131,4 +132,24 @@ public class DataDuringCallsPreferenceControllerTest {
assertThat(mController.isAvailable()).isTrue();
assertThat(mSwitchPreference.isVisible()).isTrue();
}
@Test
public void getAvailabilityStatus_mobileDataChangWithDefaultDataSubId_returnUnavailable() {
ShadowSubscriptionManager.setDefaultDataSubscriptionId(SUB_ID_1);
mController.refreshPreference();
assertThat(mController.getAvailabilityStatus(SUB_ID_1))
.isEqualTo(CONDITIONALLY_UNAVAILABLE);
}
@Test
public void getAvailabilityStatus_mobileDataChangWithoutDefaultDataSubId_returnAvailable() {
ShadowSubscriptionManager.setDefaultDataSubscriptionId(SUB_ID_1);
mController.displayPreference(mPreferenceScreen);
mController.refreshPreference();
assertThat(mController.getAvailabilityStatus(SUB_ID_2)).isEqualTo(AVAILABLE);
}
}