[Settings] Replace getSimCount() API

Change design of monitor change in Settings.Global.MOBILE_DATA and
Settings.Global.DATA_ROAMING in order to avoid from accessing
getSimCount().

Bug: 144251589
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=RoamingPreferenceControllerTest
Change-Id: If50c57e7c1b27f9a0baf2bd46cc0930e0a0be2bd
This commit is contained in:
Bonian Chen
2019-12-26 19:02:57 +08:00
parent 047dd2dff9
commit b373aeedfe
4 changed files with 117 additions and 73 deletions

View File

@@ -80,7 +80,7 @@ public class RoamingPreferenceControllerTest {
doReturn(mFragmentTransaction).when(mFragmentManager).beginTransaction();
mPreference = spy(new RestrictedSwitchPreference(mContext));
mController = new RoamingPreferenceController(mContext, "roaming");
mController = spy(new RoamingPreferenceController(mContext, "roaming"));
mController.init(mFragmentManager, SUB_ID);
mPreference.setKey(mController.getPreferenceKey());
}
@@ -118,7 +118,7 @@ public class RoamingPreferenceControllerTest {
@Test
public void handlePreferenceTreeClick_needDialog_showDialog() {
mController.mNeedDialog = true;
doReturn(true).when(mController).isDialogNeeded();
mController.handlePreferenceTreeClick(mPreference);