summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java6
-rw-r--r--services/core/java/com/android/server/wm/ActivityStarter.java9
2 files changed, 9 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index e77b361c8c06..c9dbacda368c 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -8086,6 +8086,12 @@ public class ActivityManagerService extends IActivityManager.Stub
}
int checkContentProviderUriPermission(Uri uri, int userId, int callingUid, int modeFlags) {
+ if (Thread.holdsLock(mActivityTaskManager.getGlobalLock())) {
+ Slog.wtf(TAG, new IllegalStateException("Unable to check Uri permission"
+ + " because caller is holding WM lock; assuming permission denied"));
+ return PackageManager.PERMISSION_DENIED;
+ }
+
final String name = uri.getAuthority();
final long ident = Binder.clearCallingIdentity();
ContentProviderHolder holder = null;
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 31712ef85add..b3786212ea72 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -640,13 +640,10 @@ class ActivityStarter {
}
// If the caller hasn't already resolved the activity, we're willing
- // to do so here, but because that may require acquiring the AM lock
- // as part of calculating the NeededUriGrants, we must never hold
- // the WM lock here to avoid deadlocking.
+ // to do so here. If the caller is already holding the WM lock here,
+ // and we need to check dynamic Uri permissions, then we're forced
+ // to assume those permissions are denied to avoid deadlocking.
if (mRequest.activityInfo == null) {
- if (Thread.holdsLock(mService.mGlobalLock)) {
- Slog.wtf(TAG, new IllegalStateException("Caller must not hold WM lock"));
- }
mRequest.resolveActivity(mSupervisor);
}