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

Commit de5b073b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents b6670ad8 da88348f
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line 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) {
    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 String name = uri.getAuthority();
        final long ident = Binder.clearCallingIdentity();
        final long ident = Binder.clearCallingIdentity();
        ContentProviderHolder holder = null;
        ContentProviderHolder holder = null;
+3 −6
Original line number Original line Diff line number Diff line
@@ -640,13 +640,10 @@ class ActivityStarter {
            }
            }


            // If the caller hasn't already resolved the activity, we're willing
            // 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
            // to do so here. If the caller is already holding the WM lock here,
            // as part of calculating the NeededUriGrants, we must never hold
            // and we need to check dynamic Uri permissions, then we're forced
            // the WM lock here to avoid deadlocking.
            // to assume those permissions are denied to avoid deadlocking.
            if (mRequest.activityInfo == null) {
            if (mRequest.activityInfo == null) {
                if (Thread.holdsLock(mService.mGlobalLock)) {
                    Slog.wtf(TAG, new IllegalStateException("Caller must not hold WM lock"));
                }
                mRequest.resolveActivity(mSupervisor);
                mRequest.resolveActivity(mSupervisor);
            }
            }