summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2016-11-21 20:29:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-11-21 20:29:04 +0000
commit78d6e340e1bccc2db7726192d1687d6cf1208cfc (patch)
tree18fe36e97682afaf7af69c5d6c71aa14699566f0
parent76932df9ec7f7c2a18f9d899767846c8d7ede4fc (diff)
parent2dfe92c2dfbaddd69dabe6e43ab77c4c204c4065 (diff)
Merge "No direct Uri grants from system."
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f892e52960f2..8bd75067bb94 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -8103,7 +8103,12 @@ public class ActivityManagerService extends IActivityManager.Stub
// Third... does the caller itself have permission to access
// this uri?
- if (UserHandle.getAppId(callingUid) != Process.SYSTEM_UID) {
+ final int callingAppId = UserHandle.getAppId(callingUid);
+ if ((callingAppId == Process.SYSTEM_UID) || (callingAppId == Process.ROOT_UID)) {
+ Slog.w(TAG, "For security reasons, the system cannot issue a Uri permission"
+ + " grant to " + grantUri + "; use startActivityAsCaller() instead");
+ return -1;
+ } else {
if (!checkHoldingPermissionsLocked(pm, pi, grantUri, callingUid, modeFlags)) {
// Require they hold a strong enough Uri permission
if (!checkUriPermissionLocked(grantUri, callingUid, modeFlags)) {