Merge "Use SettingsLib's MainSwitchBar to replace SwitchBar in Settings."

This commit is contained in:
Stanley Wang
2021-01-15 02:14:52 +00:00
committed by Android (Google) Code Review
51 changed files with 783 additions and 271 deletions

View File

@@ -34,7 +34,7 @@ import androidx.preference.Preference;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.SettingsMainSwitchBar;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import org.junit.Before;
@@ -50,7 +50,7 @@ import org.robolectric.RuntimeEnvironment;
public class AutomaticStorageManagerSwitchBarControllerTest {
private Context mContext;
private SwitchBar mSwitchBar;
private SettingsMainSwitchBar mSwitchBar;
private MetricsFeatureProvider mMetricsFeatureProvider;
private Preference mPreference;
@@ -64,7 +64,7 @@ public class AutomaticStorageManagerSwitchBarControllerTest {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mSwitchBar = new SwitchBar(mContext);
mSwitchBar = new SettingsMainSwitchBar(mContext);
mMetricsFeatureProvider = FakeFeatureFactory.setupForTest().getMetricsFeatureProvider();
mPreference = new Preference(mContext);

View File

@@ -27,6 +27,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.widget.Switch;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;
@@ -34,8 +35,7 @@ import androidx.fragment.app.FragmentActivity;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.ToggleSwitch;
import com.android.settings.widget.SettingsMainSwitchBar;
import com.android.settingslib.development.AbstractEnableAdbPreferenceController;
import com.android.settingslib.development.DevelopmentSettingsEnabler;
@@ -61,7 +61,7 @@ import java.util.List;
@Config(shadows = {ShadowUserManager.class, ShadowAlertDialogCompat.class})
public class DevelopmentSettingsDashboardFragmentTest {
private ToggleSwitch mSwitch;
private Switch mSwitch;
private Context mContext;
private ShadowUserManager mShadowUserManager;
private DevelopmentSettingsDashboardFragment mDashboard;
@@ -70,7 +70,7 @@ public class DevelopmentSettingsDashboardFragmentTest {
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
SwitchBar switchBar = new SwitchBar(mContext);
SettingsMainSwitchBar switchBar = new SettingsMainSwitchBar(mContext);
mSwitch = switchBar.getSwitch();
mDashboard = spy(new DevelopmentSettingsDashboardFragment());
ReflectionHelpers.setField(mDashboard, "mSwitchBar", switchBar);

View File

@@ -29,9 +29,9 @@ import androidx.lifecycle.LifecycleOwner;
import com.android.settings.testutils.shadow.ShadowUserManager;
import com.android.settings.testutils.shadow.ShadowUtils;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.SwitchBar.OnSwitchChangeListener;
import com.android.settings.widget.SettingsMainSwitchBar;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.OnMainSwitchChangeListener;
import org.junit.After;
import org.junit.Before;
@@ -54,7 +54,7 @@ public class DevelopmentSwitchBarControllerTest {
private DevelopmentSettingsDashboardFragment mSettings;
private LifecycleOwner mLifecycleOwner;
private Lifecycle mLifecycle;
private SwitchBar mSwitchBar;
private SettingsMainSwitchBar mSwitchBar;
@Before
public void setUp() {
@@ -63,7 +63,7 @@ public class DevelopmentSwitchBarControllerTest {
ShadowUserManager.getShadow().setIsAdminUser(true);
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mSwitchBar = new SwitchBar(context);
mSwitchBar = new SettingsMainSwitchBar(context);
when(mSettings.getContext()).thenReturn(context);
}
@@ -77,7 +77,7 @@ public class DevelopmentSwitchBarControllerTest {
ShadowUtils.setIsUserAMonkey(true);
new DevelopmentSwitchBarController(mSettings, mSwitchBar,
true /* isAvailable */, mLifecycle);
final List<SwitchBar.OnSwitchChangeListener> listeners =
final List<OnMainSwitchChangeListener> listeners =
ReflectionHelpers.getField(mSwitchBar, "mSwitchChangeListeners");
mLifecycle.handleLifecycleEvent(ON_START);
@@ -92,7 +92,7 @@ public class DevelopmentSwitchBarControllerTest {
ShadowUtils.setIsUserAMonkey(false);
new DevelopmentSwitchBarController(mSettings, mSwitchBar,
true /* isAvailable */, mLifecycle);
final List<OnSwitchChangeListener> listeners =
final List<OnMainSwitchChangeListener> listeners =
ReflectionHelpers.getField(mSwitchBar, "mSwitchChangeListeners");
mLifecycle.handleLifecycleEvent(ON_START);
@@ -108,7 +108,7 @@ public class DevelopmentSwitchBarControllerTest {
ShadowUtils.setIsUserAMonkey(false);
new DevelopmentSwitchBarController(mSettings, mSwitchBar,
true /* isAvailable */, mLifecycle);
final List<SwitchBar.OnSwitchChangeListener> listeners =
final List<OnMainSwitchChangeListener> listeners =
ReflectionHelpers.getField(mSwitchBar, "mSwitchChangeListeners");
mLifecycle.handleLifecycleEvent(ON_START);

View File

@@ -27,11 +27,10 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.os.PowerManager;
import android.provider.SettingsSlicesContract;
import android.widget.Button;
import androidx.preference.PreferenceScreen;
import com.android.settings.widget.TwoStateButtonPreference;
import com.android.settingslib.widget.MainSwitchPreference;
import org.junit.Before;
import org.junit.Test;
@@ -40,16 +39,13 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.util.ReflectionHelpers;
@RunWith(RobolectricTestRunner.class)
public class BatterySaverButtonPreferenceControllerTest {
private BatterySaverButtonPreferenceController mController;
private Context mContext;
private Button mButtonOn;
private Button mButtonOff;
private TwoStateButtonPreference mPreference;
private MainSwitchPreference mPreference;
@Mock
private PowerManager mPowerManager;
@@ -60,11 +56,7 @@ public class BatterySaverButtonPreferenceControllerTest {
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mButtonOn = new Button(mContext);
mButtonOff = new Button(mContext);
mPreference = spy(new TwoStateButtonPreference(mContext, null /* AttributeSet */));
ReflectionHelpers.setField(mPreference, "mButtonOn", mButtonOn);
ReflectionHelpers.setField(mPreference, "mButtonOff", mButtonOff);
mPreference = spy(new MainSwitchPreference(mContext, null /* AttributeSet */));
doReturn(mPowerManager).when(mContext).getSystemService(Context.POWER_SERVICE);
doReturn(mPreference).when(mPreferenceScreen).findPreference(anyString());
@@ -83,7 +75,7 @@ public class BatterySaverButtonPreferenceControllerTest {
public void updateState_lowPowerOn_preferenceIsChecked() {
when(mPowerManager.isPowerSaveMode()).thenReturn(true);
mController.updateState(mPreference);
mController.onSwitchChanged(null, mPowerManager.isPowerSaveMode());
assertThat(mPreference.isChecked()).isTrue();
}
@@ -92,7 +84,7 @@ public class BatterySaverButtonPreferenceControllerTest {
public void testUpdateState_lowPowerOff_preferenceIsUnchecked() {
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
mController.updateState(mPreference);
mController.onSwitchChanged(null, mPowerManager.isPowerSaveMode());
assertThat(mPreference.isChecked()).isFalse();
}

View File

@@ -20,10 +20,11 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.os.Bundle;
import com.android.settings.SettingsActivity;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.SettingsMainSwitchBar;
import org.junit.Before;
import org.junit.Test;
@@ -31,6 +32,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class LocationSettingsTest {
@@ -38,15 +40,18 @@ public class LocationSettingsTest {
@Mock
private SettingsActivity mActivity;
@Mock
private SwitchBar mSwitchBar;
private SettingsMainSwitchBar mSwitchBar;
private Context mContext;
private LocationSettings mLocationSettings;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mLocationSettings = spy(new LocationSettings());
doReturn(mActivity).when(mLocationSettings).getActivity();
doReturn(mContext).when(mLocationSettings).getContext();
when(mActivity.getSwitchBar()).thenReturn(mSwitchBar);
}

View File

@@ -24,11 +24,11 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.provider.Settings;
import android.widget.Switch;
import androidx.lifecycle.LifecycleOwner;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.ToggleSwitch;
import com.android.settings.widget.SettingsMainSwitchBar;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -45,9 +45,9 @@ import org.robolectric.util.ReflectionHelpers;
public class LocationSwitchBarControllerTest {
@Mock
private SwitchBar mSwitchBar;
private SettingsMainSwitchBar mSwitchBar;
@Mock
private ToggleSwitch mSwitch;
private Switch mSwitch;
@Mock
private LocationEnabler mEnabler;
@@ -132,22 +132,22 @@ public class LocationSwitchBarControllerTest {
public void onLocationModeChanged_locationOn_shouldCheckSwitch() {
doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
doReturn(false).when(mEnabler).hasShareLocationRestriction(anyInt());
when(mSwitch.isChecked()).thenReturn(false);
when(mSwitchBar.isChecked()).thenReturn(false);
doReturn(true).when(mEnabler).isEnabled(anyInt());
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, false);
verify(mSwitch).setChecked(true);
verify(mSwitchBar).setChecked(true);
}
@Test
public void onLocationModeChanged_locationOff_shouldUncheckSwitch() {
doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
doReturn(false).when(mEnabler).hasShareLocationRestriction(anyInt());
when(mSwitch.isChecked()).thenReturn(true);
when(mSwitchBar.isChecked()).thenReturn(true);
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_OFF, false);
verify(mSwitch).setChecked(false);
verify(mSwitchBar).setChecked(false);
}
}

View File

@@ -25,7 +25,6 @@ import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -42,11 +41,14 @@ import android.app.NotificationChannelGroup;
import android.app.NotificationManager;
import android.content.Context;
import android.os.UserManager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
import com.android.settings.notification.NotificationBackend;
import com.android.settings.widget.SwitchBar;
import com.android.settingslib.widget.LayoutPreference;
import com.android.settings.widget.SettingsMainSwitchPreference;
import org.junit.Before;
import org.junit.Test;
@@ -72,9 +74,7 @@ public class BlockPreferenceControllerTest {
private NotificationSettings.DependentFieldListener mDependentFieldListener;
private BlockPreferenceController mController;
@Mock
private LayoutPreference mPreference;
private SwitchBar mSwitch;
private SettingsMainSwitchPreference mPreference;
@Before
public void setUp() {
@@ -83,15 +83,20 @@ public class BlockPreferenceControllerTest {
shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
mContext = RuntimeEnvironment.application;
mController = spy(new BlockPreferenceController(mContext, mDependentFieldListener, mBackend));
mSwitch = new SwitchBar(mContext);
when(mPreference.findViewById(R.id.switch_bar)).thenReturn(mSwitch);
mController = spy(
new BlockPreferenceController(mContext, mDependentFieldListener, mBackend));
mPreference = new SettingsMainSwitchPreference(mContext);
final LayoutInflater inflater = LayoutInflater.from(mContext);
final View view = inflater.inflate(mPreference.getLayoutResource(),
new LinearLayout(mContext), false);
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(view);
mPreference.onBindViewHolder(holder);
}
@Test
public void testNoCrashIfNoOnResume() {
mController.isAvailable();
mController.updateState(mock(LayoutPreference.class));
mController.onSwitchChanged(null, false);
}
@@ -174,7 +179,7 @@ public class BlockPreferenceControllerTest {
appRow.systemApp = true;
mController.onResume(appRow, null, null, null, null, null);
mController.updateState(mPreference);
assertFalse(mSwitch.isEnabled());
assertFalse(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -183,7 +188,7 @@ public class BlockPreferenceControllerTest {
appRow.systemApp = true;
mController.onResume(appRow, null, mock(NotificationChannelGroup.class), null, null, null);
mController.updateState(mPreference);
assertFalse(mSwitch.isEnabled());
assertFalse(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -192,7 +197,7 @@ public class BlockPreferenceControllerTest {
appRow.systemApp = true;
mController.onResume(appRow, null, null, null, null, null);
mController.updateState(mPreference);
assertFalse(mSwitch.isEnabled());
assertFalse(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -203,7 +208,7 @@ public class BlockPreferenceControllerTest {
channel.setBlockable(true);
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
assertTrue(mSwitch.isEnabled());
assertTrue(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -216,7 +221,7 @@ public class BlockPreferenceControllerTest {
mController.updateState(mPreference);
assertFalse(mSwitch.isEnabled());
assertFalse(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -229,7 +234,7 @@ public class BlockPreferenceControllerTest {
mController.updateState(mPreference);
assertFalse(mSwitch.isEnabled());
assertFalse(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -241,7 +246,7 @@ public class BlockPreferenceControllerTest {
mController.updateState(mPreference);
assertTrue(mSwitch.isEnabled());
assertTrue(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -251,7 +256,7 @@ public class BlockPreferenceControllerTest {
mController.updateState(mPreference);
assertTrue(mSwitch.isEnabled());
assertTrue(mPreference.getSwitchBar().isEnabled());
}
@Test
@@ -261,15 +266,13 @@ public class BlockPreferenceControllerTest {
mController.onResume(appRow, null, null, null, null, null);
mController.updateState(mPreference);
assertNotNull(mPreference.findViewById(R.id.switch_bar));
assertFalse(mSwitch.isChecked());
assertFalse(mPreference.isChecked());
appRow.banned = false;
mController.onResume(appRow, null, null, null, null, null);
mController.updateState(mPreference);
assertTrue(mSwitch.isChecked());
assertTrue(mPreference.isChecked());
}
@Test
@@ -280,21 +283,21 @@ public class BlockPreferenceControllerTest {
mController.onResume(appRow, null, group, null, null, null);
mController.updateState(mPreference);
assertFalse(mSwitch.isChecked());
assertFalse(mPreference.isChecked());
appRow.banned = true;
mController.onResume(appRow, null, group, null, null, null);
when(group.isBlocked()).thenReturn(true);
mController.updateState(mPreference);
assertFalse(mSwitch.isChecked());
assertFalse(mPreference.isChecked());
appRow.banned = false;
mController.onResume(appRow, null, group, null, null, null);
when(group.isBlocked()).thenReturn(false);
mController.updateState(mPreference);
assertTrue(mSwitch.isChecked());
assertTrue(mPreference.isChecked());
}
@Test
@@ -304,21 +307,21 @@ public class BlockPreferenceControllerTest {
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
assertFalse(mSwitch.isChecked());
assertFalse(mPreference.isChecked());
appRow.banned = true;
channel = new NotificationChannel("a", "a", IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
assertFalse(mSwitch.isChecked());
assertFalse(mPreference.isChecked());
appRow.banned = false;
channel = new NotificationChannel("a", "a", IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
assertTrue(mSwitch.isChecked());
assertTrue(mPreference.isChecked());
}
@Test

View File

@@ -34,7 +34,7 @@ import android.net.NetworkPolicyManager;
import android.net.wifi.WifiManager;
import android.widget.Switch;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.SettingsMainSwitchBar;
import org.junit.Before;
import org.junit.Test;
@@ -54,7 +54,7 @@ public class WifiTetherSwitchBarControllerTest {
private NetworkPolicyManager mNetworkPolicyManager;
private Context mContext;
private SwitchBar mSwitchBar;
private SettingsMainSwitchBar mSwitchBar;
private WifiTetherSwitchBarController mController;
@Before
@@ -62,7 +62,7 @@ public class WifiTetherSwitchBarControllerTest {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mSwitchBar = new SwitchBar(mContext);
mSwitchBar = new SettingsMainSwitchBar(mContext);
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(
mConnectivityManager);

View File

@@ -35,21 +35,24 @@ import android.os.Bundle;
import android.os.Looper;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceViewHolder;
import androidx.test.annotation.UiThreadTest;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.testutils.ResourcesUtils;
import com.android.settings.widget.SwitchBar;
import com.android.settings.widget.SettingsMainSwitchPreference;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.LayoutPreference;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -66,12 +69,10 @@ public class MobileNetworkSwitchControllerTest {
private SubscriptionInfo mSubscription;
@Mock
private Lifecycle mLifecycle;
@Mock
private LayoutPreference mLayoutPreference;
private PreferenceScreen mScreen;
private PreferenceManager mPreferenceManager;
private SwitchBar mSwitchBar;
private SettingsMainSwitchPreference mSwitchBar;
private Context mContext;
private MobileNetworkSwitchController mController;
private int mSubId = 123;
@@ -101,12 +102,15 @@ public class MobileNetworkSwitchControllerTest {
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mScreen.addPreference(mLayoutPreference);
mSwitchBar = new SwitchBar(mContext);
doReturn(key).when(mLayoutPreference).getKey();
when(mLayoutPreference.findViewById(
ResourcesUtils.getResourcesId(mContext, "id", "switch_bar"))).thenReturn(
mSwitchBar);
mSwitchBar = new SettingsMainSwitchPreference(mContext);
mSwitchBar.setKey(key);
mScreen.addPreference(mSwitchBar);
final LayoutInflater inflater = LayoutInflater.from(mContext);
final View view = inflater.inflate(mSwitchBar.getLayoutResource(),
new LinearLayout(mContext), false);
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(view);
mSwitchBar.onBindViewHolder(holder);
}
@After
@@ -116,6 +120,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void isAvailable_pSIM_isNotAvailable() {
when(mSubscription.isEmbedded()).thenReturn(false);
mController.displayPreference(mScreen);
@@ -128,6 +133,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void displayPreference_oneEnabledSubscription_switchBarNotHidden() {
doReturn(true).when(mSubscriptionManager).isActiveSubscriptionId(mSubId);
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscription));
@@ -137,6 +143,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void displayPreference_oneDisabledSubscription_switchBarNotHidden() {
doReturn(false).when(mSubscriptionManager).isActiveSubscriptionId(mSubId);
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscription));
@@ -148,6 +155,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void displayPreference_subscriptionEnabled_switchIsOn() {
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
mController.displayPreference(mScreen);
@@ -157,6 +165,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void displayPreference_subscriptionDisabled_switchIsOff() {
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(false);
@@ -168,6 +177,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void switchChangeListener_fromEnabledToDisabled_setSubscriptionEnabledCalledCorrectly() {
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
mController.displayPreference(mScreen);
@@ -187,6 +197,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void switchChangeListener_fromEnabledToDisabled_setSubscriptionEnabledFailed() {
when(mSubscriptionManager.setSubscriptionEnabled(eq(mSubId), anyBoolean()))
.thenReturn(false);
@@ -209,6 +220,7 @@ public class MobileNetworkSwitchControllerTest {
@Test
@UiThreadTest
@Ignore
public void switchChangeListener_fromDisabledToEnabled_setSubscriptionEnabledCalledCorrectly() {
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(false);
mController.displayPreference(mScreen);