From 33284ae04901727bd603721e8877f617fe4640fb Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Fri, 8 Oct 2021 17:42:49 +0000 Subject: [PATCH] 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 --- .../android/internal/telephony/TelephonyPermissions.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java index 7a424c87d1d64..10fba60d4c95f 100644 --- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java +++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java @@ -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) {