Get `displayId` from DesktopTask for `DesktopTaskView`

Bug: 401011627
Flag: com.android.window.flags.enable_multiple_desktops_frontend
Flag: com.android.window.flags.enable_multiple_desktops_backend
Test: Added a test in RecentTasksListTest
Change-Id: I21164de812d57b79cd84370bbf0426268c4b645d
diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java
index cc5b2da..dab78c5 100644
--- a/quickstep/src/com/android/quickstep/RecentTasksList.java
+++ b/quickstep/src/com/android/quickstep/RecentTasksList.java
@@ -511,13 +511,14 @@
             // When the multiple desktop feature is disabled, there can only be up to a single desk
             // on each display, The desk ID doesn't matter and should not be used.
             return MapsKt.map(perDisplayTasks,
-                    it -> new DesktopTask(DesktopVisibilityController.INACTIVE_DESK_ID,
+                    it -> new DesktopTask(DesktopVisibilityController.INACTIVE_DESK_ID, it.getKey(),
                             it.getValue()));
         } else {
             final int deskId = recentTaskInfo.getDeskId();
+            final int displayId = recentTaskInfo.getDeskDisplayId();
             List<Task> tasks = CollectionsKt.map(recentTaskInfo.getTaskInfoList(),
                     it -> createTask(it, minimizedTaskIds));
-            return List.of(new DesktopTask(deskId, tasks));
+            return List.of(new DesktopTask(deskId, displayId, tasks));
         }
     }
 
diff --git a/quickstep/src/com/android/quickstep/util/DesktopTask.kt b/quickstep/src/com/android/quickstep/util/DesktopTask.kt
index fbe3bc6..7c27293 100644
--- a/quickstep/src/com/android/quickstep/util/DesktopTask.kt
+++ b/quickstep/src/com/android/quickstep/util/DesktopTask.kt
@@ -17,22 +17,27 @@
 
 import com.android.quickstep.views.TaskViewType
 import com.android.systemui.shared.recents.model.Task
+import java.util.Objects
 
 /**
  * A [Task] container that can contain N number of tasks that are part of the desktop in recent
- * tasks list. Note that desktops can be empty with no tasks in them. The [deskId] makes sense only
- * when the multiple desks feature is enabled.
+ * tasks list. Note that desktops can be empty with no tasks in them. The [deskId], [displayId]
+ * makes sense only when the multiple desks feature is enabled.
  */
-class DesktopTask(val deskId: Int, tasks: List<Task>) : GroupTask(tasks, TaskViewType.DESKTOP) {
+class DesktopTask(val deskId: Int, val displayId: Int, tasks: List<Task>) :
+    GroupTask(tasks, TaskViewType.DESKTOP) {
 
-    override fun copy() = DesktopTask(deskId, tasks)
+    override fun copy() = DesktopTask(deskId, displayId, tasks)
 
-    override fun toString() = "type=$taskViewType deskId=$deskId tasks=$tasks"
+    override fun toString() = "type=$taskViewType deskId=$deskId displayId=$displayId tasks=$tasks"
 
     override fun equals(o: Any?): Boolean {
         if (this === o) return true
         if (o !is DesktopTask) return false
         if (deskId != o.deskId) return false
+        if (displayId != o.displayId) return false
         return super.equals(o)
     }
+
+    override fun hashCode() = Objects.hash(super.hashCode(), deskId, displayId)
 }
diff --git a/quickstep/src/com/android/quickstep/util/GroupTask.kt b/quickstep/src/com/android/quickstep/util/GroupTask.kt
index add8821..2b754e2 100644
--- a/quickstep/src/com/android/quickstep/util/GroupTask.kt
+++ b/quickstep/src/com/android/quickstep/util/GroupTask.kt
@@ -86,6 +86,8 @@
             return TaskItemInfo(task.task.key.id, wii)
         }
     }
+
+    override fun hashCode() = super.hashCode()
 }
 
 /**
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
index 27657b4..8876633 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
@@ -25,6 +25,7 @@
 import android.util.AttributeSet
 import android.util.Log
 import android.util.Size
+import android.view.Display.INVALID_DISPLAY
 import android.view.Gravity
 import android.view.View
 import android.view.ViewStub
@@ -59,6 +60,7 @@
 import com.android.quickstep.task.thumbnail.TaskThumbnailView
 import com.android.quickstep.util.DesktopTask
 import com.android.quickstep.util.RecentsOrientedState
+import com.android.wm.shell.shared.desktopmode.DesktopModeStatus.enableMultipleDesktops
 import kotlin.math.roundToInt
 
 /** TaskView that contains all tasks that are part of the desktop. */
