Merge "Allow privileged apps to call getUiccCardsInfo" am: 35175b13b0
am: 55b6a78eea
Change-Id: I7b5ef92e9bb096174a853c03838c1145f64c533f
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 33a34e2..ada800b 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6081,9 +6081,15 @@
@Override
public List<UiccCardInfo> getUiccCardsInfo(String callingPackage) {
- if (checkCarrierPrivilegesForPackageAnyPhone(callingPackage)
- != TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
- throw new SecurityException("Caller does not have carrier privileges on any UICC.");
+ try {
+ enforceReadPrivilegedPermission("getUiccCardsInfo");
+ } catch (SecurityException e) {
+ // even without READ_PRIVILEGED_PHONE_STATE, we allow the call to continue if the caller
+ // has carrier privileges on an active UICC
+ if (checkCarrierPrivilegesForPackageAnyPhone(callingPackage)
+ != TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
+ throw new SecurityException("Caller does not have carrier privileges on any UICC");
+ }
}
final long identity = Binder.clearCallingIdentity();