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