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

Commit 467b1858 authored by Winson Chung's avatar Winson Chung
Browse files

Use provided calling uid/pid for checking intercept-global-drag flag

- This particular path can not rely on ActivityTaskManagerService's
  enforceTaskPermission() call since that uses the binder calling
  uid/pid, which has been cleared prior to calling
  validateAddingWindowLw().

Bug: 428700812
Flag: EXEMPT bugfix
Test: atest DragDropControllerTests
Change-Id: I768dd22b9b107235cce60ffcc0e796d6a536b91d
parent 5a077e1a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1098,7 +1098,9 @@ public class DisplayPolicy {
                    "DisplayPolicy");
        }
        if ((attrs.privateFlags & PRIVATE_FLAG_INTERCEPT_GLOBAL_DRAG_AND_DROP) != 0) {
            ActivityTaskManagerService.enforceTaskPermission("DisplayPolicy");
            mContext.enforcePermission(
                    android.Manifest.permission.MANAGE_ACTIVITY_TASKS, callingPid, callingUid,
                    "DisplayPolicy");
        }

        final String systemUiPermission =
+2 −1
Original line number Diff line number Diff line
@@ -260,7 +260,8 @@ public class DragDropControllerTests extends WindowTestsBase {
        attrs.privateFlags |= PRIVATE_FLAG_INTERCEPT_GLOBAL_DRAG_AND_DROP;
        policy.validateAddingWindowLw(attrs, Binder.getCallingPid(), Binder.getCallingUid());

        verify(mWm.mAtmService).enforceTaskPermission(any());
        verify(mWm.mContext).enforcePermission(
                eq(android.Manifest.permission.MANAGE_ACTIVITY_TASKS), anyInt(), anyInt(), any());
    }

    @Test