1 /*
2  * Copyright (C) 2024 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.wm.shell.shared.desktopmode
18 
19 import android.os.Parcel
20 import android.os.Parcelable
21 
22 /** Transition source types for Desktop Mode. */
23 enum class DesktopModeTransitionSource : Parcelable {
24     /** Transitions that originated as a consequence of task dragging. */
25     TASK_DRAG,
26     /** Transitions that originated from an app from Overview. */
27     APP_FROM_OVERVIEW,
28     /** Transitions that originated from app handle menu button */
29     APP_HANDLE_MENU_BUTTON,
30     /** Transitions that originated as a result of keyboard shortcuts. */
31     KEYBOARD_SHORTCUT,
32     /** Transitions with source unknown. */
33     UNKNOWN;
34 
describeContentsnull35     override fun describeContents(): Int {
36         return 0
37     }
38 
writeToParcelnull39     override fun writeToParcel(dest: Parcel, flags: Int) {
40         dest.writeString(name)
41     }
42 
43     companion object {
44         @JvmField
45         val CREATOR =
46             object : Parcelable.Creator<DesktopModeTransitionSource> {
createFromParcelnull47                 override fun createFromParcel(parcel: Parcel): DesktopModeTransitionSource {
48                     return parcel.readString()?.let { valueOf(it) } ?: UNKNOWN
49                 }
50 
newArraynull51                 override fun newArray(size: Int) = arrayOfNulls<DesktopModeTransitionSource>(size)
52             }
53     }
54 }
55