Enforce MODIFY_PHONE_STATE or CarrierPrivilege permission for TelephonyManager#setForbiddenPlmns() API am: 5b0d75adc4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telephony/+/16106037
Change-Id: I1c4d7b85e172b00a273964e8cf21546fa5170452
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e97f0bf..6b20539 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5522,11 +5522,9 @@
*/
public int setForbiddenPlmns(int subId, int appType, List<String> fplmns, String callingPackage,
String callingFeatureId) {
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, subId, callingPackage,
- callingFeatureId, "setForbiddenPlmns")) {
- if (DBG) logv("no permissions for setForbiddenplmns");
- throw new IllegalStateException("No Permissions for setForbiddenPlmns");
- }
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setForbiddenPlmns");
+
if (appType != TelephonyManager.APPTYPE_USIM && appType != TelephonyManager.APPTYPE_SIM) {
loge("setForbiddenPlmnList(): App Type must be USIM or SIM");
throw new IllegalArgumentException("Invalid appType: App Type must be USIM or SIM");