From 5ab6c2e68a611c66c5387649b010edabf73733ed Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Sat, 1 Feb 2025 09:58:55 +0000 Subject: [PATCH] Consider tasks with INVALID_DISPLAY as it's on DEFAULT_DISPLAY - In the test environment, some main display tasks can have INVALID_DISPLAY (-1) as their displayId, we should consider them as main display tasks or else they'll be sorted to an unexpected section in RecentsView Bug: 391311008 Test: TaplTestsQuickstep#testQuickSwitchFromHome Flag: com.android.launcher3.enable_separate_external_display_tasks Change-Id: I5a89d91e342557e114eae6796e153a160d729301 --- .../src/com/android/quickstep/util/ExternalDisplays.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/util/ExternalDisplays.kt b/quickstep/src/com/android/quickstep/util/ExternalDisplays.kt index e1a8578dd9..455b3121ec 100644 --- a/quickstep/src/com/android/quickstep/util/ExternalDisplays.kt +++ b/quickstep/src/com/android/quickstep/util/ExternalDisplays.kt @@ -17,6 +17,7 @@ package com.android.quickstep.util import android.view.Display.DEFAULT_DISPLAY +import android.view.Display.INVALID_DISPLAY import com.android.systemui.shared.recents.model.Task /** Whether this displayId belongs to an external display */ @@ -25,7 +26,14 @@ val Int.isExternalDisplay /** Returns displayId of this [Task], default to [DEFAULT_DISPLAY] */ val Task?.displayId - get() = this?.key?.displayId ?: DEFAULT_DISPLAY + get() = + this?.key?.displayId.let { displayId -> + when (displayId) { + null -> DEFAULT_DISPLAY + INVALID_DISPLAY -> DEFAULT_DISPLAY + else -> displayId + } + } /** Returns if this task belongs tto [DEFAULT_DISPLAY] */ val Task?.isExternalDisplay