From 68e116e79ffc8455014443f3eba541224bb7368a Mon Sep 17 00:00:00 2001 From: minch Date: Tue, 11 Mar 2025 23:19:03 +0000 Subject: [PATCH] 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 --- .../android/quickstep/RecentTasksList.java | 5 +- .../com/android/quickstep/util/DesktopTask.kt | 15 ++-- .../com/android/quickstep/util/GroupTask.kt | 2 + .../quickstep/views/DesktopTaskView.kt | 19 ++++- .../android/quickstep/views/RecentsView.java | 6 +- .../com/android/quickstep/views/TaskView.kt | 11 +-- .../launcher3/taskbar/TaskbarOverflowTest.kt | 3 +- .../TaskbarRecentAppsControllerTest.kt | 3 +- .../quickstep/RecentTasksListTest.java | 72 +++++++++++++++++-- .../recents/data/TasksRepositoryTest.kt | 3 +- .../android/quickstep/util/DesktopTaskTest.kt | 21 +++--- .../android/quickstep/util/GroupTaskTest.kt | 3 +- 12 files changed, 127 insertions(+), 36 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index cc5b2dabb7..dab78c5df3 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -511,13 +511,14 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList // 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 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 fbe3bc64d0..7c2729346c 100644 --- a/quickstep/src/com/android/quickstep/util/DesktopTask.kt +++ b/quickstep/src/com/android/quickstep/util/DesktopTask.kt @@ -17,22 +17,27 @@ package com.android.quickstep.util 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) : GroupTask(tasks, TaskViewType.DESKTOP) { +class DesktopTask(val deskId: Int, val displayId: Int, tasks: List) : + 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 add8821b06..2b754e2e0d 100644 --- a/quickstep/src/com/android/quickstep/util/GroupTask.kt +++ b/quickstep/src/com/android/quickstep/util/GroupTask.kt @@ -86,6 +86,8 @@ class SingleTask(task: Task) : GroupTask(listOf(task), TaskViewType.SINGLE) { 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 27657b4c0f..8876633bd3 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.graphics.RectF 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.TaskContentView 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 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu 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 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu 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 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu 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 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu 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 6067550507..722ef56ec6 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.annotation.UiThread; 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 @@ public abstract class RecentsView< // 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 @@ public abstract class RecentsView< // `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 8d95b131bf..4f7fe31fed 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.kt +++ b/quickstep/src/com/android/quickstep/views/TaskView.kt @@ -146,7 +146,7 @@ constructor( 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 @@ constructor( } 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 37610444b5..c589415196 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.os.Process 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 @@ class TaskbarOverflowTest { ) }) - 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 8376bc183c..8758d7cd6d 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.graphics.Rect 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 @@ class TaskbarRecentAppsControllerTest : TaskbarBaseTestCase() { val allTasks = ArrayList().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 9722e9dd99..1e4315a040 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.internal.R; 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; @@ -147,6 +148,66 @@ public class RecentTasksListTest { assertThat(taskList).isEmpty(); } + @Test + @EnableFlags(FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND) + public void loadTasksInBackground_freeformTask_multiDesksInMultiDisplays() throws Exception { + List tasksInDefaultDesk1 = Arrays.asList( + createRecentTaskInfo(/* taskId = */ 1, DEFAULT_DISPLAY), + createRecentTaskInfo(/* taskId = */ 4, DEFAULT_DISPLAY)); + List tasksInDefaultDesk2 = Arrays.asList( + createRecentTaskInfo(/* taskId = */ 2, DEFAULT_DISPLAY), + createRecentTaskInfo(/* taskId = */ 3, DEFAULT_DISPLAY)); + List 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 taskList = mRecentTasksList.loadTasksInBackground(Integer.MAX_VALUE, -1, + false); + + assertThat(taskList).hasSize(3); + assertThat(taskList.get(2).taskViewType).isEqualTo(TaskViewType.DESKTOP); + List 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 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 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!"; @@ -175,7 +236,8 @@ public class RecentTasksListTest { } @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 tasks = Arrays.asList( createRecentTaskInfo(1 /* taskId */, DEFAULT_DISPLAY), @@ -183,7 +245,8 @@ public class RecentTasksListTest { 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 @@ public class RecentTasksListTest { 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 @@ public class RecentTasksListTest { Set 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 6790567a85..e22892c9cc 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.content.Intent 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 @@ class TasksRepositoryTest { /* 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 6fbf4823b7..15da4d4def 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 @@ package com.android.quickstep.util 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 @@ class DesktopTaskTest { @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 67fc62f772..9f491717c4 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 @@ package com.android.quickstep.util 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 @@ class GroupTaskTest { @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) }