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

Commit 2970ffce authored by Toshiki Kikuchi's avatar Toshiki Kikuchi
Browse files

Allow Task#setDragResizing on W_M_MULTI_WINDOW

This CL unlocks the capability to set Task#setDragResizing for tasks in
WINDOWING_MODE_MULTI_WINDOW.
With Task#setDragResizing, some resizing optimizations (e.g., using a
fullscreen-sized surface to reduce reallocations) are applied while
resizing.
Because W_M_MULTI_WINDOW is also allowed to be resized from the Shell,
we need such optimizations for W_M_MULTI_WINDOW as well.
It used to be allowed for legacy docked tasks, but the docked mode
refactoring accidentally cleaned this up. This CL restores the
capability.

Bug: 308722494
Test: TaskTests
Change-Id: I4dc9150ebbcc0cb55eddb7d52090da6e983fe06e
parent 2ef3c463
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2914,7 +2914,7 @@ class Task extends TaskFragment {
        if (mDragResizing != dragResizing) {
            // No need to check if allowed if it's leaving dragResize
            if (dragResizing
                    && !(getRootTask().getWindowingMode() == WINDOWING_MODE_FREEFORM)) {
                    && !(getRootTask().getWindowConfiguration().canResizeTask())) {
                Slog.e(TAG, "Drag resize isn't allowed for root task id=" + getRootTaskId());
                return;
            }
+29 −0
Original line number Diff line number Diff line
@@ -1579,6 +1579,35 @@ public class TaskTests extends WindowTestsBase {
                task.getTopChild());
    }

    @Test
    public void testSetDragResizing() {
        final Task task = createTask(mDisplayContent);

        // Allowed for freeform.
        task.setWindowingMode(WINDOWING_MODE_FREEFORM);

        task.setDragResizing(true);
        assertTrue(task.isDragResizing());
        task.setDragResizing(false);
        assertFalse(task.isDragResizing());

        // Allowed for multi-window.
        task.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW);

        task.setDragResizing(true);
        assertTrue(task.isDragResizing());
        task.setDragResizing(false);
        assertFalse(task.isDragResizing());

        // Disallowed for fullscreen.
        task.setWindowingMode(WINDOWING_MODE_FULLSCREEN);

        task.setDragResizing(true);
        assertFalse(task.isDragResizing());
        task.setDragResizing(false);
        assertFalse(task.isDragResizing());
    }

    private Task getTestTask() {
        return new TaskBuilder(mSupervisor).setCreateActivity(true).build();
    }