Merge "Update setCdmaRoaming/SubscriptionMode APIs" am: b26cf2d260
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1506517 Change-Id: I5d299e2907e204ffccbe898eef0c508b1e518bb0
This commit is contained in:
@@ -67,13 +67,14 @@ public class CdmaSubscriptionPreferenceController extends CdmaBasePreferenceCont
|
||||
public boolean onPreferenceChange(Preference preference, Object object) {
|
||||
final int newMode = Integer.parseInt((String) object);
|
||||
//TODO(b/117611981): only set it in one place
|
||||
if (mTelephonyManager.setCdmaSubscriptionMode(newMode)) {
|
||||
try {
|
||||
mTelephonyManager.setCdmaSubscriptionMode(newMode);
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.CDMA_SUBSCRIPTION_MODE, newMode);
|
||||
return true;
|
||||
} catch (IllegalStateException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -63,13 +63,14 @@ public class CdmaSystemSelectPreferenceController extends CdmaBasePreferenceCont
|
||||
public boolean onPreferenceChange(Preference preference, Object object) {
|
||||
int newMode = Integer.parseInt((String) object);
|
||||
//TODO(b/117611981): only set it in one place
|
||||
if (mTelephonyManager.setCdmaRoamingMode(newMode)) {
|
||||
try {
|
||||
mTelephonyManager.setCdmaRoamingMode(newMode);
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.CDMA_ROAMING_MODE, newMode);
|
||||
return true;
|
||||
} catch (IllegalStateException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void resetCdmaRoamingModeToDefault() {
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.network.telephony.cdma;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -86,8 +85,6 @@ public class CdmaSubscriptionPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_selectNV_returnNVMode() {
|
||||
doReturn(true).when(mTelephonyManager).setCdmaSubscriptionMode(anyInt());
|
||||
|
||||
mController.onPreferenceChange(mPreference, Integer.toString(
|
||||
TelephonyManager.CDMA_SUBSCRIPTION_NV));
|
||||
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.network.telephony.cdma;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -92,7 +91,6 @@ public class CdmaSystemSelectPreferenceControllerTest {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.CDMA_ROAMING_MODE,
|
||||
TelephonyManager.CDMA_ROAMING_MODE_ANY);
|
||||
doReturn(true).when(mTelephonyManager).setCdmaRoamingMode(anyInt());
|
||||
|
||||
mController.onPreferenceChange(mPreference,
|
||||
Integer.toString(TelephonyManager.CDMA_ROAMING_MODE_HOME));
|
||||
|
Reference in New Issue
Block a user