DO NOT MERGE - Merge Android R QPR1
Bug: 172690556
Merged-In: I352101d8fd2d8815109498778ba9417becbe98cb
Change-Id: Ia4eb9ba60ede2c4a6c3a7305ea46a692c8d95001
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2834845..4910884 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5881,11 +5881,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 {
@@ -6790,6 +6792,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;
@@ -7278,6 +7288,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;