summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Sharkey <jsharkey@google.com> 2020-06-01 21:22:27 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-06-01 21:22:27 +0000
commit8a0bca43c3d94cac481570466911e0b98ab7519b (patch)
treeec82b5ed7a9c1c62254a9d3a13fab415da45f0df
parent4cdb5ddeb467adc6bd10563d7ed03000faf2c3f4 (diff)
parent14c5c4d9974af798bbad6a6d5a5530f1c1f62d95 (diff)
Merge changes from topic "jun1" into rvc-dev
* changes: Flip ENABLE_DYNAMIC_PERMISSIONS, attempt #4. Remove thread delegation when checking grants.
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java26
-rw-r--r--services/core/java/com/android/server/uri/UriGrantsManagerService.java2
2 files changed, 3 insertions, 25 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index a4e45cd334bf..caaa8371af53 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -18900,30 +18900,8 @@ public class ActivityManagerService extends IActivityManager.Stub
@Override
public int checkContentProviderUriPermission(Uri uri, int userId,
int callingUid, int modeFlags) {
- // We can find ourselves needing to check Uri permissions while
- // already holding the WM lock, which means reaching back here for
- // the AM lock would cause an inversion. The WM team has requested
- // that we use the strategy below instead of shifting where Uri
- // grants are calculated.
-
- // Since we could also arrive here while holding the AM lock, we
- // can't always delegate the call through the handler, and we need
- // to delicately dance between the deadlocks.
- if (Thread.currentThread().holdsLock(ActivityManagerService.this)) {
- return ActivityManagerService.this.checkContentProviderUriPermission(uri,
- userId, callingUid, modeFlags);
- } else {
- final CompletableFuture<Integer> res = new CompletableFuture<>();
- mHandler.post(() -> {
- res.complete(ActivityManagerService.this.checkContentProviderUriPermission(uri,
- userId, callingUid, modeFlags));
- });
- try {
- return res.get();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }
+ return ActivityManagerService.this.checkContentProviderUriPermission(uri,
+ userId, callingUid, modeFlags);
}
@Override
diff --git a/services/core/java/com/android/server/uri/UriGrantsManagerService.java b/services/core/java/com/android/server/uri/UriGrantsManagerService.java
index 9476e9260c73..3796c5fda411 100644
--- a/services/core/java/com/android/server/uri/UriGrantsManagerService.java
+++ b/services/core/java/com/android/server/uri/UriGrantsManagerService.java
@@ -114,7 +114,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 = 128;
- private static final boolean ENABLE_DYNAMIC_PERMISSIONS = false;
+ private static final boolean ENABLE_DYNAMIC_PERMISSIONS = true;
private final Object mLock = new Object();
private final H mH;