summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-09-13 03:05:22 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-13 03:05:22 +0000
commite45528be5607fc12ed3790f41cf9a5e6007145b6 (patch)
treefafc9bb268616bcc2e50d35702e0a49b38902678
parent02b2c83c8d455972aae0bda2755aef6323cf14a0 (diff)
parent1b7e58f748bcd685fc02a78c1acb7687f38ddc24 (diff)
downloadframeworks_base-e45528be5607fc12ed3790f41cf9a5e6007145b6.zip
frameworks_base-e45528be5607fc12ed3790f41cf9a5e6007145b6.tar.gz
frameworks_base-e45528be5607fc12ed3790f41cf9a5e6007145b6.tar.bz2
am 954dd68b: am 7da811c2: am 8b01fb7e: Merge "Fix issue #17479850: AppOpsManager.checkPackage() allows..." into lmp-dev
* commit '954dd68b1b3744756bb71a8016c325354338a98e': Fix issue #17479850: AppOpsManager.checkPackage() allows...
-rw-r--r--services/core/java/com/android/server/AppOpsService.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java
index ef6e07c..c3465d1 100644
--- a/services/core/java/com/android/server/AppOpsService.java
+++ b/services/core/java/com/android/server/AppOpsService.java
@@ -631,7 +631,7 @@ public class AppOpsService extends IAppOpsService.Stub {
@Override
public int checkPackage(int uid, String packageName) {
synchronized (this) {
- if (getOpsLocked(uid, packageName, true) != null) {
+ if (getOpsRawLocked(uid, packageName, true) != null) {
return AppOpsManager.MODE_ALLOWED;
} else {
return AppOpsManager.MODE_ERRORED;
@@ -769,6 +769,15 @@ public class AppOpsService extends IAppOpsService.Stub {
}
private Ops getOpsLocked(int uid, String packageName, boolean edit) {
+ if (uid == 0) {
+ packageName = "root";
+ } else if (uid == Process.SHELL_UID) {
+ packageName = "com.android.shell";
+ }
+ return getOpsRawLocked(uid, packageName, edit);
+ }
+
+ private Ops getOpsRawLocked(int uid, String packageName, boolean edit) {
HashMap<String, Ops> pkgOps = mUidOps.get(uid);
if (pkgOps == null) {
if (!edit) {
@@ -777,11 +786,6 @@ public class AppOpsService extends IAppOpsService.Stub {
pkgOps = new HashMap<String, Ops>();
mUidOps.put(uid, pkgOps);
}
- if (uid == 0) {
- packageName = "root";
- } else if (uid == Process.SHELL_UID) {
- packageName = "com.android.shell";
- }
Ops ops = pkgOps.get(packageName);
if (ops == null) {
if (!edit) {