Merge "Consider roaming state before promoting WFC" am: a5b4bddce6 am: 4fd554113c am: 1760e20ac7
Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/1494659
Change-Id: I57b16eecf0ded3ff941a467c0b23dcdd5f09ea12
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 4ee4141..e5e8de1 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5744,11 +5744,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 {
@@ -6633,6 +6635,14 @@
@Override
public int getRadioAccessFamily(int phoneId, String callingPackage) {
Phone phone = PhoneFactory.getPhone(phoneId);
+ try {
+ TelephonyPermissions
+ .enforeceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege(
+ mApp, phone.getSubId(), "getRadioAccessFamily");
+ } catch (SecurityException e) {
+ EventLog.writeEvent(0x534e4554, "150857259", -1, "Missing Permission");
+ throw e;
+ }
int raf = RadioAccessFamily.RAF_UNKNOWN;
if (phone == null) {
return raf;
@@ -7121,6 +7131,13 @@
final long identity = Binder.clearCallingIdentity();
try {
+ // isActiveSubId requires READ_PHONE_STATE, which we already check for above
+ if (!mSubscriptionController.isActiveSubId(subId, callingPackage, callingFeatureId)) {
+ Rlog.d(LOG_TAG,
+ "getServiceStateForSubscriber returning null for inactive subId=" + subId);
+ return null;
+ }
+
final Phone phone = getPhone(subId);
if (phone == null) {
return null;
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index 377b471..b6d5d3e 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -289,7 +289,7 @@
}
if (((ImsPhoneConnection) connection).isIncomingCallAutoRejected()) {
extras.putString(TelecomManager.EXTRA_CALL_DISCONNECT_MESSAGE,
- "Call Dropped by lower layers");
+ TelecomManager.CALL_AUTO_DISCONNECT_MESSAGE_STRING);
}
}
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 322993a..f98198b 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -1190,15 +1190,23 @@
"Phone is null"));
}
+ Bundle extras = request.getExtras();
+ String disconnectMessage = null;
+ if (extras.containsKey(TelecomManager.EXTRA_CALL_DISCONNECT_MESSAGE)) {
+ disconnectMessage = extras.getString(TelecomManager.EXTRA_CALL_DISCONNECT_MESSAGE);
+ Log.i(this, "onCreateIncomingConnection Disconnect message " + disconnectMessage);
+ }
+
Call call = phone.getRingingCall();
- if (!call.getState().isRinging()) {
+ if (!call.getState().isRinging()
+ || (disconnectMessage != null
+ && disconnectMessage.equals(TelecomManager.CALL_AUTO_DISCONNECT_MESSAGE_STRING))) {
Log.i(this, "onCreateIncomingConnection, no ringing call");
Connection connection = Connection.createFailedConnection(
mDisconnectCauseFactory.toTelecomDisconnectCause(
android.telephony.DisconnectCause.INCOMING_MISSED,
"Found no ringing call",
phone.getPhoneId()));
- Bundle extras = request.getExtras();
long time = extras.getLong(TelecomManager.EXTRA_CALL_CREATED_EPOCH_TIME_MILLIS);
if (time != 0) {