summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java4
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java4
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallback.java11
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java7
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt53
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java6
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java6
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt6
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecoratorTests.kt59
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt63
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt24
11 files changed, 165 insertions, 78 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java
index 0b919668f7fe..792f5cad3418 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java
@@ -468,7 +468,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel, FocusT
case MotionEvent.ACTION_DOWN: {
mDragPointerId = e.getPointerId(0);
mDragPositioningCallback.onDragPositioningStart(
- 0 /* ctrlType */, e.getRawX(0), e.getRawY(0));
+ 0 /* ctrlType */, e.getDisplayId(), e.getRawX(0), e.getRawY(0));
mIsDragging = false;
return false;
}
@@ -481,6 +481,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel, FocusT
if (decoration.isHandlingDragResize()) break;
final int dragPointerIdx = e.findPointerIndex(mDragPointerId);
mDragPositioningCallback.onDragPositioningMove(
+ e.getDisplayId(),
e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx));
mIsDragging = true;
return true;
@@ -492,6 +493,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel, FocusT
}
final int dragPointerIdx = e.findPointerIndex(mDragPointerId);
final Rect newTaskBounds = mDragPositioningCallback.onDragPositioningEnd(
+ e.getDisplayId(),
e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx));
DragPositioningCallbackUtility.snapTaskBoundsIfNecessary(newTaskBounds,
mWindowDecorByTaskId.get(mTaskId).calculateValidDragArea());
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
index 5a05861c3a88..7928e5ed4188 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
@@ -1140,7 +1140,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
if (dragAllowed) {
mDragPointerId = e.getPointerId(0);
final Rect initialBounds = mDragPositioningCallback.onDragPositioningStart(
- 0 /* ctrlType */, e.getRawX(0),
+ 0 /* ctrlType */, e.getDisplayId(), e.getRawX(0),
e.getRawY(0));
updateDragStatus(e.getActionMasked());
mOnDragStartInitialBounds.set(initialBounds);
@@ -1161,6 +1161,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
}
final int dragPointerIdx = e.findPointerIndex(mDragPointerId);
final Rect newTaskBounds = mDragPositioningCallback.onDragPositioningMove(
+ e.getDisplayId(),
e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx));
mDesktopTasksController.onDragPositioningMove(taskInfo,
decoration.mTaskSurface,
@@ -1191,6 +1192,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
(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));
// Tasks bounds haven't actually been updated (only its leash), so pass to
// DesktopTasksController to allow secondary transformations (i.e. snap resizing
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallback.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallback.java
index 421ffd929fb2..3eebdb048f0d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallback.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallback.java
@@ -41,25 +41,30 @@ public interface DragPositioningCallback {
*
* @param ctrlType {@link CtrlType} indicating the direction of resizing, use
* {@code 0} to indicate it's a move
+ * @param displayId the ID of the display where the drag starts
* @param x x coordinate in window decoration coordinate system where the drag starts
* @param y y coordinate in window decoration coordinate system where the drag starts
* @return the starting task bounds
*/
- Rect onDragPositioningStart(@CtrlType int ctrlType, float x, float y);
+ Rect onDragPositioningStart(@CtrlType int ctrlType, int displayId, float x, float y);
/**
* Called when the pointer moves during a drag-resize or drag-move.
+ *
+ * @param displayId the ID of the display where the pointer is currently located
* @param x x coordinate in window decoration coordinate system of the new pointer location
* @param y y coordinate in window decoration coordinate system of the new pointer location
* @return the updated task bounds
*/
- Rect onDragPositioningMove(float x, float y);
+ Rect onDragPositioningMove(int displayId, float x, float y);
/**
* Called when a drag-resize or drag-move stops.
+ *
+ * @param displayId the ID of the display where the pointer is located when drag stops
* @param x x coordinate in window decoration coordinate system where the drag resize stops
* @param y y coordinate in window decoration coordinate system where the drag resize stops
* @return the final bounds for the dragged task
*/
- Rect onDragPositioningEnd(float x, float y);
+ Rect onDragPositioningEnd(int displayId, float x, float y);
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java
index a6d503d0d991..7d1471f44674 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java
@@ -454,7 +454,7 @@ class DragResizeInputListener implements AutoCloseable {
ProtoLog.d(WM_SHELL_DESKTOP_MODE,
"%s: Handling action down, update ctrlType to %d", TAG, ctrlType);
mDragStartTaskBounds = mCallback.onDragPositioningStart(ctrlType,
- rawX, rawY);
+ e.getDisplayId(), rawX, rawY);
mLastMotionEventOnDown = e;
mResizeTrigger = (ctrlType == CTRL_TYPE_BOTTOM || ctrlType == CTRL_TYPE_TOP
|| ctrlType == CTRL_TYPE_RIGHT || ctrlType == CTRL_TYPE_LEFT)
@@ -489,7 +489,8 @@ class DragResizeInputListener implements AutoCloseable {
}
final float rawX = e.getRawX(dragPointerIndex);
final float rawY = e.getRawY(dragPointerIndex);
- final Rect taskBounds = mCallback.onDragPositioningMove(rawX, rawY);
+ final Rect taskBounds = mCallback.onDragPositioningMove(e.getDisplayId(),
+ rawX, rawY);
updateInputSinkRegionForDrag(taskBounds);
result = true;
break;
@@ -505,7 +506,7 @@ class DragResizeInputListener implements AutoCloseable {
TAG, e.getActionMasked());
break;
}
- final Rect taskBounds = mCallback.onDragPositioningEnd(
+ final Rect taskBounds = mCallback.onDragPositioningEnd(e.getDisplayId(),
e.getRawX(dragPointerIndex), e.getRawY(dragPointerIndex));
// If taskBounds has changed, setGeometry will be called and update the
// sink region. Otherwise, we should revert it here.
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt
index 3885761d0742..ab30d617af54 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt
@@ -47,10 +47,11 @@ class FixedAspectRatioTaskPositionerDecorator (
private var startingAspectRatio = 0f
private var isTaskPortrait = false
- override fun onDragPositioningStart(@CtrlType ctrlType: Int, x: Float, y: Float): Rect {
+ override fun onDragPositioningStart(
+ @CtrlType ctrlType: Int, displayId: Int, x: Float, y: Float): Rect {
originalCtrlType = ctrlType
if (!requiresFixedAspectRatio()) {
- return super.onDragPositioningStart(originalCtrlType, x, y)
+ return super.onDragPositioningStart(originalCtrlType, displayId, x, y)
}
lastRepositionedBounds.set(getBounds(windowDecoration.mTaskInfo))
@@ -72,27 +73,27 @@ class FixedAspectRatioTaskPositionerDecorator (
val verticalMidPoint = lastRepositionedBounds.top + (startingBoundHeight / 2)
edgeResizeCtrlType = originalCtrlType +
if (y < verticalMidPoint) CTRL_TYPE_TOP else CTRL_TYPE_BOTTOM
- super.onDragPositioningStart(edgeResizeCtrlType, x, y)
+ super.onDragPositioningStart(edgeResizeCtrlType, displayId, x, y)
}
CTRL_TYPE_TOP, CTRL_TYPE_BOTTOM -> {
val horizontalMidPoint = lastRepositionedBounds.left + (startingBoundWidth / 2)
edgeResizeCtrlType = originalCtrlType +
if (x < horizontalMidPoint) CTRL_TYPE_LEFT else CTRL_TYPE_RIGHT
- super.onDragPositioningStart(edgeResizeCtrlType, x, y)
+ super.onDragPositioningStart(edgeResizeCtrlType, displayId, x, y)
}
// If resize is corner resize, no alteration to the ctrlType needs to be made.
else -> {
edgeResizeCtrlType = CTRL_TYPE_UNDEFINED
- super.onDragPositioningStart(originalCtrlType, x, y)
+ super.onDragPositioningStart(originalCtrlType, displayId, x, y)
}
}
)
return lastRepositionedBounds
}
- override fun onDragPositioningMove(x: Float, y: Float): Rect {
+ override fun onDragPositioningMove(displayId: Int, x: Float, y: Float): Rect {
if (!requiresFixedAspectRatio()) {
- return super.onDragPositioningMove(x, y)
+ return super.onDragPositioningMove(displayId, x, y)
}
val diffX = x - lastValidPoint.x
@@ -103,7 +104,7 @@ class FixedAspectRatioTaskPositionerDecorator (
// Drag coordinate falls within valid region (90 - 180 degrees or 270- 360
// degrees from the corner the previous valid point). Allow resize with adjusted
// coordinates to maintain aspect ratio.
- lastRepositionedBounds.set(dragAdjustedMove(x, y))
+ lastRepositionedBounds.set(dragAdjustedMove(displayId, x, y))
}
}
CTRL_TYPE_BOTTOM + CTRL_TYPE_LEFT, CTRL_TYPE_TOP + CTRL_TYPE_RIGHT -> {
@@ -111,28 +112,28 @@ class FixedAspectRatioTaskPositionerDecorator (
// Drag coordinate falls within valid region (180 - 270 degrees or 0 - 90
// degrees from the corner the previous valid point). Allow resize with adjusted
// coordinates to maintain aspect ratio.
- lastRepositionedBounds.set(dragAdjustedMove(x, y))
+ lastRepositionedBounds.set(dragAdjustedMove(displayId, x, y))
}
}
CTRL_TYPE_LEFT, CTRL_TYPE_RIGHT -> {
// If resize is on left or right edge, always adjust the y coordinate.
val adjustedY = getScaledChangeForY(x)
lastValidPoint.set(x, adjustedY)
- lastRepositionedBounds.set(super.onDragPositioningMove(x, adjustedY))
+ lastRepositionedBounds.set(super.onDragPositioningMove(displayId, x, adjustedY))
}
CTRL_TYPE_TOP, CTRL_TYPE_BOTTOM -> {
// If resize is on top or bottom edge, always adjust the x coordinate.
val adjustedX = getScaledChangeForX(y)
lastValidPoint.set(adjustedX, y)
- lastRepositionedBounds.set(super.onDragPositioningMove(adjustedX, y))
+ lastRepositionedBounds.set(super.onDragPositioningMove(displayId, adjustedX, y))
}
}
return lastRepositionedBounds
}
- override fun onDragPositioningEnd(x: Float, y: Float): Rect {
+ override fun onDragPositioningEnd(displayId: Int, x: Float, y: Float): Rect {
if (!requiresFixedAspectRatio()) {
- return super.onDragPositioningEnd(x, y)
+ return super.onDragPositioningEnd(displayId, x, y)
}
val diffX = x - lastValidPoint.x
@@ -144,55 +145,55 @@ class FixedAspectRatioTaskPositionerDecorator (
// Drag coordinate falls within valid region (90 - 180 degrees or 270- 360
// degrees from the corner the previous valid point). End resize with adjusted
// coordinates to maintain aspect ratio.
- return dragAdjustedEnd(x, y)
+ return dragAdjustedEnd(displayId, x, y)
}
// If end of resize is not within valid region, end resize from last valid
// coordinates.
- return super.onDragPositioningEnd(lastValidPoint.x, lastValidPoint.y)
+ return super.onDragPositioningEnd(displayId, lastValidPoint.x, lastValidPoint.y)
}
CTRL_TYPE_BOTTOM + CTRL_TYPE_LEFT, CTRL_TYPE_TOP + CTRL_TYPE_RIGHT -> {
if ((diffX > 0 && diffY < 0) || (diffX < 0 && diffY > 0)) {
// Drag coordinate falls within valid region (180 - 260 degrees or 0 - 90
// degrees from the corner the previous valid point). End resize with adjusted
// coordinates to maintain aspect ratio.
- return dragAdjustedEnd(x, y)
+ return dragAdjustedEnd(displayId, x, y)
}
// If end of resize is not within valid region, end resize from last valid
// coordinates.
- return super.onDragPositioningEnd(lastValidPoint.x, lastValidPoint.y)
+ return super.onDragPositioningEnd(displayId, lastValidPoint.x, lastValidPoint.y)
}
CTRL_TYPE_LEFT, CTRL_TYPE_RIGHT -> {
// If resize is on left or right edge, always adjust the y coordinate.
- return super.onDragPositioningEnd(x, getScaledChangeForY(x))
+ return super.onDragPositioningEnd(displayId, x, getScaledChangeForY(x))
}
CTRL_TYPE_TOP, CTRL_TYPE_BOTTOM -> {
// If resize is on top or bottom edge, always adjust the x coordinate.
- return super.onDragPositioningEnd(getScaledChangeForX(y), y)
+ return super.onDragPositioningEnd(displayId, getScaledChangeForX(y), y)
}
else -> {
- return super.onDragPositioningEnd(x, y)
+ return super.onDragPositioningEnd(displayId, x, y)
}
}
}
- private fun dragAdjustedMove(x: Float, y: Float): Rect {
+ private fun dragAdjustedMove(displayId: Int, x: Float, y: Float): Rect {
val absDiffX = abs(x - lastValidPoint.x)
val absDiffY = abs(y - lastValidPoint.y)
if (absDiffY < absDiffX) {
lastValidPoint.set(getScaledChangeForX(y), y)
- return super.onDragPositioningMove(getScaledChangeForX(y), y)
+ return super.onDragPositioningMove(displayId, getScaledChangeForX(y), y)
}
lastValidPoint.set(x, getScaledChangeForY(x))
- return super.onDragPositioningMove(x, getScaledChangeForY(x))
+ return super.onDragPositioningMove(displayId, x, getScaledChangeForY(x))
}
- private fun dragAdjustedEnd(x: Float, y: Float): Rect {
+ private fun dragAdjustedEnd(displayId: Int, x: Float, y: Float): Rect {
val absDiffX = abs(x - lastValidPoint.x)
val absDiffY = abs(y - lastValidPoint.y)
if (absDiffY < absDiffX) {
- return super.onDragPositioningEnd(getScaledChangeForX(y), y)
+ return super.onDragPositioningEnd(displayId, getScaledChangeForX(y), y)
}
- return super.onDragPositioningEnd(x, getScaledChangeForY(x))
+ return super.onDragPositioningEnd(displayId, x, getScaledChangeForY(x))
}
/**
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java
index 3efae9d6375a..2d6f7459e0ae 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java
@@ -91,7 +91,7 @@ class FluidResizeTaskPositioner implements TaskPositioner, Transitions.Transitio
}
@Override
- public Rect onDragPositioningStart(int ctrlType, float x, float y) {
+ public Rect onDragPositioningStart(int ctrlType, int displayId, float x, float y) {
mCtrlType = ctrlType;
mTaskBoundsAtDragStart.set(
mWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds());
@@ -117,7 +117,7 @@ class FluidResizeTaskPositioner implements TaskPositioner, Transitions.Transitio
}
@Override
- public Rect onDragPositioningMove(float x, float y) {
+ public Rect onDragPositioningMove(int displayId, float x, float y) {
final WindowContainerTransaction wct = new WindowContainerTransaction();
PointF delta = DragPositioningCallbackUtility.calculateDelta(x, y, mRepositionStartPoint);
if (isResizing() && DragPositioningCallbackUtility.changeBounds(mCtrlType,
@@ -147,7 +147,7 @@ class FluidResizeTaskPositioner implements TaskPositioner, Transitions.Transitio
}
@Override
- public Rect onDragPositioningEnd(float x, float y) {
+ public Rect onDragPositioningEnd(int displayId, float x, float y) {
// If task has been resized or task was dragged into area outside of
// mDisallowedAreaForEndBounds, apply WCT to finish it.
if (isResizing() && mHasDragResized) {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java
index 1f03d7568130..e011cc08903b 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java
@@ -104,7 +104,7 @@ public class VeiledResizeTaskPositioner implements TaskPositioner, Transitions.T
}
@Override
- public Rect onDragPositioningStart(int ctrlType, float x, float y) {
+ public Rect onDragPositioningStart(int ctrlType, int displayId, float x, float y) {
mCtrlType = ctrlType;
mTaskBoundsAtDragStart.set(
mDesktopWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds());
@@ -136,7 +136,7 @@ public class VeiledResizeTaskPositioner implements TaskPositioner, Transitions.T
}
@Override
- public Rect onDragPositioningMove(float x, float y) {
+ public Rect onDragPositioningMove(int displayId, float x, float y) {
if (Looper.myLooper() != mHandler.getLooper()) {
// This method must run on the shell main thread to use the correct Choreographer
// instance below.
@@ -170,7 +170,7 @@ public class VeiledResizeTaskPositioner implements TaskPositioner, Transitions.T
}
@Override
- public Rect onDragPositioningEnd(float x, float y) {
+ public Rect onDragPositioningEnd(int displayId, float x, float y) {
PointF delta = DragPositioningCallbackUtility.calculateDelta(x, y,
mRepositionStartPoint);
if (isResizing()) {
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt
index 0214da4660ad..aead0a7afb53 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt
@@ -1015,11 +1015,11 @@ class DesktopModeWindowDecorViewModelTests : DesktopModeWindowDecorViewModelTest
onCaptionButtonTouchListener = onTouchListenerCaptor
)
- whenever(mockTaskPositioner.onDragPositioningStart(any(), any(), any()))
+ whenever(mockTaskPositioner.onDragPositioningStart(any(), any(), any(), any()))
.thenReturn(INITIAL_BOUNDS)
- whenever(mockTaskPositioner.onDragPositioningMove(any(), any()))
+ whenever(mockTaskPositioner.onDragPositioningMove(any(), any(), any()))
.thenReturn(INITIAL_BOUNDS)
- whenever(mockTaskPositioner.onDragPositioningEnd(any(), any()))
+ whenever(mockTaskPositioner.onDragPositioningEnd(any(), any(), any()))
.thenReturn(INITIAL_BOUNDS)
val view = mock(View::class.java)
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecoratorTests.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecoratorTests.kt
index ce17c1df50bc..3c3d6b6bb258 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecoratorTests.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecoratorTests.kt
@@ -68,9 +68,9 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
configuration.windowConfiguration.setBounds(PORTRAIT_BOUNDS)
}
doReturn(PORTRAIT_BOUNDS).`when`(mockTaskPositioner).onDragPositioningStart(
- any(), any(), any())
- doReturn(Rect()).`when`(mockTaskPositioner).onDragPositioningMove(any(), any())
- doReturn(Rect()).`when`(mockTaskPositioner).onDragPositioningEnd(any(), any())
+ any(), any(), any(), any())
+ doReturn(Rect()).`when`(mockTaskPositioner).onDragPositioningMove(any(), any(), any())
+ doReturn(Rect()).`when`(mockTaskPositioner).onDragPositioningEnd(any(), any(), any())
decoratedTaskPositioner = spy(
FixedAspectRatioTaskPositionerDecorator(
mockDesktopWindowDecoration, mockTaskPositioner)
@@ -87,7 +87,8 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
isResizeable = testCase.isResizeable
}
- decoratedTaskPositioner.onDragPositioningStart(testCase.ctrlType, originalX, originalY)
+ decoratedTaskPositioner.onDragPositioningStart(
+ testCase.ctrlType, DISPLAY_ID, originalX, originalY)
val capturedValues = getLatestOnStartArguments()
assertThat(capturedValues.ctrlType).isEqualTo(testCase.ctrlType)
@@ -102,7 +103,8 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
val originalX = 0f
val originalY = 0f
- decoratedTaskPositioner.onDragPositioningStart(testCase.ctrlType, originalX, originalY)
+ decoratedTaskPositioner.onDragPositioningStart(
+ testCase.ctrlType, DISPLAY_ID, originalX, originalY)
val capturedValues = getLatestOnStartArguments()
assertThat(capturedValues.ctrlType).isEqualTo(testCase.ctrlType)
@@ -119,7 +121,7 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
testCase.ctrlType, testCase.additionalEdgeCtrlType, startingBounds)
decoratedTaskPositioner.onDragPositioningStart(
- testCase.ctrlType, startingPoint.x, startingPoint.y)
+ testCase.ctrlType, DISPLAY_ID, startingPoint.x, startingPoint.y)
val adjustedCtrlType = testCase.ctrlType + testCase.additionalEdgeCtrlType
val capturedValues = getLatestOnStartArguments()
@@ -134,13 +136,14 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
) {
val originalX = 0f
val originalY = 0f
- decoratedTaskPositioner.onDragPositioningStart(testCase.ctrlType, originalX, originalX)
+ decoratedTaskPositioner.onDragPositioningStart(
+ testCase.ctrlType, DISPLAY_ID, originalX, originalX)
mockDesktopWindowDecoration.mTaskInfo = ActivityManager.RunningTaskInfo().apply {
isResizeable = testCase.isResizeable
}
decoratedTaskPositioner.onDragPositioningMove(
- originalX + SMALL_DELTA, originalY + SMALL_DELTA)
+ DISPLAY_ID, originalX + SMALL_DELTA, originalY + SMALL_DELTA)
val capturedValues = getLatestOnMoveArguments()
assertThat(capturedValues.x).isEqualTo(originalX + SMALL_DELTA)
@@ -156,13 +159,14 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
val startingPoint = getCornerStartingPoint(testCase.ctrlType, startingBounds)
decoratedTaskPositioner.onDragPositioningStart(
- testCase.ctrlType, startingPoint.x, startingPoint.y)
+ testCase.ctrlType, DISPLAY_ID, startingPoint.x, startingPoint.y)
val updatedBounds = decoratedTaskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
startingPoint.x + testCase.dragDelta.x,
startingPoint.y + testCase.dragDelta.y)
- verify(mockTaskPositioner, never()).onDragPositioningMove(any(), any())
+ verify(mockTaskPositioner, never()).onDragPositioningMove(any(), any(), any())
assertThat(updatedBounds).isEqualTo(startingBounds)
}
@@ -176,10 +180,12 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
val startingPoint = getCornerStartingPoint(testCase.ctrlType, startingBounds)
decoratedTaskPositioner.onDragPositioningStart(
- testCase.ctrlType, startingPoint.x, startingPoint.y)
+ testCase.ctrlType, DISPLAY_ID, startingPoint.x, startingPoint.y)
decoratedTaskPositioner.onDragPositioningMove(
- startingPoint.x + testCase.dragDelta.x, startingPoint.y + testCase.dragDelta.y)
+ DISPLAY_ID,
+ startingPoint.x + testCase.dragDelta.x,
+ startingPoint.y + testCase.dragDelta.y)
val adjustedDragDelta = calculateAdjustedDelta(
testCase.ctrlType, testCase.dragDelta, orientation)
@@ -202,9 +208,10 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
testCase.ctrlType, testCase.additionalEdgeCtrlType, startingBounds)
decoratedTaskPositioner.onDragPositioningStart(
- testCase.ctrlType, startingPoint.x, startingPoint.y)
+ testCase.ctrlType, DISPLAY_ID, startingPoint.x, startingPoint.y)
decoratedTaskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
startingPoint.x + testCase.dragDelta.x,
startingPoint.y + testCase.dragDelta.y)
@@ -227,13 +234,14 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
) {
val originalX = 0f
val originalY = 0f
- decoratedTaskPositioner.onDragPositioningStart(testCase.ctrlType, originalX, originalX)
+ decoratedTaskPositioner.onDragPositioningStart(testCase.ctrlType, DISPLAY_ID,
+ originalX, originalX)
mockDesktopWindowDecoration.mTaskInfo = ActivityManager.RunningTaskInfo().apply {
isResizeable = testCase.isResizeable
}
decoratedTaskPositioner.onDragPositioningEnd(
- originalX + SMALL_DELTA, originalY + SMALL_DELTA)
+ DISPLAY_ID, originalX + SMALL_DELTA, originalY + SMALL_DELTA)
val capturedValues = getLatestOnEndArguments()
assertThat(capturedValues.x).isEqualTo(originalX + SMALL_DELTA)
@@ -249,9 +257,10 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
val startingPoint = getCornerStartingPoint(testCase.ctrlType, startingBounds)
decoratedTaskPositioner.onDragPositioningStart(
- testCase.ctrlType, startingPoint.x, startingPoint.y)
+ testCase.ctrlType, DISPLAY_ID, startingPoint.x, startingPoint.y)
decoratedTaskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
startingPoint.x + testCase.dragDelta.x,
startingPoint.y + testCase.dragDelta.y)
@@ -269,10 +278,12 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
val startingPoint = getCornerStartingPoint(testCase.ctrlType, startingBounds)
decoratedTaskPositioner.onDragPositioningStart(
- testCase.ctrlType, startingPoint.x, startingPoint.y)
+ testCase.ctrlType, DISPLAY_ID, startingPoint.x, startingPoint.y)
decoratedTaskPositioner.onDragPositioningEnd(
- startingPoint.x + testCase.dragDelta.x, startingPoint.y + testCase.dragDelta.y)
+ DISPLAY_ID,
+ startingPoint.x + testCase.dragDelta.x,
+ startingPoint.y + testCase.dragDelta.y)
val adjustedDragDelta = calculateAdjustedDelta(
testCase.ctrlType, testCase.dragDelta, orientation)
@@ -295,9 +306,10 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
testCase.ctrlType, testCase.additionalEdgeCtrlType, startingBounds)
decoratedTaskPositioner.onDragPositioningStart(
- testCase.ctrlType, startingPoint.x, startingPoint.y)
+ testCase.ctrlType, DISPLAY_ID, startingPoint.x, startingPoint.y)
decoratedTaskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
startingPoint.x + testCase.dragDelta.x,
startingPoint.y + testCase.dragDelta.y)
@@ -322,7 +334,7 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
val captorCtrlType = argumentCaptor<Int>()
val captorCoordinates = argumentCaptor<Float>()
verify(mockTaskPositioner).onDragPositioningStart(
- captorCtrlType.capture(), captorCoordinates.capture(), captorCoordinates.capture())
+ captorCtrlType.capture(), any(), captorCoordinates.capture(), captorCoordinates.capture())
return CtrlCoordinateCapture(captorCtrlType.firstValue, captorCoordinates.firstValue,
captorCoordinates.secondValue)
@@ -335,7 +347,7 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
private fun getLatestOnMoveArguments(): PointF {
val captorCoordinates = argumentCaptor<Float>()
verify(mockTaskPositioner).onDragPositioningMove(
- captorCoordinates.capture(), captorCoordinates.capture())
+ any(), captorCoordinates.capture(), captorCoordinates.capture())
return PointF(captorCoordinates.firstValue, captorCoordinates.secondValue)
}
@@ -347,7 +359,7 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
private fun getLatestOnEndArguments(): PointF {
val captorCoordinates = argumentCaptor<Float>()
verify(mockTaskPositioner).onDragPositioningEnd(
- captorCoordinates.capture(), captorCoordinates.capture())
+ any(), captorCoordinates.capture(), captorCoordinates.capture())
return PointF(captorCoordinates.firstValue, captorCoordinates.secondValue)
}
@@ -358,7 +370,7 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
private fun getAndMockBounds(orientation: Orientation): Rect {
val mockBounds = if (orientation.isPortrait) PORTRAIT_BOUNDS else LANDSCAPE_BOUNDS
doReturn(mockBounds).`when`(mockTaskPositioner).onDragPositioningStart(
- any(), any(), any())
+ any(), any(), any(), any())
doReturn(mockBounds).`when`(decoratedTaskPositioner).getBounds(any())
return mockBounds
}
@@ -458,6 +470,7 @@ class FixedAspectRatioTaskPositionerDecoratorTests : ShellTestCase(){
private val STARTING_ASPECT_RATIO = PORTRAIT_BOUNDS.height() / PORTRAIT_BOUNDS.width()
private const val LARGE_DELTA = 50f
private const val SMALL_DELTA = 30f
+ private const val DISPLAY_ID = 1
enum class Orientation(
val isPortrait: Boolean
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt
index 3b80cb4936b9..cec52518edd2 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt
@@ -150,11 +150,13 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_notMove_skipsTransitionOnEnd() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_TOP or CTRL_TYPE_RIGHT,
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() + 10,
STARTING_BOUNDS.top.toFloat() + 10
)
@@ -171,11 +173,13 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_noEffectiveMove_skipsTransitionOnMoveAndEnd() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_TOP or CTRL_TYPE_RIGHT,
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -188,6 +192,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
})
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() + 10,
STARTING_BOUNDS.top.toFloat() + 10
)
@@ -204,11 +209,13 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_hasEffectiveMove_issuesTransitionOnMoveAndEnd() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_TOP or CTRL_TYPE_RIGHT,
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() + 10,
STARTING_BOUNDS.top.toFloat()
)
@@ -224,6 +231,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
verify(mockDragEventListener, times(1)).onDragMove(eq(TASK_ID))
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() + 10,
STARTING_BOUNDS.top.toFloat() + 10
)
@@ -242,6 +250,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_move_skipsDragResizingFlag() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_UNDEFINED, // Move
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -250,11 +259,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.left.toFloat() + 10
val newY = STARTING_BOUNDS.top.toFloat()
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -276,6 +286,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_setsDragResizingFlag() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT, // Resize right
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -284,11 +295,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() + 10
val newY = STARTING_BOUNDS.top.toFloat()
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -310,6 +322,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_setBoundsDoesNotChangeHeightWhenLessThanMin() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -318,11 +331,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 5
val newY = STARTING_BOUNDS.top.toFloat() + 95
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -340,6 +354,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_setBoundsDoesNotChangeWidthWhenLessThanMin() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -348,11 +363,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 95
val newY = STARTING_BOUNDS.top.toFloat() + 5
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -370,6 +386,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_setBoundsDoesNotChangeHeightWhenNegative() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -378,11 +395,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 5
val newY = STARTING_BOUNDS.top.toFloat() + 105
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -400,6 +418,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_setBoundsDoesNotChangeWidthWhenNegative() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -408,11 +427,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 105
val newY = STARTING_BOUNDS.top.toFloat() + 5
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -430,6 +450,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_setBoundsRunsWhenResizeBoundsValid() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -438,11 +459,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 80
val newY = STARTING_BOUNDS.top.toFloat() + 80
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -456,6 +478,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_setBoundsDoesNotRunWithNegativeHeightAndWidth() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -464,11 +487,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 95
val newY = STARTING_BOUNDS.top.toFloat() + 95
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -484,6 +508,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -492,11 +517,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 97
val newY = STARTING_BOUNDS.top.toFloat() + 97
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -510,6 +536,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_useMinWidthWhenValid() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP, // Resize right and top
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -518,11 +545,12 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.right.toFloat() - 93
val newY = STARTING_BOUNDS.top.toFloat() + 93
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -535,6 +563,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_toDisallowedBounds_freezesAtLimit() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_BOTTOM, // Resize right-bottom corner
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.bottom.toFloat()
)
@@ -546,6 +575,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
STARTING_BOUNDS.right + 10,
STARTING_BOUNDS.bottom + 10)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newBounds.right.toFloat(),
newBounds.bottom.toFloat()
)
@@ -559,11 +589,13 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
DISALLOWED_RESIZE_AREA.top
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newBounds2.right.toFloat(),
newBounds2.bottom.toFloat()
)
- taskPositioner.onDragPositioningEnd(newBounds2.right.toFloat(), newBounds2.bottom.toFloat())
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newBounds2.right.toFloat(),
+ newBounds2.bottom.toFloat())
// The first resize falls in the allowed area, verify there's a change for it.
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
@@ -629,6 +661,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
mockWindowDecoration.mHasGlobalFocus = false
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT, // Resize right
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -645,6 +678,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
mockWindowDecoration.mHasGlobalFocus = true
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT, // Resize right
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -661,6 +695,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
mockWindowDecoration.mHasGlobalFocus = false
taskPositioner.onDragPositioningStart(
CTRL_TYPE_UNDEFINED, // drag
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -729,11 +764,13 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_TOP or CTRL_TYPE_RIGHT,
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() - 20,
STARTING_BOUNDS.top.toFloat() - 20
)
@@ -742,6 +779,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
assertTrue(taskPositioner.isResizingOrAnimating)
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -785,15 +823,18 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
) {
taskPositioner.onDragPositioningStart(
ctrlType,
+ DISPLAY_ID,
startX,
startY
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
endX,
endY
)
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
endX,
endY
)
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt
index e7df8643ba66..eb8c0dd365a3 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt
@@ -168,12 +168,14 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_noMove_doesNotShowResizeVeil() = runOnUiThread {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_TOP or CTRL_TYPE_RIGHT,
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
verify(mockDesktopWindowDecoration, never()).showResizeVeil(STARTING_BOUNDS)
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -191,11 +193,13 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_movesTask_doesNotShowResizeVeil() = runOnUiThread {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_UNDEFINED,
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() + 60,
STARTING_BOUNDS.top.toFloat() + 100
)
@@ -208,6 +212,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
eq(rectAfterMove.top.toFloat()))
val endBounds = taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() + 70,
STARTING_BOUNDS.top.toFloat() + 20
)
@@ -226,11 +231,13 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_resize_boundsUpdateOnEnd() = runOnUiThread {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT or CTRL_TYPE_TOP,
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat() + 10,
STARTING_BOUNDS.top.toFloat() + 10
)
@@ -248,6 +255,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
})
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.right.toFloat() + 20,
STARTING_BOUNDS.top.toFloat() + 20
)
@@ -266,17 +274,20 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
@Test
fun testDragResize_noEffectiveMove_skipsTransactionOnEnd() = runOnUiThread {
taskPositioner.onDragPositioningStart(
+ DISPLAY_ID,
CTRL_TYPE_TOP or CTRL_TYPE_RIGHT,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() + 10,
STARTING_BOUNDS.top.toFloat() + 10
)
@@ -300,6 +311,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
fun testDragResize_drag_setBoundsNotRunIfDragEndsInDisallowedEndArea() = runOnUiThread {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_UNDEFINED, // drag
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -307,11 +319,12 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
val newX = STARTING_BOUNDS.left.toFloat() + 5
val newY = DISALLOWED_AREA_FOR_END_BOUNDS_HEIGHT.toFloat() - 1
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
newX,
newY
)
- taskPositioner.onDragPositioningEnd(newX, newY)
+ taskPositioner.onDragPositioningEnd(DISPLAY_ID, newX, newY)
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
return@argThat wct.changes.any { (token, change) ->
@@ -326,6 +339,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
mockDesktopWindowDecoration.mHasGlobalFocus = false
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT, // Resize right
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -342,6 +356,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
mockDesktopWindowDecoration.mHasGlobalFocus = true
taskPositioner.onDragPositioningStart(
CTRL_TYPE_RIGHT, // Resize right
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -358,6 +373,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
mockDesktopWindowDecoration.mHasGlobalFocus = false
taskPositioner.onDragPositioningStart(
CTRL_TYPE_UNDEFINED, // drag
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -422,11 +438,13 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
taskPositioner.onDragPositioningStart(
CTRL_TYPE_TOP or CTRL_TYPE_RIGHT,
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat() - 20,
STARTING_BOUNDS.top.toFloat() - 20
)
@@ -436,6 +454,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
verify(mockDragEventListener, times(1)).onDragMove(eq(TASK_ID))
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
STARTING_BOUNDS.left.toFloat(),
STARTING_BOUNDS.top.toFloat()
)
@@ -501,15 +520,18 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
) {
taskPositioner.onDragPositioningStart(
ctrlType,
+ DISPLAY_ID,
startX,
startY
)
taskPositioner.onDragPositioningMove(
+ DISPLAY_ID,
endX,
endY
)
taskPositioner.onDragPositioningEnd(
+ DISPLAY_ID,
endX,
endY
)