1 /*
2  * Copyright (C) 2023 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 android.tools
18 
19 object PlatformConsts {
20     /**
21      * The default Display id, which is the id of the primary display assuming there is one.
22      *
23      * Duplicated from [Display.DEFAULT_DISPLAY] because this class is used by JVM and KotlinJS
24      */
25     const val DEFAULT_DISPLAY = 0
26 
27     /**
28      * Window type: an application window that serves as the "base" window of the overall
29      * application
30      *
31      * Duplicated from [WindowManager.LayoutParams.TYPE_BASE_APPLICATION] because this class is used
32      * by JVM and KotlinJS
33      */
34     const val TYPE_BASE_APPLICATION = 1
35 
36     /**
37      * Window type: special application window that is displayed while the application is starting
38      *
39      * Duplicated from [WindowManager.LayoutParams.TYPE_APPLICATION_STARTING] because this class is
40      * used by JVM and KotlinJS
41      */
42     const val TYPE_APPLICATION_STARTING = 3
43 
44     /**
45      * Rotation constant: 0 degrees rotation (natural orientation)
46      *
47      * Duplicated from [Surface.ROTATION_0] because this class is used by JVM and KotlinJS
48      */
49     const val ROTATION_0 = 0
50 
51     /**
52      * Rotation constant: 90 degrees rotation.
53      *
54      * Duplicated from [Surface.ROTATION_90] because this class is used by JVM and KotlinJS
55      */
56     const val ROTATION_90 = 1
57 
58     /**
59      * Rotation constant: 180 degrees rotation.
60      *
61      * Duplicated from [Surface.ROTATION_180] because this class is used by JVM and KotlinJS
62      */
63     const val ROTATION_180 = 2
64 
65     /**
66      * Rotation constant: 270 degrees rotation.
67      *
68      * Duplicated from [Surface.ROTATION_270] because this class is used by JVM and KotlinJS
69      */
70     const val ROTATION_270 = 3
71 
72     /**
73      * Navigation bar mode constant: 3 button navigation.
74      *
75      * Duplicated from [WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY] because this
76      * class is used by JVM and KotlinJS
77      */
78     const val MODE_GESTURAL = "com.android.internal.systemui.navbar.gestural"
79 
80     /**
81      * Navigation bar mode : gestural navigation.
82      *
83      * Duplicated from [WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY] because this
84      * class is used by JVM and KotlinJS
85      */
86     const val MODE_3BUTTON = "com.android.internal.systemui.navbar.threebutton"
87 
88     internal const val STATE_INITIALIZING = "INITIALIZING"
89     const val STATE_RESUMED = "RESUMED"
90     const val STATE_PAUSED = "PAUSED"
91     const val STATE_STOPPED = "STOPPED"
92     const val STATE_DESTROYED = "DESTROYED"
93     internal const val APP_STATE_IDLE = "APP_STATE_IDLE"
94     internal const val ACTIVITY_TYPE_UNDEFINED = 0
95     internal const val ACTIVITY_TYPE_STANDARD = 1
96     internal const val DEFAULT_MINIMAL_SPLIT_SCREEN_DISPLAY_SIZE_DP = 440
97     internal const val ACTIVITY_TYPE_HOME = 2
98     internal const val ACTIVITY_TYPE_RECENTS = 3
99     internal const val WINDOWING_MODE_UNDEFINED = 0
100 
101     /** @see android.app.WindowConfiguration.WINDOWING_MODE_PINNED */
102     internal const val WINDOWING_MODE_PINNED = 2
103 
104     /** @see android.view.WindowManager.LayoutParams */
105     internal const val TYPE_NAVIGATION_BAR_PANEL = 2024
106 
107     // Default minimal size of resizable task, used if none is set explicitly.
108     // Must be kept in sync with 'default_minimal_size_resizable_task'
109     // dimen from frameworks/base.
110     internal const val DEFAULT_RESIZABLE_TASK_SIZE_DP = 220
111 
112     /** From [android.util.DisplayMetrics] */
113     internal const val DENSITY_DEFAULT = 160f
114 
115     /** From [com.android.systemui.shared.recents.utilities.Utilities] */
116     internal const val TABLET_MIN_DPS = 600f
117 
118     /**
119      * From {@see android.view.WindowManager.FLAG_FULLSCREEN}.
120      *
121      * This class is shared between JVM and JS (Winscope) and cannot access Android internals
122      */
123     internal const val FLAG_FULLSCREEN = 0x00000400
124     internal const val WINDOW_TYPE_STARTING = 1
125     internal const val WINDOW_TYPE_EXITING = 2
126     internal const val WINDOW_TYPE_DEBUGGER = 3
127 
128     internal const val STARTING_WINDOW_PREFIX = "Starting "
129     internal const val DEBUGGER_WINDOW_PREFIX = "Waiting For Debugger: "
130 
131     const val SPLIT_SCREEN_TRANSITION_HANDLER = "com.android.wm.shell.splitscreen.StageCoordinator"
132 }
133