xref: /aosp_15_r20/frameworks/native/include/android/window.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker  * Copyright (C) 2010 The Android Open Source Project
3*38e8c45fSAndroid Build Coastguard Worker  *
4*38e8c45fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*38e8c45fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*38e8c45fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*38e8c45fSAndroid Build Coastguard Worker  *
8*38e8c45fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*38e8c45fSAndroid Build Coastguard Worker  *
10*38e8c45fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*38e8c45fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*38e8c45fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*38e8c45fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*38e8c45fSAndroid Build Coastguard Worker  * limitations under the License.
15*38e8c45fSAndroid Build Coastguard Worker  */
16*38e8c45fSAndroid Build Coastguard Worker 
17*38e8c45fSAndroid Build Coastguard Worker /**
18*38e8c45fSAndroid Build Coastguard Worker  * @addtogroup NativeActivity Native Activity
19*38e8c45fSAndroid Build Coastguard Worker  * @{
20*38e8c45fSAndroid Build Coastguard Worker  */
21*38e8c45fSAndroid Build Coastguard Worker 
22*38e8c45fSAndroid Build Coastguard Worker /**
23*38e8c45fSAndroid Build Coastguard Worker  * @file window.h
24*38e8c45fSAndroid Build Coastguard Worker  */
25*38e8c45fSAndroid Build Coastguard Worker 
26*38e8c45fSAndroid Build Coastguard Worker #ifndef ANDROID_WINDOW_H
27*38e8c45fSAndroid Build Coastguard Worker #define ANDROID_WINDOW_H
28*38e8c45fSAndroid Build Coastguard Worker 
29*38e8c45fSAndroid Build Coastguard Worker #ifdef __cplusplus
30*38e8c45fSAndroid Build Coastguard Worker extern "C" {
31*38e8c45fSAndroid Build Coastguard Worker #endif
32*38e8c45fSAndroid Build Coastguard Worker 
33*38e8c45fSAndroid Build Coastguard Worker /**
34*38e8c45fSAndroid Build Coastguard Worker  * Window flags, as per the Java API at android.view.WindowManager.LayoutParams.
35*38e8c45fSAndroid Build Coastguard Worker  */
36*38e8c45fSAndroid Build Coastguard Worker enum {
37*38e8c45fSAndroid Build Coastguard Worker     /**
38*38e8c45fSAndroid Build Coastguard Worker      * As long as this window is visible to the user, allow the lock
39*38e8c45fSAndroid Build Coastguard Worker      * screen to activate while the screen is on.  This can be used
40*38e8c45fSAndroid Build Coastguard Worker      * independently, or in combination with {@link
41*38e8c45fSAndroid Build Coastguard Worker      * AWINDOW_FLAG_KEEP_SCREEN_ON} and/or {@link
42*38e8c45fSAndroid Build Coastguard Worker      * AWINDOW_FLAG_SHOW_WHEN_LOCKED}
43*38e8c45fSAndroid Build Coastguard Worker      */
44*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001,
45*38e8c45fSAndroid Build Coastguard Worker     /** Everything behind this window will be dimmed. */
46*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_DIM_BEHIND                 = 0x00000002,
47*38e8c45fSAndroid Build Coastguard Worker     /**
48*38e8c45fSAndroid Build Coastguard Worker      * Blur everything behind this window.
49*38e8c45fSAndroid Build Coastguard Worker      * @deprecated Blurring is no longer supported.
50*38e8c45fSAndroid Build Coastguard Worker      */
51*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_BLUR_BEHIND                = 0x00000004,
52*38e8c45fSAndroid Build Coastguard Worker     /**
53*38e8c45fSAndroid Build Coastguard Worker      * This window won't ever get key input focus, so the
54*38e8c45fSAndroid Build Coastguard Worker      * user can not send key or other button events to it.  Those will
55*38e8c45fSAndroid Build Coastguard Worker      * instead go to whatever focusable window is behind it.  This flag
56*38e8c45fSAndroid Build Coastguard Worker      * will also enable {@link AWINDOW_FLAG_NOT_TOUCH_MODAL} whether or not that
57*38e8c45fSAndroid Build Coastguard Worker      * is explicitly set.
58*38e8c45fSAndroid Build Coastguard Worker      *
59*38e8c45fSAndroid Build Coastguard Worker      * Setting this flag also implies that the window will not need to
60*38e8c45fSAndroid Build Coastguard Worker      * interact with
61*38e8c45fSAndroid Build Coastguard Worker      * a soft input method, so it will be Z-ordered and positioned
62*38e8c45fSAndroid Build Coastguard Worker      * independently of any active input method (typically this means it
63*38e8c45fSAndroid Build Coastguard Worker      * gets Z-ordered on top of the input method, so it can use the full
64*38e8c45fSAndroid Build Coastguard Worker      * screen for its content and cover the input method if needed.  You
65*38e8c45fSAndroid Build Coastguard Worker      * can use {@link AWINDOW_FLAG_ALT_FOCUSABLE_IM} to modify this behavior.
66*38e8c45fSAndroid Build Coastguard Worker      */
67*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_NOT_FOCUSABLE              = 0x00000008,
68*38e8c45fSAndroid Build Coastguard Worker     /** this window can never receive touch events. */
69*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_NOT_TOUCHABLE              = 0x00000010,
70*38e8c45fSAndroid Build Coastguard Worker     /**
71*38e8c45fSAndroid Build Coastguard Worker      * Even when this window is focusable (its
72*38e8c45fSAndroid Build Coastguard Worker      * {@link AWINDOW_FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
73*38e8c45fSAndroid Build Coastguard Worker      * outside of the window to be sent to the windows behind it.  Otherwise
74*38e8c45fSAndroid Build Coastguard Worker      * it will consume all pointer events itself, regardless of whether they
75*38e8c45fSAndroid Build Coastguard Worker      * are inside of the window.
76*38e8c45fSAndroid Build Coastguard Worker      */
77*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_NOT_TOUCH_MODAL            = 0x00000020,
78*38e8c45fSAndroid Build Coastguard Worker     /**
79*38e8c45fSAndroid Build Coastguard Worker      * When set, if the device is asleep when the touch
80*38e8c45fSAndroid Build Coastguard Worker      * screen is pressed, you will receive this first touch event.  Usually
81*38e8c45fSAndroid Build Coastguard Worker      * the first touch event is consumed by the system since the user can
82*38e8c45fSAndroid Build Coastguard Worker      * not see what they are pressing on.
83*38e8c45fSAndroid Build Coastguard Worker      *
84*38e8c45fSAndroid Build Coastguard Worker      * @deprecated This flag has no effect.
85*38e8c45fSAndroid Build Coastguard Worker      */
86*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING      = 0x00000040,
87*38e8c45fSAndroid Build Coastguard Worker     /**
88*38e8c45fSAndroid Build Coastguard Worker      * As long as this window is visible to the user, keep
89*38e8c45fSAndroid Build Coastguard Worker      * the device's screen turned on and bright.
90*38e8c45fSAndroid Build Coastguard Worker      */
91*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_KEEP_SCREEN_ON             = 0x00000080,
92*38e8c45fSAndroid Build Coastguard Worker     /**
93*38e8c45fSAndroid Build Coastguard Worker      * Place the window within the entire screen, ignoring
94*38e8c45fSAndroid Build Coastguard Worker      * decorations around the border (such as the status bar).  The
95*38e8c45fSAndroid Build Coastguard Worker      * window must correctly position its contents to take the screen
96*38e8c45fSAndroid Build Coastguard Worker      * decoration into account.
97*38e8c45fSAndroid Build Coastguard Worker      */
98*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_LAYOUT_IN_SCREEN           = 0x00000100,
99*38e8c45fSAndroid Build Coastguard Worker     /** allow window to extend outside of the screen. */
100*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_LAYOUT_NO_LIMITS           = 0x00000200,
101*38e8c45fSAndroid Build Coastguard Worker     /**
102*38e8c45fSAndroid Build Coastguard Worker      * Hide all screen decorations (such as the status
103*38e8c45fSAndroid Build Coastguard Worker      * bar) while this window is displayed.  This allows the window to
104*38e8c45fSAndroid Build Coastguard Worker      * use the entire display space for itself -- the status bar will
105*38e8c45fSAndroid Build Coastguard Worker      * be hidden when an app window with this flag set is on the top
106*38e8c45fSAndroid Build Coastguard Worker      * layer. A fullscreen window will ignore a value of
107*38e8c45fSAndroid Build Coastguard Worker      * <a href="/reference/android/view/WindowManager.LayoutParams#SOFT_INPUT_ADJUST_RESIZE">
108*38e8c45fSAndroid Build Coastguard Worker      * SOFT_INPUT_ADJUST_RESIZE</a>; the window will stay
109*38e8c45fSAndroid Build Coastguard Worker      * fullscreen and will not resize.
110*38e8c45fSAndroid Build Coastguard Worker      */
111*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_FULLSCREEN                 = 0x00000400,
112*38e8c45fSAndroid Build Coastguard Worker     /**
113*38e8c45fSAndroid Build Coastguard Worker      * Override {@link AWINDOW_FLAG_FULLSCREEN} and force the
114*38e8c45fSAndroid Build Coastguard Worker      * screen decorations (such as the status bar) to be shown.
115*38e8c45fSAndroid Build Coastguard Worker      */
116*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_FORCE_NOT_FULLSCREEN       = 0x00000800,
117*38e8c45fSAndroid Build Coastguard Worker     /**
118*38e8c45fSAndroid Build Coastguard Worker      * Turn on dithering when compositing this window to
119*38e8c45fSAndroid Build Coastguard Worker      * the screen.
120*38e8c45fSAndroid Build Coastguard Worker      * @deprecated This flag is no longer used.
121*38e8c45fSAndroid Build Coastguard Worker      */
122*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_DITHER                     = 0x00001000,
123*38e8c45fSAndroid Build Coastguard Worker     /**
124*38e8c45fSAndroid Build Coastguard Worker      * Treat the content of the window as secure, preventing
125*38e8c45fSAndroid Build Coastguard Worker      * it from appearing in screenshots or from being viewed on non-secure
126*38e8c45fSAndroid Build Coastguard Worker      * displays.
127*38e8c45fSAndroid Build Coastguard Worker      */
128*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_SECURE                     = 0x00002000,
129*38e8c45fSAndroid Build Coastguard Worker     /**
130*38e8c45fSAndroid Build Coastguard Worker      * A special mode where the layout parameters are used
131*38e8c45fSAndroid Build Coastguard Worker      * to perform scaling of the surface when it is composited to the
132*38e8c45fSAndroid Build Coastguard Worker      * screen.
133*38e8c45fSAndroid Build Coastguard Worker      */
134*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_SCALED                     = 0x00004000,
135*38e8c45fSAndroid Build Coastguard Worker     /**
136*38e8c45fSAndroid Build Coastguard Worker      * Intended for windows that will often be used when the user is
137*38e8c45fSAndroid Build Coastguard Worker      * holding the screen against their face, it will aggressively
138*38e8c45fSAndroid Build Coastguard Worker      * filter the event stream to prevent unintended presses in this
139*38e8c45fSAndroid Build Coastguard Worker      * situation that may not be desired for a particular window, when
140*38e8c45fSAndroid Build Coastguard Worker      * such an event stream is detected, the application will receive
141*38e8c45fSAndroid Build Coastguard Worker      * a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so
142*38e8c45fSAndroid Build Coastguard Worker      * applications can handle this accordingly by taking no action on
143*38e8c45fSAndroid Build Coastguard Worker      * the event until the finger is released.
144*38e8c45fSAndroid Build Coastguard Worker      */
145*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_IGNORE_CHEEK_PRESSES       = 0x00008000,
146*38e8c45fSAndroid Build Coastguard Worker     /**
147*38e8c45fSAndroid Build Coastguard Worker      * A special option only for use in combination with
148*38e8c45fSAndroid Build Coastguard Worker      * {@link AWINDOW_FLAG_LAYOUT_IN_SCREEN}.  When requesting layout in the
149*38e8c45fSAndroid Build Coastguard Worker      * screen your window may appear on top of or behind screen decorations
150*38e8c45fSAndroid Build Coastguard Worker      * such as the status bar.  By also including this flag, the window
151*38e8c45fSAndroid Build Coastguard Worker      * manager will report the inset rectangle needed to ensure your
152*38e8c45fSAndroid Build Coastguard Worker      * content is not covered by screen decorations.
153*38e8c45fSAndroid Build Coastguard Worker      */
154*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_LAYOUT_INSET_DECOR         = 0x00010000,
155*38e8c45fSAndroid Build Coastguard Worker     /**
156*38e8c45fSAndroid Build Coastguard Worker      * Invert the state of {@link AWINDOW_FLAG_NOT_FOCUSABLE} with
157*38e8c45fSAndroid Build Coastguard Worker      * respect to how this window interacts with the current method.
158*38e8c45fSAndroid Build Coastguard Worker      * That is, if FLAG_NOT_FOCUSABLE is set and this flag is set,
159*38e8c45fSAndroid Build Coastguard Worker      * then the window will behave as if it needs to interact with the
160*38e8c45fSAndroid Build Coastguard Worker      * input method and thus be placed behind/away from it; if {@link
161*38e8c45fSAndroid Build Coastguard Worker      * AWINDOW_FLAG_NOT_FOCUSABLE} is not set and this flag is set,
162*38e8c45fSAndroid Build Coastguard Worker      * then the window will behave as if it doesn't need to interact
163*38e8c45fSAndroid Build Coastguard Worker      * with the input method and can be placed to use more space and
164*38e8c45fSAndroid Build Coastguard Worker      * cover the input method.
165*38e8c45fSAndroid Build Coastguard Worker      */
166*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_ALT_FOCUSABLE_IM           = 0x00020000,
167*38e8c45fSAndroid Build Coastguard Worker     /**
168*38e8c45fSAndroid Build Coastguard Worker      * If you have set {@link AWINDOW_FLAG_NOT_TOUCH_MODAL}, you
169*38e8c45fSAndroid Build Coastguard Worker      * can set this flag to receive a single special MotionEvent with
170*38e8c45fSAndroid Build Coastguard Worker      * the action
171*38e8c45fSAndroid Build Coastguard Worker      * {@link AMOTION_EVENT_ACTION_OUTSIDE} for
172*38e8c45fSAndroid Build Coastguard Worker      * touches that occur outside of your window.  Note that you will not
173*38e8c45fSAndroid Build Coastguard Worker      * receive the full down/move/up gesture, only the location of the
174*38e8c45fSAndroid Build Coastguard Worker      * first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}.
175*38e8c45fSAndroid Build Coastguard Worker      */
176*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH        = 0x00040000,
177*38e8c45fSAndroid Build Coastguard Worker     /**
178*38e8c45fSAndroid Build Coastguard Worker      * Special flag to let windows be shown when the screen
179*38e8c45fSAndroid Build Coastguard Worker      * is locked. This will let application windows take precedence over
180*38e8c45fSAndroid Build Coastguard Worker      * key guard or any other lock screens. Can be used with
181*38e8c45fSAndroid Build Coastguard Worker      * {@link AWINDOW_FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
182*38e8c45fSAndroid Build Coastguard Worker      * directly before showing the key guard window.  Can be used with
183*38e8c45fSAndroid Build Coastguard Worker      * {@link AWINDOW_FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
184*38e8c45fSAndroid Build Coastguard Worker      * non-secure keyguards.  This flag only applies to the top-most
185*38e8c45fSAndroid Build Coastguard Worker      * full-screen window.
186*38e8c45fSAndroid Build Coastguard Worker      */
187*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_SHOW_WHEN_LOCKED           = 0x00080000,
188*38e8c45fSAndroid Build Coastguard Worker     /**
189*38e8c45fSAndroid Build Coastguard Worker      * Ask that the system wallpaper be shown behind
190*38e8c45fSAndroid Build Coastguard Worker      * your window.  The window surface must be translucent to be able
191*38e8c45fSAndroid Build Coastguard Worker      * to actually see the wallpaper behind it; this flag just ensures
192*38e8c45fSAndroid Build Coastguard Worker      * that the wallpaper surface will be there if this window actually
193*38e8c45fSAndroid Build Coastguard Worker      * has translucent regions.
194*38e8c45fSAndroid Build Coastguard Worker      */
195*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_SHOW_WALLPAPER             = 0x00100000,
196*38e8c45fSAndroid Build Coastguard Worker     /**
197*38e8c45fSAndroid Build Coastguard Worker      * When set as a window is being added or made
198*38e8c45fSAndroid Build Coastguard Worker      * visible, once the window has been shown then the system will
199*38e8c45fSAndroid Build Coastguard Worker      * poke the power manager's user activity (as if the user had woken
200*38e8c45fSAndroid Build Coastguard Worker      * up the device) to turn the screen on.
201*38e8c45fSAndroid Build Coastguard Worker      */
202*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_TURN_SCREEN_ON             = 0x00200000,
203*38e8c45fSAndroid Build Coastguard Worker     /**
204*38e8c45fSAndroid Build Coastguard Worker      * When set the window will cause the keyguard to
205*38e8c45fSAndroid Build Coastguard Worker      * be dismissed, only if it is not a secure lock keyguard.  Because such
206*38e8c45fSAndroid Build Coastguard Worker      * a keyguard is not needed for security, it will never re-appear if
207*38e8c45fSAndroid Build Coastguard Worker      * the user navigates to another window (in contrast to
208*38e8c45fSAndroid Build Coastguard Worker      * {@link AWINDOW_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
209*38e8c45fSAndroid Build Coastguard Worker      * hide both secure and non-secure keyguards but ensure they reappear
210*38e8c45fSAndroid Build Coastguard Worker      * when the user moves to another UI that doesn't hide them).
211*38e8c45fSAndroid Build Coastguard Worker      * If the keyguard is currently active and is secure (requires an
212*38e8c45fSAndroid Build Coastguard Worker      * unlock pattern) than the user will still need to confirm it before
213*38e8c45fSAndroid Build Coastguard Worker      * seeing this window, unless {@link AWINDOW_FLAG_SHOW_WHEN_LOCKED} has
214*38e8c45fSAndroid Build Coastguard Worker      * also been set.
215*38e8c45fSAndroid Build Coastguard Worker      */
216*38e8c45fSAndroid Build Coastguard Worker     AWINDOW_FLAG_DISMISS_KEYGUARD           = 0x00400000,
217*38e8c45fSAndroid Build Coastguard Worker };
218*38e8c45fSAndroid Build Coastguard Worker 
219*38e8c45fSAndroid Build Coastguard Worker #ifdef __cplusplus
220*38e8c45fSAndroid Build Coastguard Worker };
221*38e8c45fSAndroid Build Coastguard Worker #endif
222*38e8c45fSAndroid Build Coastguard Worker 
223*38e8c45fSAndroid Build Coastguard Worker #endif // ANDROID_WINDOW_H
224*38e8c45fSAndroid Build Coastguard Worker 
225*38e8c45fSAndroid Build Coastguard Worker /** @} */
226