@@ -69,7 +71,10 @@
         type = TaskViewType.DESKTOP,
         thumbnailFullscreenParams = DesktopFullscreenDrawParams(context),
     ) {
-    var deskId = DesktopVisibilityController.INACTIVE_DESK_ID
+    val deskId
+        get() = desktopTask?.deskId ?: DesktopVisibilityController.INACTIVE_DESK_ID
+
+    private var desktopTask: DesktopTask? = null
 
     private val contentViewFullscreenParams = FullscreenDrawParams(context)
 
@@ -112,6 +117,14 @@
             positionTaskWindows()
         }
 
+    override val displayId: Int
+        get() =
+            if (enableMultipleDesktops(context)) {
+                desktopTask?.displayId ?: INVALID_DISPLAY
+            } else {
+                super.displayId
+            }
+
     private fun getRemoteTargetHandle(taskId: Int): RemoteTargetHandle? =
         remoteTargetHandles?.firstOrNull {
             it.transformParams.targetSet.firstAppTargetTaskId == taskId
@@ -284,7 +297,7 @@
         orientedState: RecentsOrientedState,
         taskOverlayFactory: TaskOverlayFactory,
     ) {
-        deskId = desktopTask.deskId
+        this.desktopTask = desktopTask
         // TODO(b/370495260): Minimized tasks should not be filtered with desktop exploded view
         // support.
         // Minimized tasks should not be shown in Overview.
@@ -336,7 +349,7 @@
 
     override fun onRecycle() {
         super.onRecycle()
-        deskId = DesktopVisibilityController.INACTIVE_DESK_ID
+        desktopTask = null
         explodeProgress = 0.0f
         viewModel = null
         visibility = VISIBLE
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 6067550..722ef56 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -142,7 +142,6 @@
 import androidx.core.graphics.ColorUtils;
 import androidx.dynamicanimation.animation.SpringAnimation;
 
-import com.android.app.tracing.TraceUtilsKt;
 import com.android.internal.jank.Cuj;
 import com.android.launcher3.AbstractFloatingView;
 import com.android.launcher3.BaseActivity.MultiWindowModeChangedListener;
@@ -3121,7 +3120,8 @@
 
         // TODO: b/401582344 - Implement a way to exclude the `DesktopWallpaperActivity`.
         desktopTaskView.bind(
-                new DesktopTask(activeDeskId, Arrays.asList(runningTasks)),
+                new DesktopTask(activeDeskId, mContainer.getDisplayId(),
+                        Arrays.asList(runningTasks)),
                 mOrientationState, mTaskOverlayFactory);
         return desktopTaskView;
     }
@@ -7026,7 +7026,7 @@
         // `AddNewDesktopButton`.
         DesktopTaskView desktopTaskView =
                 (DesktopTaskView) getTaskViewFromPool(TaskViewType.DESKTOP);
-        desktopTaskView.bind(new DesktopTask(deskId, new ArrayList<>()),
+        desktopTaskView.bind(new DesktopTask(deskId, displayId, new ArrayList<>()),
                 mOrientationState, mTaskOverlayFactory);
 
         Objects.requireNonNull(mAddDesktopButton);
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt
index 8d95b13..4f7fe31 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskView.kt
@@ -146,7 +146,7 @@
     val isRunningTask: Boolean
         get() = this === recentsView?.runningTaskView
 
-    val displayId: Int
+    open val displayId: Int
         get() = taskContainers.firstOrNull()?.task.displayId
 
     val isExternalDisplay: Boolean
@@ -1484,10 +1484,11 @@
     }
 
     private fun closeTaskMenu(): Boolean {
-        val floatingView: AbstractFloatingView? = AbstractFloatingView.getTopOpenViewWithType(
-            container,
-            AbstractFloatingView.TYPE_TASK_MENU
-        )
+        val floatingView: AbstractFloatingView? =
+            AbstractFloatingView.getTopOpenViewWithType(
+                container,
+                AbstractFloatingView.TYPE_TASK_MENU,
+            )
         if (floatingView?.isOpen == true) {
             floatingView.close(true)
             return true
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarOverflowTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarOverflowTest.kt
index 3761044..c589415 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarOverflowTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarOverflowTest.kt
@@ -23,6 +23,7 @@
 import android.platform.test.annotations.DisableFlags
 import android.platform.test.annotations.EnableFlags
 import android.platform.test.flag.junit.SetFlagsRule
+import android.view.Display.DEFAULT_DISPLAY
 import androidx.test.core.app.ApplicationProvider
 import com.android.launcher3.Flags.FLAG_ENABLE_MULTI_INSTANCE_MENU_TASKBAR
 import com.android.launcher3.Flags.FLAG_TASKBAR_OVERFLOW
@@ -446,7 +447,7 @@
                 )
             })
 
