diff options
author | Amit Mahajan <amitmahajan@google.com> | 2015-07-14 10:26:00 -0700 |
---|---|---|
committer | Amit Mahajan <amitmahajan@google.com> | 2015-07-14 10:26:00 -0700 |
commit | 7c5befa4a7ccd6e7e91ffdd93264b717259ec863 (patch) | |
tree | 33fb9c00d0fb27b383875812f0a0aa58271314b0 /services/core/java | |
parent | 1cfd45701bca2be5ddabf9d523c8183a482fee00 (diff) | |
download | frameworks_base-7c5befa4a7ccd6e7e91ffdd93264b717259ec863.zip frameworks_base-7c5befa4a7ccd6e7e91ffdd93264b717259ec863.tar.gz frameworks_base-7c5befa4a7ccd6e7e91ffdd93264b717259ec863.tar.bz2 |
Add checks for READ_PRIVILEGED_PHONE_STATE.
Callers will have either PRIVILEGED or regular READ_PHONE_STATE.
Bug: 22468536
Change-Id: I60251f61250a975f4147b027d2539824a728e3b5
Diffstat (limited to 'services/core/java')
-rw-r--r-- | services/core/java/com/android/server/net/NetworkPolicyManagerService.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index f618c3e..f8f00ef 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -22,6 +22,7 @@ import static android.Manifest.permission.DUMP; import static android.Manifest.permission.MANAGE_NETWORK_POLICY; import static android.Manifest.permission.READ_NETWORK_USAGE_HISTORY; import static android.Manifest.permission.READ_PHONE_STATE; +import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE; import static android.content.Intent.ACTION_PACKAGE_ADDED; import static android.content.Intent.ACTION_UID_REMOVED; import static android.content.Intent.ACTION_USER_ADDED; @@ -1651,11 +1652,16 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { @Override public NetworkPolicy[] getNetworkPolicies(String callingPackage) { mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG); - mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, TAG); + try { + mContext.enforceCallingPermission(READ_PRIVILEGED_PHONE_STATE, TAG); + // SKIP checking run-time OP_READ_PHONE_STATE since using PRIVILEGED + } catch (SecurityException e) { + mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, TAG); - if (mAppOps.noteOp(AppOpsManager.OP_READ_PHONE_STATE, Binder.getCallingUid(), - callingPackage) != AppOpsManager.MODE_ALLOWED) { - return new NetworkPolicy[0]; + if (mAppOps.noteOp(AppOpsManager.OP_READ_PHONE_STATE, Binder.getCallingUid(), + callingPackage) != AppOpsManager.MODE_ALLOWED) { + return new NetworkPolicy[0]; + } } synchronized (mRulesLock) { |