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
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 71dbd29..af86a88 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -2914,7 +2914,7 @@
         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;
             }
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
index 0c58069..b5cf06a 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
@@ -1579,6 +1579,35 @@
                 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();
     }