[Mainline] Use isActiveSubscriptionId instead of isActiveSubId for mainline

Bug: 147206736
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DisabledSubscriptionControllerTest
      make RunSettingsRoboTests ROBOTEST_FILTER=MobileNetworkSwitchControllerTest
      make RunSettingsRoboTests ROBOTEST_FILTER=SimSelectNotificationTest

Merged-In: If740c2d7ea2c1392d5fe538091ea6e5c4575ad26
Change-Id: Idca7a76c591448a45ecc33cb392f416c70d32f91
This commit is contained in:
changbetty
2020-01-08 15:24:20 +08:00
committed by Bonian Chen
parent e24a23f9ab
commit f1a52da792
4 changed files with 11 additions and 13 deletions

View File

@@ -109,7 +109,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
public void displayPreference_oneEnabledSubscription_switchBarNotHidden() {
doReturn(true).when(mSubscriptionManager).isActiveSubId(mSubId);
doReturn(true).when(mSubscriptionManager).isActiveSubscriptionId(mSubId);
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscription));
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
@@ -117,7 +117,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
public void displayPreference_oneDisabledSubscription_switchBarNotHidden() {
doReturn(false).when(mSubscriptionManager).isActiveSubId(mSubId);
doReturn(false).when(mSubscriptionManager).isActiveSubscriptionId(mSubId);
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscription));
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
@@ -125,7 +125,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
public void displayPreference_subscriptionEnabled_switchIsOn() {
when(mSubscriptionManager.isActiveSubId(mSubId)).thenReturn(true);
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
assertThat(mSwitchBar.isChecked()).isTrue();
@@ -133,7 +133,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
public void displayPreference_subscriptionDisabled_switchIsOff() {
when(mSubscriptionManager.isActiveSubId(mSubId)).thenReturn(false);
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(false);
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
assertThat(mSwitchBar.isChecked()).isFalse();
@@ -141,7 +141,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
public void switchChangeListener_fromEnabledToDisabled_setSubscriptionEnabledCalledCorrectly() {
when(mSubscriptionManager.isActiveSubId(mSubId)).thenReturn(true);
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
assertThat(mSwitchBar.isChecked()).isTrue();
@@ -153,7 +153,7 @@ public class MobileNetworkSwitchControllerTest {
public void switchChangeListener_fromEnabledToDisabled_setSubscriptionEnabledFailed() {
when(mSubscriptionManager.setSubscriptionEnabled(eq(mSubId), anyBoolean()))
.thenReturn(false);
when(mSubscriptionManager.isActiveSubId(mSubId)).thenReturn(true);
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
assertThat(mSwitchBar.isChecked()).isTrue();
@@ -164,7 +164,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
public void switchChangeListener_fromDisabledToEnabled_setSubscriptionEnabledCalledCorrectly() {
when(mSubscriptionManager.isActiveSubId(mSubId)).thenReturn(false);
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(false);
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
assertThat(mSwitchBar.isChecked()).isFalse();

View File

@@ -117,7 +117,7 @@ public class SimSelectNotificationTest {
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
when(mTelephonyManager.isDataEnabledForApn(TYPE_MMS)).thenReturn(false);
when(mSubscriptionManager.isActiveSubId(mSubId)).thenReturn(true);
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
when(mSubscriptionManager.getActiveSubscriptionInfo(mSubId)).thenReturn(mSubInfo);
when(mSubInfo.getDisplayName()).thenReturn(mFakeDisplayName);
when(mContext.getResources()).thenReturn(mResources);