Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bfc538c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Nuanced Uri handling related to WM/AM locking." into rvc-dev am: de5b073b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12010084

Change-Id: I92dfcaa9044c4c2b662cc34c40ca7c1fd02233f4
parents 8cd4094d de5b073b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
+3 −6
Original line number Diff line number Diff line
@@ -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);
            }