diff options
author | Amit Mahajan <amitmahajan@google.com> | 2015-07-14 18:12:59 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-07-14 18:12:59 +0000 |
commit | 336f18ba2873935c892b693509d5ae7c7696aeb9 (patch) | |
tree | 0317e3e9a44b3e0a0961b401ccd91473d2bc6188 /services | |
parent | 5086a970e786ac4629f5f275a5df25f6e24e1f61 (diff) | |
parent | 51b4e97ae42fb789b7d1c9d4134ddaa7e2b27b11 (diff) | |
download | frameworks_base-336f18ba2873935c892b693509d5ae7c7696aeb9.zip frameworks_base-336f18ba2873935c892b693509d5ae7c7696aeb9.tar.gz frameworks_base-336f18ba2873935c892b693509d5ae7c7696aeb9.tar.bz2 |
am 51b4e97a: Merge "Add checks for READ_PRIVILEGED_PHONE_STATE." into mnc-dev
* commit '51b4e97ae42fb789b7d1c9d4134ddaa7e2b27b11':
Add checks for READ_PRIVILEGED_PHONE_STATE.
Diffstat (limited to 'services')
-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) { |