getUicc{Card, Slot}sInfo should work with carrier privileges
Both the interfaces ask either READ_PRIVILEGED_PHONE_STATE
or carrier privileges. ag/16665093 introduced the bug that
READ_PRIVILEGED_PHONE_STATE was enforced for the interfaces.
Method checkCarrierPrivilegesForPackageAnyPhoneWithPermission
is introduced to allow the above interfaces to query Uicc info
with carrier privileges only.
Bug: 220355025
Test: atest android.telephony.cts.TelephonyManagerTest
Change-Id: Ia774121e020e44028ee65545eab9c1181ed8a4c9
Merged-In: Ia774121e020e44028ee65545eab9c1181ed8a4c9
(cherry picked from commit e7209ce515f8f26744d9b536265d0c92ce86c3f4)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index a94efa8..7167e44 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6743,6 +6743,10 @@
@Override
public int checkCarrierPrivilegesForPackageAnyPhone(String pkgName) {
enforceReadPrivilegedPermission("checkCarrierPrivilegesForPackageAnyPhone");
+ return checkCarrierPrivilegesForPackageAnyPhoneWithPermission(pkgName);
+ }
+
+ private int checkCarrierPrivilegesForPackageAnyPhoneWithPermission(String pkgName) {
if (TextUtils.isEmpty(pkgName)) {
return TelephonyManager.CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
}
@@ -8638,7 +8642,7 @@
} 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)
+ if (checkCarrierPrivilegesForPackageAnyPhoneWithPermission(callingPackage)
!= TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
throw new SecurityException("Caller does not have permission.");
}
@@ -8756,7 +8760,7 @@
} 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)
+ if (checkCarrierPrivilegesForPackageAnyPhoneWithPermission(callingPackage)
== TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
hasReadPermission = true;
}