-        recentsModel.updateRecentTasks(listOf(DesktopTask(deskId = 0, tasks)))
+        recentsModel.updateRecentTasks(listOf(DesktopTask(deskId = 0, DEFAULT_DISPLAY, tasks)))
         for (task in 1..tasks.size) {
             desktopTaskListener?.onTasksVisibilityChanged(
                 context.virtualDisplay.display.displayId,
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarRecentAppsControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarRecentAppsControllerTest.kt
index 8376bc1..8758d7c 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarRecentAppsControllerTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarRecentAppsControllerTest.kt
@@ -25,6 +25,7 @@
 import android.os.Process
 import android.os.UserHandle
 import android.platform.test.annotations.EnableFlags
+import android.view.Display.DEFAULT_DISPLAY
 import androidx.test.annotation.UiThreadTest
 import com.android.internal.R
 import com.android.launcher3.BubbleTextView.RunningAppState
@@ -877,7 +878,7 @@
         val allTasks =
             ArrayList<GroupTask>().apply {
                 if (!runningTasks.isEmpty()) {
-                    add(DesktopTask(deskId = 0, ArrayList(runningTasks)))
+                    add(DesktopTask(deskId = 0, DEFAULT_DISPLAY, ArrayList(runningTasks)))
                 }
                 addAll(recentTasks)
             }
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java b/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java
index 9722e9d..1e4315a 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java
@@ -52,6 +52,7 @@
 import com.android.launcher3.statehandlers.DesktopVisibilityController;
 import com.android.launcher3.util.DaggerSingletonTracker;
 import com.android.launcher3.util.LooperExecutor;
+import com.android.quickstep.util.DesktopTask;
 import com.android.quickstep.util.GroupTask;
 import com.android.quickstep.views.TaskViewType;
 import com.android.systemui.shared.recents.model.Task;
@@ -148,6 +149,66 @@
     }
 
     @Test
+    @EnableFlags(FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND)
+    public void loadTasksInBackground_freeformTask_multiDesksInMultiDisplays() throws Exception {
+        List<TaskInfo> tasksInDefaultDesk1 = Arrays.asList(
+                createRecentTaskInfo(/* taskId = */ 1, DEFAULT_DISPLAY),
+                createRecentTaskInfo(/* taskId = */ 4, DEFAULT_DISPLAY));
+        List<TaskInfo> tasksInDefaultDesk2 = Arrays.asList(
+                createRecentTaskInfo(/* taskId = */ 2, DEFAULT_DISPLAY),
+                createRecentTaskInfo(/* taskId = */ 3, DEFAULT_DISPLAY));
+        List<TaskInfo> tasksInExtend = Arrays.asList(
+                createRecentTaskInfo(/* taskId = */ 5, /* displayId = */ 1),
+                createRecentTaskInfo(/* taskId = */ 6, /* displayId = */ 1));
+        GroupedTaskInfo recentTaskInfosOfDesk1 = GroupedTaskInfo.forDeskTasks(/* deskId = */1,
+                DEFAULT_DISPLAY, tasksInDefaultDesk1, /* minimizedTaskIds = */
+                Collections.emptySet());
+        GroupedTaskInfo recentTaskInfosOfDesk2 = GroupedTaskInfo.forDeskTasks(/* deskId = */2,
+                DEFAULT_DISPLAY, tasksInDefaultDesk2, /* minimizedTaskIds = */
+                Collections.emptySet());
+        GroupedTaskInfo recentTaskInfosOfDesk3 = GroupedTaskInfo.forDeskTasks(/* deskId = */3,
+                /* displayId = */ 1, tasksInExtend, /* minimizedTaskIds = */
+                Collections.emptySet());
+        when(mSystemUiProxy.getRecentTasks(anyInt(), anyInt())).thenReturn(
+                new ArrayList<>(Arrays.asList(recentTaskInfosOfDesk1, recentTaskInfosOfDesk2,
+                        recentTaskInfosOfDesk3)));
+
+        List<GroupTask> taskList = mRecentTasksList.loadTasksInBackground(Integer.MAX_VALUE, -1,
+                false);
+
+        assertThat(taskList).hasSize(3);
+        assertThat(taskList.get(2).taskViewType).isEqualTo(TaskViewType.DESKTOP);
+        List<Task> actualFreeformTasksInDesk1 = taskList.get(2).getTasks();
+        assertThat(actualFreeformTasksInDesk1).hasSize(2);
+        assertThat(actualFreeformTasksInDesk1.get(0).key.id).isEqualTo(1);
+        assertThat(actualFreeformTasksInDesk1.get(0).isMinimized).isFalse();
+        assertThat(actualFreeformTasksInDesk1.get(1).key.id).isEqualTo(4);
+        assertThat(actualFreeformTasksInDesk1.get(1).isMinimized).isFalse();
+        assertThat(((DesktopTask) taskList.get(2)).getDeskId()).isEqualTo(1);
+        assertThat(((DesktopTask) taskList.get(2)).getDisplayId()).isEqualTo(DEFAULT_DISPLAY);
+
+        assertThat(taskList.get(1).taskViewType).isEqualTo(TaskViewType.DESKTOP);
+        List<Task> actualFreeformTasksInDesk2 = taskList.get(1).getTasks();
+        assertThat(actualFreeformTasksInDesk2).hasSize(2);
+        assertThat(actualFreeformTasksInDesk2.get(0).key.id).isEqualTo(2);
+        assertThat(actualFreeformTasksInDesk2.get(0).isMinimized).isFalse();
+        assertThat(actualFreeformTasksInDesk2.get(1).key.id).isEqualTo(3);
+        assertThat(actualFreeformTasksInDesk2.get(1).isMinimized).isFalse();
+        assertThat(((DesktopTask) taskList.get(1)).getDeskId()).isEqualTo(2);
+        assertThat(((DesktopTask) taskList.get(1)).getDisplayId()).isEqualTo(DEFAULT_DISPLAY);
+
+        assertThat(taskList.get(0).taskViewType).isEqualTo(TaskViewType.DESKTOP);
+        List<Task> actualFreeformTasksInDesk3 = taskList.get(0).getTasks();
+        assertThat(actualFreeformTasksInDesk3).hasSize(2);
+        assertThat(actualFreeformTasksInDesk3.get(0).key.id).isEqualTo(5);
+        assertThat(actualFreeformTasksInDesk3.get(0).isMinimized).isFalse();
+        assertThat(actualFreeformTasksInDesk3.get(1).key.id).isEqualTo(6);
+        assertThat(actualFreeformTasksInDesk3.get(1).isMinimized).isFalse();
+        assertThat(((DesktopTask) taskList.get(0)).getDeskId()).isEqualTo(3);
+        assertThat(((DesktopTask) taskList.get(0)).getDisplayId()).isEqualTo(1);
+    }
+
+    @Test
     public void loadTasksInBackground_moreThanKeys_hasValidTaskDescription() throws Exception  {
         String taskDescription = "Wheeee!";
         RecentTaskInfo task1 = new RecentTaskInfo();
@@ -175,7 +236,8 @@
     }
 
     @Test
-    @DisableFlags(FLAG_ENABLE_SEPARATE_EXTERNAL_DISPLAY_TASKS)
+    @DisableFlags({FLAG_ENABLE_SEPARATE_EXTERNAL_DISPLAY_TASKS,
+            FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND})
     public void loadTasksInBackground_freeformTask_createsDesktopTask() throws Exception  {
         List<TaskInfo> tasks = Arrays.asList(
                 createRecentTaskInfo(1 /* taskId */, DEFAULT_DISPLAY),
@@ -183,7 +245,8 @@
                 createRecentTaskInfo(5 /* taskId */, 1 /* displayId */),
                 createRecentTaskInfo(6 /* taskId */, 1 /* displayId */));
         GroupedTaskInfo recentTaskInfos = GroupedTaskInfo.forDeskTasks(
-                0 /* deskId */, tasks, Collections.emptySet() /* minimizedTaskIds */);
+                0 /* deskId */, DEFAULT_DISPLAY, tasks,
+                Collections.emptySet() /* minimizedTaskIds */);
         when(mSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
                 .thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
 
@@ -214,7 +277,8 @@
                 createRecentTaskInfo(5 /* taskId */, 1 /* displayId */),
                 createRecentTaskInfo(6 /* taskId */, 1 /* displayId */));
         GroupedTaskInfo recentTaskInfos = GroupedTaskInfo.forDeskTasks(
-                0 /* deskId */, tasks, Collections.emptySet() /* minimizedTaskIds */);
+                0 /* deskId */, DEFAULT_DISPLAY, tasks,
+                Collections.emptySet() /* minimizedTaskIds */);
         when(mSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
                 .thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
 
@@ -248,7 +312,7 @@
         Set<Integer> minimizedTaskIds =
                 Arrays.stream(new Integer[]{1, 4, 5}).collect(Collectors.toSet());
         GroupedTaskInfo recentTaskInfos = GroupedTaskInfo.forDeskTasks(
-                0 /* deskId */, tasks, minimizedTaskIds);
+                0 /* deskId */, DEFAULT_DISPLAY, tasks, minimizedTaskIds);
         when(mSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
                 .thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
 
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/recents/data/TasksRepositoryTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/recents/data/TasksRepositoryTest.kt
index 6790567..e22892c 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/recents/data/TasksRepositoryTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/recents/data/TasksRepositoryTest.kt
@@ -21,6 +21,7 @@
 import android.graphics.Bitmap
 import android.graphics.Rect
 import android.graphics.drawable.Drawable
+import android.view.Display.DEFAULT_DISPLAY
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import com.android.launcher3.util.SplitConfigurationOptions
 import com.android.launcher3.util.TestDispatcherProvider
@@ -64,7 +65,7 @@
                     /* snapPosition = */ SNAP_TO_2_50_50,
                 ),
             ),
