• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.quickstep.recents.ui.viewmodel
18 
19 import android.graphics.drawable.Drawable
20 import com.android.systemui.shared.recents.model.ThumbnailData
21 
22 /**
23  * This class represents the UI state to be consumed by TaskView, GroupTaskView and DesktopTaskView.
24  * Data class representing the state of a list of tasks.
25  *
26  * This class encapsulates a list of [TaskTileUiState] objects, along with a flag indicating whether
27  * the data is being used for a live tile display.
28  *
29  * @property tasks The list of [TaskTileUiState] objects representing the individual tasks.
30  * @property isLiveTile Indicates whether this data is intended for a live tile. If `true`, the
31  *   running app will be displayed instead of the thumbnail.
32  * @property sysUiStatusNavFlags Flags for status bar and navigation bar
33  */
34 data class TaskTileUiState(
35     val tasks: List<TaskData>,
36     val isLiveTile: Boolean,
37     val hasHeader: Boolean,
38     val sysUiStatusNavFlags: Int,
39     val taskOverlayEnabled: Boolean,
40     val isCentralTask: Boolean,
41 )
42 
43 sealed class TaskData {
44     abstract val taskId: Int
45 
46     /** When no data was found for the TaskId provided */
47     data class NoData(override val taskId: Int) : TaskData()
48 
49     /**
50      * This class provides UI information related to a Task (App) to be displayed within a TaskView.
51      *
52      * @property taskId Identifier of the task
53      * @property title App title
54      * @property titleDescription App content description
55      * @property icon App icon
56      * @property thumbnailData Information related to the last snapshot retrieved from the app
57      * @property backgroundColor The background color of the task.
58      * @property isLocked Indicates whether the task is locked or not.
59      */
60     data class Data(
61         override val taskId: Int,
62         val title: String?,
63         val titleDescription: String?,
64         val icon: Drawable?,
65         val thumbnailData: ThumbnailData?,
66         val backgroundColor: Int,
67         val isLocked: Boolean,
68     ) : TaskData()
69 }
70