Fix wrong coordinate for DRAG_STARTED

We should translate touch (x, y) to window coordinate.

Bug: 198531521
Test: atest DragDropTest
Change-Id: Ib0521dbc45eae2462c73d597d2ce89b75c56f205
This commit is contained in:
Arthur Hung
2021-09-14 08:01:58 +00:00
parent ae5181cd41
commit c2f08d83da

View File

@@ -464,7 +464,8 @@ class DragState {
if (mDragInProgress && isValidDropTarget(newWin, containsAppExtras, interceptsGlobalDrag)) {
// Only allow the extras to be dispatched to a global-intercepting drag target
ClipData data = interceptsGlobalDrag ? mData.copyForTransferWithActivityInfo() : null;
DragEvent event = obtainDragEvent(DragEvent.ACTION_DRAG_STARTED, touchX, touchY,
DragEvent event = obtainDragEvent(DragEvent.ACTION_DRAG_STARTED,
newWin.translateToWindowX(touchX), newWin.translateToWindowY(touchY),
data, false /* includeDragSurface */,
null /* dragAndDropPermission */);
try {