• 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 package com.android.wm.shell.desktopmode.multidesks
17 
18 import android.os.IBinder
19 
20 /** Represents shell-started transitions involving desks. */
21 sealed interface DeskTransition {
22     /** The transition token. */
23     val token: IBinder
24 
25     /** Returns a copy of this desk transition with a new transition token. */
copyWithTokennull26     fun copyWithToken(token: IBinder): DeskTransition
27 
28     /** A transition to remove a desk and its tasks from a display. */
29     data class RemoveDesk(
30         override val token: IBinder,
31         val displayId: Int,
32         val deskId: Int,
33         val tasks: Set<Int>,
34         val onDeskRemovedListener: OnDeskRemovedListener?,
35     ) : DeskTransition {
36         override fun copyWithToken(token: IBinder): DeskTransition = copy(token)
37     }
38 
39     /** A transition to activate a desk in its display. */
40     data class ActivateDesk(override val token: IBinder, val displayId: Int, val deskId: Int) :
41         DeskTransition {
copyWithTokennull42         override fun copyWithToken(token: IBinder): DeskTransition = copy(token)
43     }
44 
45     /** A transition to activate a desk by moving an outside task to it. */
46     data class ActiveDeskWithTask(
47         override val token: IBinder,
48         val displayId: Int,
49         val deskId: Int,
50         val enterTaskId: Int,
51     ) : DeskTransition {
52         override fun copyWithToken(token: IBinder): DeskTransition = copy(token)
53     }
54 
55     /** A transition to deactivate a desk. */
56     data class DeactivateDesk(override val token: IBinder, val deskId: Int) : DeskTransition {
copyWithTokennull57         override fun copyWithToken(token: IBinder): DeskTransition = copy(token)
58     }
59 }
60