[automerger skipped] Merge "Merge mainline-release 6664920 to master - DO NOT MERGE" am: aadd6bf231 am: 32aa2f2167 -s ours am: 90bf8b15e5 -s ours am: 34dc83d318 -s ours
am skip reason: Change-Id I4cd9725b3049dc96a56a723902470fd89501b9f8 with SHA-1 f4a979987e is in history
Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/1429925
Change-Id: Ia8f15ebf15e09ca8148eb5ace30c97fc1cba252e
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index c22a8a4..ecb631e 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5556,11 +5556,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 {
@@ -6350,6 +6352,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;
@@ -6837,6 +6847,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;