From d781a45cfe69cb3beda161680f7f56a4bc747f8b Mon Sep 17 00:00:00 2001 From: Corina Grigoras Date: Mon, 23 Nov 2020 09:50:14 +0000 Subject: [PATCH] DO NOT MERGE: Disable ENABLE_DYNAMIC_PERMISSIONS without helper method. This includes reverting "DO NOT MERGE: Disable ENABLE_DYNAMIC_PERMISSIONS flag for now to avoid crashes.", commit 39150a7422c2134364113034adf93b9257a25917. Reason for revert: Be able to follow up with a clean patch that enables this flag using the helper method. Bug: 115619667 Test: No Change-Id: I930964259572cc8c145b82d84928fbf02fc0a19e --- .../server/uri/UriGrantsManagerService.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/services/core/java/com/android/server/uri/UriGrantsManagerService.java b/services/core/java/com/android/server/uri/UriGrantsManagerService.java index 32ff310a24433..8eefd8fa4a91d 100644 --- a/services/core/java/com/android/server/uri/UriGrantsManagerService.java +++ b/services/core/java/com/android/server/uri/UriGrantsManagerService.java @@ -115,7 +115,7 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub { private static final String TAG = "UriGrantsManagerService"; // Maximum number of persisted Uri grants a package is allowed private static final int MAX_PERSISTED_URI_GRANTS = 512; - private static final boolean ENABLE_DYNAMIC_PERMISSIONS = true; + private static final boolean ENABLE_DYNAMIC_PERMISSIONS = false; private final Object mLock = new Object(); private final H mH; @@ -991,9 +991,7 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub { // If this provider says that grants are always required, we need to // consult it directly to determine if the UID has permission final boolean forceMet; - if (ENABLE_DYNAMIC_PERMISSIONS - && pi.forceUriPermissions - && isDynamicPermissionEnabledInMP()) { + if (ENABLE_DYNAMIC_PERMISSIONS && pi.forceUriPermissions) { final int providerUserId = UserHandle.getUserId(pi.applicationInfo.uid); final int clientUserId = UserHandle.getUserId(uid); if (providerUserId == clientUserId) { @@ -1011,15 +1009,6 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub { return readMet && writeMet && forceMet; } - /** - * Returns true if the available MediaProvider version contains the changes that enable dynamic - * permission. - */ - private boolean isDynamicPermissionEnabledInMP() { - // TODO(b/159995598) Check MediaProvider version. - return false; - } - @GuardedBy("mLock") private void removeUriPermissionIfNeededLocked(UriPermission perm) { if (perm.modeFlags != 0) {