Merge "Do not rely on roaming when setting WFC roaming setting"
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 0cb93aa..629276e 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -410,6 +410,10 @@
}
}
mButtonWifiCalling.setSummary(resId);
+ Intent intent = mButtonWifiCalling.getIntent();
+ if (intent != null) {
+ intent.putExtra(Settings.EXTRA_SUB_ID, mPhone.getSubId());
+ }
prefSet.addPreference(mButtonWifiCalling);
}
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 1c4b1c3..8299d86 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -924,12 +924,9 @@
@Override
public void overrideConfig(int subscriptionId, PersistableBundle overrides) {
- // SHELL UID already has MODIFY_PHONE_STATE implicitly so we do not have to check it, but
- // the API signature explicitly declares that the method caller have MODIFY_PHONE_STATE, so
- // calling this as well to be safe.
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.MODIFY_PHONE_STATE, null);
- TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(), "overrideConfig");
+ //TODO: Also check for SHELL UID to restrict this method to testing only (b/131326259)
int phoneId = SubscriptionManager.getPhoneId(subscriptionId);
if (!SubscriptionManager.isValidPhoneId(phoneId)) {
log("Ignore invalid phoneId: " + phoneId + " for subId: " + subscriptionId);
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index de3fffc..942c1e2 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -569,9 +569,8 @@
if (DBG) log("showDataDisconnectedRoaming()...");
// "Mobile network settings" screen / dialog
- Intent intent = new Intent(mContext, com.android.phone.MobileNetworkSettings.class);
+ Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
intent.putExtra(Settings.EXTRA_SUB_ID, subId);
- intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(mContext, subId, intent, 0);
final CharSequence contentText = mContext.getText(R.string.roaming_reenable_message);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e28c521..652d4d1 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -172,6 +172,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Set;
/**
@@ -248,6 +249,8 @@
private static final int EVENT_REQUEST_CELL_INFO_UPDATE_DONE = 67;
private static final int CMD_REQUEST_ENABLE_MODEM = 68;
private static final int EVENT_ENABLE_MODEM_DONE = 69;
+ private static final int CMD_GET_MODEM_STATUS = 70;
+ private static final int EVENT_GET_MODEM_STATUS_DONE = 71;
// Parameters of select command.
private static final int SELECT_COMMAND = 0xA4;
@@ -1117,10 +1120,42 @@
ar = (AsyncResult) msg.obj;
request = (MainThreadRequest) ar.userObj;
request.result = (ar.exception == null);
+ int phoneId = request.phone.getPhoneId();
//update the cache as modem status has changed
- mPhoneConfigurationManager.addToPhoneStatusCache(
- request.phone.getPhoneId(), msg.arg1 == 1);
- updateModemStateMetrics();
+ if ((boolean) request.result) {
+ mPhoneConfigurationManager.addToPhoneStatusCache(phoneId, msg.arg1 == 1);
+ updateModemStateMetrics();
+ } else {
+ Log.e(LOG_TAG, msg.what + " failure. Not updating modem status."
+ + ar.exception);
+ }
+ notifyRequester(request);
+ break;
+ case CMD_GET_MODEM_STATUS:
+ request = (MainThreadRequest) msg.obj;
+ onCompleted = obtainMessage(EVENT_GET_MODEM_STATUS_DONE, request);
+ PhoneConfigurationManager.getInstance()
+ .getPhoneStatusFromModem(request.phone, onCompleted);
+ break;
+ case EVENT_GET_MODEM_STATUS_DONE:
+ ar = (AsyncResult) msg.obj;
+ request = (MainThreadRequest) ar.userObj;
+ int id = request.phone.getPhoneId();
+ if (ar.exception == null && ar.result != null) {
+ request.result = ar.result;
+ //update the cache as modem status has changed
+ mPhoneConfigurationManager.addToPhoneStatusCache(id,
+ (boolean) request.result);
+ } else {
+ // Return true if modem status cannot be retrieved. For most cases,
+ // modem status is on. And for older version modems, GET_MODEM_STATUS
+ // and disable modem are not supported. Modem is always on.
+ // TODO: this should be fixed in R to support a third
+ // status UNKNOWN b/131631629
+ request.result = true;
+ Log.e(LOG_TAG, msg.what + " failure. Not updating modem status."
+ + ar.exception);
+ }
notifyRequester(request);
break;
default:
@@ -2104,7 +2139,8 @@
return;
}
- final Phone phone = getPhone(subId);
+
+ final Phone phone = getPhoneFromSubId(subId);
if (phone == null) throw new IllegalArgumentException("Invalid Subscription Id: " + subId);
sendRequestAsync(CMD_REQUEST_CELL_INFO_UPDATE, cb, phone, workSource);
@@ -6794,7 +6830,11 @@
final long identity = Binder.clearCallingIdentity();
try {
- return PhoneConfigurationManager.getInstance().getPhoneStatus(phone);
+ try {
+ return mPhoneConfigurationManager.getPhoneStatusFromCache(phone.getPhoneId());
+ } catch (NoSuchElementException ex) {
+ return (Boolean) sendRequest(CMD_GET_MODEM_STATUS, null, phone, null);
+ }
} finally {
Binder.restoreCallingIdentity(identity);
}