diff options
author | Nazanin Bakhshi <nazaninb@google.com> | 2019-06-27 17:11:50 -0700 |
---|---|---|
committer | Nazanin Bakhshi <nazaninb@google.com> | 2019-07-03 15:33:05 -0700 |
commit | df0177f979a4f5ca82f302bc00aab03f417432b8 (patch) | |
tree | a13545021b72c2468c2e27378d8ff3e1ca232814 | |
parent | cbe76eeced93beb75e951cb2d2815112af48f1b8 (diff) | |
download | telephony-android10-dev.tar.gz |
Clear and restore callingIdentity for getSubscriberIdandroid10-dev
to be able to call isActiveSubId with permission checks
Bug: 136062407
Test: ran failing cts test module CtsAppSecurityHostTestCases
Change-Id: I1b64b985aac1eccb489d2205da3b3bcaea3d2509
-rw-r--r-- | src/java/com/android/internal/telephony/PhoneSubInfoController.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/java/com/android/internal/telephony/PhoneSubInfoController.java b/src/java/com/android/internal/telephony/PhoneSubInfoController.java index d655468104..c5b7edafc2 100644 --- a/src/java/com/android/internal/telephony/PhoneSubInfoController.java +++ b/src/java/com/android/internal/telephony/PhoneSubInfoController.java @@ -126,7 +126,14 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub { public String getSubscriberIdForSubscriber(int subId, String callingPackage) { String message = "getSubscriberId"; - if (SubscriptionController.getInstance().isActiveSubId(subId, callingPackage)) { + long identity = Binder.clearCallingIdentity(); + boolean isActive; + try { + isActive = SubscriptionController.getInstance().isActiveSubId(subId, callingPackage); + } finally { + Binder.restoreCallingIdentity(identity); + } + if (isActive) { return callPhoneMethodForSubIdWithReadSubscriberIdentifiersCheck(subId, callingPackage, message, (phone) -> phone.getSubscriberId()); } else { @@ -134,7 +141,7 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub { mContext, subId, callingPackage, message)) { return null; } - final long identity = Binder.clearCallingIdentity(); + identity = Binder.clearCallingIdentity(); try { return SubscriptionController.getInstance().getImsiPrivileged(subId); } finally { |