-            DesktopTask(deskId = 0, tasks.subList(3, 6)),
+            DesktopTask(deskId = 0, DEFAULT_DISPLAY, tasks.subList(3, 6)),
         )
     private val recentsModel = FakeRecentTasksDataSource()
     private val taskThumbnailDataSource = FakeTaskThumbnailDataSource()
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/DesktopTaskTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/DesktopTaskTest.kt
index 6fbf482..15da4d4 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/DesktopTaskTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/DesktopTaskTest.kt
@@ -18,6 +18,7 @@
 
 import android.content.ComponentName
 import android.content.Intent
+import android.view.Display.DEFAULT_DISPLAY
 import com.android.launcher3.util.LauncherMultivalentJUnit
 import com.android.systemui.shared.recents.model.Task
 import com.google.common.truth.Truth.assertThat
@@ -29,42 +30,42 @@
 
     @Test
     fun testDesktopTask_sameInstance_isEqual() {
-        val task = DesktopTask(deskId = 0, createTasks(1))
+        val task = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1))
         assertThat(task).isEqualTo(task)
     }
 
     @Test
     fun testDesktopTask_identicalConstructor_isEqual() {
-        val task1 = DesktopTask(deskId = 0, createTasks(1))
-        val task2 = DesktopTask(deskId = 0, createTasks(1))
+        val task1 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1))
+        val task2 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1))
         assertThat(task1).isEqualTo(task2)
     }
 
     @Test
     fun testDesktopTask_copy_isEqual() {
-        val task1 = DesktopTask(deskId = 0, createTasks(1))
+        val task1 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1))
         val task2 = task1.copy()
         assertThat(task1).isEqualTo(task2)
     }
 
     @Test
     fun testDesktopTask_differentDeskIds_isNotEqual() {
-        val task1 = DesktopTask(deskId = 0, createTasks(1))
-        val task2 = DesktopTask(deskId = 1, createTasks(1))
+        val task1 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1))
+        val task2 = DesktopTask(deskId = 1, DEFAULT_DISPLAY, createTasks(1))
         assertThat(task1).isNotEqualTo(task2)
     }
 
     @Test
     fun testDesktopTask_differentTaskIds_isNotEqual() {
-        val task1 = DesktopTask(deskId = 0, createTasks(1))
-        val task2 = DesktopTask(deskId = 0, createTasks(2))
+        val task1 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1))
+        val task2 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(2))
         assertThat(task1).isNotEqualTo(task2)
     }
 
     @Test
     fun testDesktopTask_differentLength_isNotEqual() {
-        val task1 = DesktopTask(deskId = 0, createTasks(1))
-        val task2 = DesktopTask(deskId = 0, createTasks(1, 2))
+        val task1 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1))
+        val task2 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, createTasks(1, 2))
         assertThat(task1).isNotEqualTo(task2)
     }
 
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/GroupTaskTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/GroupTaskTest.kt
index 67fc62f..9f49171 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/GroupTaskTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/GroupTaskTest.kt
@@ -19,6 +19,7 @@
 import android.content.ComponentName
 import android.content.Intent
 import android.graphics.Rect
+import android.view.Display.DEFAULT_DISPLAY
 import com.android.launcher3.util.LauncherMultivalentJUnit
 import com.android.launcher3.util.SplitConfigurationOptions
 import com.android.systemui.shared.recents.model.Task
@@ -98,7 +99,7 @@
     @Test
     fun testGroupTask_differentType_isNotEqual() {
         val task1 = SingleTask(createTask(1))
-        val task2 = DesktopTask(deskId = 0, listOf(createTask(1)))
+        val task2 = DesktopTask(deskId = 0, DEFAULT_DISPLAY, listOf(createTask(1)))
         assertThat(task1).isNotEqualTo(task2)
     }