summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicholas Sauer <nicksauer@google.com> 2018-12-20 19:31:03 -0800
committer Nicholas Sauer <nicksauer@google.com> 2019-01-10 05:43:48 +0000
commitfaa877f797c45ec0acaaed8637ec6cfec320daed (patch)
tree267d16cf701c9408ff777f4719ea7d2aaa9e6d6e
parent03e04e83dbb9667ac32af26be6df137bcdda853e (diff)
specialCrossUserGrant should not be false by default for
secondary users. bug: 120913988 Test: adb shell am switch-user 0 cts-tradefed run cts-dev -a arm64-v8a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AppSsts#testPermissionDiffCert adb shell am switch-user 10 cts-tradefed run cts-dev -a arm64-v8a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AppSsts#testPermissionDiffCert Verified continued functionality (See b/120913988#comment4): open a document in quickOffice In the menu, tap share in the disambig dialog, tap Android for work Change-Id: I94960bc91276a2a797df97fa84aa67890582b046
-rw-r--r--services/core/java/com/android/server/uri/UriGrantsManagerService.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/uri/UriGrantsManagerService.java b/services/core/java/com/android/server/uri/UriGrantsManagerService.java
index 9a7e75e548af..744efab7d78d 100644
--- a/services/core/java/com/android/server/uri/UriGrantsManagerService.java
+++ b/services/core/java/com/android/server/uri/UriGrantsManagerService.java
@@ -1129,7 +1129,8 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub {
* In this case, we grant a uri permission, even if the ContentProvider does not normally
* grant uri permissions.
*/
- boolean specialCrossUserGrant = UserHandle.getUserId(targetUid) != grantUri.sourceUserId
+ boolean specialCrossUserGrant = targetUid >= 0
+ && UserHandle.getUserId(targetUid) != grantUri.sourceUserId
&& checkHoldingPermissionsInternal(pm, pi, grantUri, callingUid,
modeFlags, false /*without considering the uid permissions*/);