Store the preferred network mode only if it set to modem successfully
In Q, the phoneInterfaceManager store the preferred network type when it
set to modem successfully. Keep the behavior same as before.
Bug: 160201328
Test: Atest and by manual
Change-Id: Ieb0f48bf849ce5c9a9b3b8d4192a755a6f0adb3a
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 0fd7ec0..82819a1 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5532,11 +5532,13 @@
final long identity = Binder.clearCallingIdentity();
try {
- Settings.Global.putInt(mApp.getContentResolver(),
- Settings.Global.PREFERRED_NETWORK_MODE + subId, networkType);
-
Boolean success = (Boolean) sendRequest(
CMD_SET_PREFERRED_NETWORK_TYPE, networkType, subId);
+
+ if (success) {
+ Settings.Global.putInt(mApp.getContentResolver(),
+ Settings.Global.PREFERRED_NETWORK_MODE + subId, networkType);
+ }
if (DBG) log("setPreferredNetworkType: " + (success ? "ok" : "fail"));
return success;
} finally {