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

Commit 32da1731 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Pass correct end-of-drag position to desktop>fullscreen transition handler.

Before this CL the position of the task at the start of the
desktop->fullscreen animation was slightly off.

Bug: 318667068
Test: manual
Flag: com.android.window.flags.enable_desktop_windowing_mode
Change-Id: I3ae1723e76616936701afe75cc897c17273e7763
parent 4b45f29b
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -2508,7 +2508,6 @@ class DesktopTasksController(
     *
     * @param taskInfo the task being dragged.
     * @param taskSurface the leash of the task being dragged.
     * @param position position of surface when drag ends.
     * @param inputCoordinate the coordinates of the motion event
     * @param currentDragBounds the current bounds of where the visible task is (might be actual
     *   task bounds or just task leash)
@@ -2518,7 +2517,6 @@ class DesktopTasksController(
    fun onDragPositioningEnd(
        taskInfo: RunningTaskInfo,
        taskSurface: SurfaceControl,
        position: Point,
        inputCoordinate: PointF,
        currentDragBounds: Rect,
        validDragArea: Rect,
@@ -2546,7 +2544,7 @@ class DesktopTasksController(
                    )
                    moveToFullscreenWithAnimation(
                        taskInfo,
                        position,
                        Point(currentDragBounds.left, currentDragBounds.top),
                        DesktopModeTransitionSource.TASK_DRAG,
                    )
                }
+1 −7
Original line number Diff line number Diff line
@@ -1225,12 +1225,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                        mDragPointerId = e.getPointerId(0);
                    }
                    final int dragPointerIdx = e.findPointerIndex(mDragPointerId);
                    // Position of the task is calculated by subtracting the raw location of the
                    // motion event (the location of the motion relative to the display) by the
                    // location of the motion event relative to the task's bounds
                    final Point position = new Point(
                            (int) (e.getRawX(dragPointerIdx) - e.getX(dragPointerIdx)),
                            (int) (e.getRawY(dragPointerIdx) - e.getY(dragPointerIdx)));
                    final Rect newTaskBounds = mDragPositioningCallback.onDragPositioningEnd(
                            e.getDisplayId(),
                            e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx));
@@ -1238,7 +1232,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                    // DesktopTasksController to allow secondary transformations (i.e. snap resizing
                    // or transforming to fullscreen) before setting new task bounds.
                    mDesktopTasksController.onDragPositioningEnd(
                            taskInfo, decoration.mTaskSurface, position,
                            taskInfo, decoration.mTaskSurface,
                            new PointF(e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx)),
                            newTaskBounds, decoration.calculateValidDragArea(),
                            new Rect(mOnDragStartInitialBounds), e,
+0 −6
Original line number Diff line number Diff line
@@ -3686,7 +3686,6 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        spyController.onDragPositioningEnd(
            task,
            mockSurface,
            position = Point(100, -100),
            inputCoordinate = PointF(200f, -200f),
            currentDragBounds = Rect(100, -100, 500, 1000),
            validDragArea = Rect(0, 50, 2000, 2000),
@@ -3725,7 +3724,6 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        spyController.onDragPositioningEnd(
            task,
            mockSurface,
            position = Point(100, 200),
            inputCoordinate = PointF(200f, 300f),
            currentDragBounds = currentDragBounds,
            validDragArea = Rect(0, 50, 2000, 2000),
@@ -3766,7 +3764,6 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        spyController.onDragPositioningEnd(
            task,
            mockSurface,
            position = Point(100, 200),
            inputCoordinate = PointF(200f, 300f),
            currentDragBounds,
            validDragArea = Rect(0, 50, 2000, 2000),
@@ -3808,7 +3805,6 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        spyController.onDragPositioningEnd(
            task,
            mockSurface,
            position = Point(100, 50),
            inputCoordinate = PointF(200f, 300f),
            currentDragBounds = Rect(100, 50, 500, 1000),
            validDragArea = Rect(0, 50, 2000, 2000),
@@ -3847,7 +3843,6 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        spyController.onDragPositioningEnd(
            task,
            mockSurface,
            position = Point(100, 50),
            inputCoordinate = PointF(200f, 300f),
            currentDragBounds,
            validDragArea = Rect(0, 50, 2000, 2000),
@@ -3904,7 +3899,6 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        spyController.onDragPositioningEnd(
            task,
            mockSurface,
            position = Point(100, 50),
            inputCoordinate = PointF(200f, 300f),
            currentDragBounds = currentDragBounds,
            validDragArea = Rect(0, 50, 2000, 2000),