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