Make drag window a trusted overlay

We added new functionality to pilferPointers API in ag/18234604.
Using it we can extend the functionality of drag and drop to
allow user to interact with the UI while using 1 pointer/finger
to drag.
DD: go/global_drag_and_drop

Bug: 220109830

Test: atest inputflinger_tests
Change-Id: Ieb890ce71c938b4f8c6b0256fe14887b9e3968d1
This commit is contained in:
Vaibhav Devmurari
2022-06-06 10:01:43 +00:00
parent 8ef7dc586f
commit bb7ab58648

View File

@@ -367,10 +367,15 @@ class DragState {
mDragWindowHandle.ownerUid = MY_UID;
mDragWindowHandle.scaleFactor = 1.0f;
// Keep the default behavior of this window to be focusable, which allows the system
// to consume keys when dragging is active. This can also be used to modify the drag
// state on key press. For example, cancel drag on escape key.
mDragWindowHandle.inputConfig = InputConfig.PREVENT_SPLITTING;
// InputConfig.PREVENT_SPLITTING: To keep the default behavior of this window to be
// focusable, which allows the system to consume keys when dragging is active. This can
// also be used to modify the drag state on key press. For example, cancel drag on
// escape key.
// InputConfig.TRUSTED_OVERLAY: To not block any touches while D&D ongoing and allowing
// touches to pass through to windows underneath. This allows user to interact with the
// UI to navigate while dragging.
mDragWindowHandle.inputConfig =
InputConfig.PREVENT_SPLITTING | InputConfig.TRUSTED_OVERLAY;
// The drag window cannot receive new touches.
mDragWindowHandle.touchableRegion.setEmpty();