Loading services/core/java/com/android/server/am/ActivityManagerService.java +2 −24 Original line number Diff line number Diff line Loading @@ -18956,30 +18956,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); } } } @Override services/core/java/com/android/server/uri/UriGrantsManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +2 −24 Original line number Diff line number Diff line Loading @@ -18956,30 +18956,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); } } } @Override
services/core/java/com/android/server/uri/UriGrantsManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; Loading