Maintain Running Tasks order in Desktop mode
Fixes: 345034545 Test: TaskbarRecentAppsControllerTest Flag: com.android.launcher3.enable_recents_in_taskbar Change-Id: I4ab856c5293625c5279d4713450e5ea2d3b0ed85
This commit is contained in:
1 parent
2021727f1e
commit
7c7c90528d
2 files changed
+81
-2
No files matched your search
@@ -156,9 +156,16 @@ class TaskbarRecentAppsController(
|
||||
}
|
||||
val tasks = desktopTask?.tasks ?: emptyList()
|
||||
// Kind of hacky, we wrap each single task in the Desktop as a GroupTask.
|
||||
val desktopTaskAsList = tasks.map { GroupTask(it) }
|
||||
var desktopTaskAsList = tasks.map { GroupTask(it) }
|
||||
// TODO(b/315344726 Multi-instance support): dedupe Tasks of the same package too.
|
||||
return dedupeHotseatTasks(desktopTaskAsList, shownHotseatItems)
|
||||
desktopTaskAsList = dedupeHotseatTasks(desktopTaskAsList, shownHotseatItems)
|
||||
val desktopPackages = desktopTaskAsList.map { it.packageNames }
|
||||
// Remove any missing Tasks.
|
||||
val newShownTasks = shownTasks.filter { it.packageNames in desktopPackages }.toMutableList()
|
||||
val newShownPackages = newShownTasks.map { it.packageNames }
|
||||
// Add any new Tasks, maintaining the order from previous shownTasks.
|
||||
newShownTasks.addAll(desktopTaskAsList.filter { it.packageNames !in newShownPackages })
|
||||
return newShownTasks.toList()
|
||||
}
|
||||
|
||||
private fun computeShownRecentTasks(): List<GroupTask> {
|
||||
|
||||
Reference in new issue
Block a user