use phone permission to access active subscription info

use phone permission to access active subscription info

Bug: 188553890
Test: ran unit test
Change-Id: I095591934b5473d0b335e863e978da3db800f03e
This commit is contained in:
Sooraj Sasindran
2021-10-08 17:42:49 +00:00
parent 1de79d89a4
commit 33284ae049

View File

@@ -650,7 +650,13 @@ public final class TelephonyPermissions {
private static boolean checkCarrierPrivilegeForAnySubId(Context context, int uid) {
SubscriptionManager sm = (SubscriptionManager) context.getSystemService(
Context.TELEPHONY_SUBSCRIPTION_SERVICE);
int[] activeSubIds = sm.getCompleteActiveSubscriptionIdList();
int[] activeSubIds;
final long identity = Binder.clearCallingIdentity();
try {
activeSubIds = sm.getCompleteActiveSubscriptionIdList();
} finally {
Binder.restoreCallingIdentity(identity);
}
for (int activeSubId : activeSubIds) {
if (getCarrierPrivilegeStatus(context, activeSubId, uid)
== TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {