Merge "Bring task to front when resizing" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1b2eeb06dd
@@ -73,6 +73,11 @@ class FluidResizeTaskPositioner implements DragPositioningCallback {
|
||||
mWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds());
|
||||
mRepositionStartPoint.set(x, y);
|
||||
mDragStartListener.onDragStart(mWindowDecoration.mTaskInfo.taskId);
|
||||
if (mCtrlType != CTRL_TYPE_UNDEFINED && !mWindowDecoration.mTaskInfo.isFocused) {
|
||||
WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
wct.reorder(mWindowDecoration.mTaskInfo.token, true);
|
||||
mTaskOrganizer.applyTransaction(wct);
|
||||
}
|
||||
mRepositionTaskBounds.set(mTaskBoundsAtDragStart);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,11 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback {
|
||||
mRepositionStartPoint.set(x, y);
|
||||
if (isResizing()) {
|
||||
mDesktopWindowDecoration.showResizeVeil();
|
||||
if (!mDesktopWindowDecoration.mTaskInfo.isFocused) {
|
||||
WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
wct.reorder(mDesktopWindowDecoration.mTaskInfo.token, true);
|
||||
mTaskOrganizer.applyTransaction(wct);
|
||||
}
|
||||
}
|
||||
mHasDragResized = false;
|
||||
mDragStartListener.onDragStart(mDesktopWindowDecoration.mTaskInfo.taskId);
|
||||
|
||||
@@ -565,6 +565,55 @@ class FluidResizeTaskPositionerTest : ShellTestCase() {
|
||||
bounds == configuration.windowConfiguration.bounds
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDragResize_resize_resizingTaskReorderedToTopWhenNotFocused() {
|
||||
mockWindowDecoration.mTaskInfo.isFocused = false
|
||||
taskPositioner.onDragPositioningStart(
|
||||
CTRL_TYPE_RIGHT, // Resize right
|
||||
STARTING_BOUNDS.left.toFloat(),
|
||||
STARTING_BOUNDS.top.toFloat()
|
||||
)
|
||||
|
||||
// Verify task is reordered to top
|
||||
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
|
||||
return@argThat wct.hierarchyOps.any { hierarchyOps ->
|
||||
hierarchyOps.container == taskBinder && hierarchyOps.toTop }
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDragResize_resize_resizingTaskNotReorderedToTopWhenFocused() {
|
||||
mockWindowDecoration.mTaskInfo.isFocused = true
|
||||
taskPositioner.onDragPositioningStart(
|
||||
CTRL_TYPE_RIGHT, // Resize right
|
||||
STARTING_BOUNDS.left.toFloat(),
|
||||
STARTING_BOUNDS.top.toFloat()
|
||||
)
|
||||
|
||||
// Verify task is not reordered to top
|
||||
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
|
||||
return@argThat wct.hierarchyOps.any { hierarchyOps ->
|
||||
hierarchyOps.container == taskBinder && hierarchyOps.toTop }
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDragResize_drag_draggedTaskNotReorderedToTop() {
|
||||
mockWindowDecoration.mTaskInfo.isFocused = false
|
||||
taskPositioner.onDragPositioningStart(
|
||||
CTRL_TYPE_UNDEFINED, // drag
|
||||
STARTING_BOUNDS.left.toFloat(),
|
||||
STARTING_BOUNDS.top.toFloat()
|
||||
)
|
||||
|
||||
// Verify task is not reordered to top since task is already brought to top before dragging
|
||||
// begins
|
||||
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
|
||||
return@argThat wct.hierarchyOps.any { hierarchyOps ->
|
||||
hierarchyOps.container == taskBinder && hierarchyOps.toTop }
|
||||
})
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TASK_ID = 5
|
||||
private const val MIN_WIDTH = 10
|
||||
|
||||
@@ -271,6 +271,55 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDragResize_resize_resizingTaskReorderedToTopWhenNotFocused() {
|
||||
mockDesktopWindowDecoration.mTaskInfo.isFocused = false
|
||||
taskPositioner.onDragPositioningStart(
|
||||
CTRL_TYPE_RIGHT, // Resize right
|
||||
STARTING_BOUNDS.left.toFloat(),
|
||||
STARTING_BOUNDS.top.toFloat()
|
||||
)
|
||||
|
||||
// Verify task is reordered to top
|
||||
verify(mockShellTaskOrganizer).applyTransaction(argThat { wct ->
|
||||
return@argThat wct.hierarchyOps.any { hierarchyOps ->
|
||||
hierarchyOps.container == taskBinder && hierarchyOps.toTop }
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDragResize_resize_resizingTaskNotReorderedToTopWhenFocused() {
|
||||
mockDesktopWindowDecoration.mTaskInfo.isFocused = true
|
||||
taskPositioner.onDragPositioningStart(
|
||||
CTRL_TYPE_RIGHT, // Resize right
|
||||
STARTING_BOUNDS.left.toFloat(),
|
||||
STARTING_BOUNDS.top.toFloat()
|
||||
)
|
||||
|
||||
// Verify task is not reordered to top
|
||||
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
|
||||
return@argThat wct.hierarchyOps.any { hierarchyOps ->
|
||||
hierarchyOps.container == taskBinder && hierarchyOps.toTop }
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDragResize_drag_draggedTaskNotReorderedToTop() {
|
||||
mockDesktopWindowDecoration.mTaskInfo.isFocused = false
|
||||
taskPositioner.onDragPositioningStart(
|
||||
CTRL_TYPE_UNDEFINED, // drag
|
||||
STARTING_BOUNDS.left.toFloat(),
|
||||
STARTING_BOUNDS.top.toFloat()
|
||||
)
|
||||
|
||||
// Verify task is not reordered to top since task is already brought to top before dragging
|
||||
// begins
|
||||
verify(mockShellTaskOrganizer, never()).applyTransaction(argThat { wct ->
|
||||
return@argThat wct.hierarchyOps.any { hierarchyOps ->
|
||||
hierarchyOps.container == taskBinder && hierarchyOps.toTop }
|
||||
})
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TASK_ID = 5
|
||||
private const val MIN_WIDTH = 10
|
||||
|
||||
Reference in New Issue
Block a user