blob: 86402a7c6abebcce0c75e8ce211c331470bc14ad [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 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
17package android.view;
18
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020019import android.Manifest.permission;
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080020import android.annotation.IntDef;
Siva Velusamy0d857b92015-04-22 10:23:56 -070021import android.annotation.NonNull;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040022import android.annotation.RequiresPermission;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080023import android.annotation.SystemApi;
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060024import android.annotation.SystemService;
Robert Carrb48380a2017-04-04 14:56:37 -070025import android.annotation.TestApi;
Jorim Jaggi241ae102016-11-02 21:57:33 -070026import android.app.KeyguardManager;
Jeff Browna492c3a2012-08-23 19:48:44 -070027import android.app.Presentation;
28import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ActivityInfo;
30import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070031import android.graphics.Rect;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040032import android.graphics.Region;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.os.IBinder;
34import android.os.Parcel;
35import android.os.Parcelable;
36import android.text.TextUtils;
37import android.util.Log;
38
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080039import java.lang.annotation.Retention;
40import java.lang.annotation.RetentionPolicy;
Clara Bayarri75e09792015-07-29 16:20:40 +010041import java.util.List;
Wale Ogunwale1f240c92016-02-22 18:04:58 -080042import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043
44/**
45 * The interface that apps use to talk to the window manager.
Jeff Browna492c3a2012-08-23 19:48:44 -070046 * </p><p>
47 * Each window manager instance is bound to a particular {@link Display}.
48 * To obtain a {@link WindowManager} for a different display, use
49 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
50 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
51 * to get the WindowManager.
52 * </p><p>
53 * The simplest way to show a window on another display is to create a
54 * {@link Presentation}. The presentation will automatically obtain a
55 * {@link WindowManager} and {@link Context} for that display.
56 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 */
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060058@SystemService(Context.WINDOW_SERVICE)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059public interface WindowManager extends ViewManager {
Jorim Jaggi61f39a72015-10-29 16:54:18 +010060
61 /** @hide */
62 int DOCKED_INVALID = -1;
63 /** @hide */
64 int DOCKED_LEFT = 1;
65 /** @hide */
66 int DOCKED_TOP = 2;
67 /** @hide */
68 int DOCKED_RIGHT = 3;
69 /** @hide */
70 int DOCKED_BOTTOM = 4;
71
Winson41275482016-10-10 15:17:45 -070072 /** @hide */
73 final static String INPUT_CONSUMER_PIP = "pip_input_consumer";
74 /** @hide */
75 final static String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer";
76 /** @hide */
77 final static String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer";
78
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 /**
80 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +010081 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 * is invalid.
83 */
84 public static class BadTokenException extends RuntimeException {
85 public BadTokenException() {
86 }
87
88 public BadTokenException(String name) {
89 super(name);
90 }
91 }
92
93 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070094 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
95 * be found. See {@link android.app.Presentation} for more information on secondary displays.
96 */
97 public static class InvalidDisplayException extends RuntimeException {
98 public InvalidDisplayException() {
99 }
100
101 public InvalidDisplayException(String name) {
102 super(name);
103 }
104 }
105
106 /**
Jeff Browna492c3a2012-08-23 19:48:44 -0700107 * Returns the {@link Display} upon which this {@link WindowManager} instance
108 * will create new windows.
109 * <p>
110 * Despite the name of this method, the display that is returned is not
111 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
112 * The returned display could instead be a secondary display that this
113 * window manager instance is managing. Think of it as the display that
114 * this {@link WindowManager} instance uses by default.
115 * </p><p>
116 * To create windows on a different display, you need to obtain a
117 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
118 * class documentation for more information.)
119 * </p>
120 *
121 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 */
123 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700124
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125 /**
126 * Special variation of {@link #removeView} that immediately invokes
127 * the given view hierarchy's {@link View#onDetachedFromWindow()
128 * View.onDetachedFromWindow()} methods before returning. This is not
129 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700130 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 * @param view The view to be removed.
132 */
133 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700134
Clara Bayarri75e09792015-07-29 16:20:40 +0100135 /**
136 * Used to asynchronously request Keyboard Shortcuts from the focused window.
137 *
138 * @hide
139 */
140 public interface KeyboardShortcutsReceiver {
141 /**
142 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
143 *
144 * @param result The keyboard shortcuts to be displayed.
145 */
146 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
147 }
148
149 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800150 * Message for taking fullscreen screenshot
151 * @hide
152 */
153 final int TAKE_SCREENSHOT_FULLSCREEN = 1;
154
155 /**
156 * Message for taking screenshot of selected region.
157 * @hide
158 */
159 final int TAKE_SCREENSHOT_SELECTED_REGION = 2;
160
161 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100162 * @hide
163 */
164 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
165
166 /**
167 * Request for keyboard shortcuts to be retrieved asynchronously.
168 *
169 * @param receiver The callback to be triggered when the result is ready.
170 *
171 * @hide
172 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000173 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100174
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400175 /**
176 * Return the touch region for the current IME window, or an empty region if there is none.
177 *
178 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
179 * region or there was an error.
180 *
181 * @hide
182 */
183 @SystemApi
184 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
185 public Region getCurrentImeTouchRegion();
186
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800187 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800188 /**
189 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700190 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
191 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192 */
Romain Guy529b60a2010-08-03 18:05:47 -0700193 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196 /**
197 * Y position for this window. With the default gravity it is ignored.
198 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
199 * an offset from the given edge.
200 */
Romain Guy529b60a2010-08-03 18:05:47 -0700201 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800202 public int y;
203
204 /**
205 * Indicates how much of the extra space will be allocated horizontally
206 * to the view associated with these LayoutParams. Specify 0 if the view
207 * should not be stretched. Otherwise the extra pixels will be pro-rated
208 * among all views whose weight is greater than 0.
209 */
Romain Guy529b60a2010-08-03 18:05:47 -0700210 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800211 public float horizontalWeight;
212
213 /**
214 * Indicates how much of the extra space will be allocated vertically
215 * to the view associated with these LayoutParams. Specify 0 if the view
216 * should not be stretched. Otherwise the extra pixels will be pro-rated
217 * among all views whose weight is greater than 0.
218 */
Romain Guy529b60a2010-08-03 18:05:47 -0700219 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800220 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700221
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800222 /**
223 * The general type of window. There are three main classes of
224 * window types:
225 * <ul>
226 * <li> <strong>Application windows</strong> (ranging from
227 * {@link #FIRST_APPLICATION_WINDOW} to
228 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
229 * windows. For these types of windows, the {@link #token} must be
230 * set to the token of the activity they are a part of (this will
231 * normally be done for you if {@link #token} is null).
232 * <li> <strong>Sub-windows</strong> (ranging from
233 * {@link #FIRST_SUB_WINDOW} to
234 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
235 * window. For these types of windows, the {@link #token} must be
236 * the token of the window it is attached to.
237 * <li> <strong>System windows</strong> (ranging from
238 * {@link #FIRST_SYSTEM_WINDOW} to
239 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
240 * use by the system for specific purposes. They should not normally
241 * be used by applications, and a special permission is required
242 * to use them.
243 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700244 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 * @see #TYPE_BASE_APPLICATION
246 * @see #TYPE_APPLICATION
247 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700248 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 * @see #TYPE_APPLICATION_PANEL
250 * @see #TYPE_APPLICATION_MEDIA
251 * @see #TYPE_APPLICATION_SUB_PANEL
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700252 * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
254 * @see #TYPE_STATUS_BAR
255 * @see #TYPE_SEARCH_BAR
256 * @see #TYPE_PHONE
257 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 * @see #TYPE_TOAST
259 * @see #TYPE_SYSTEM_OVERLAY
260 * @see #TYPE_PRIORITY_PHONE
261 * @see #TYPE_STATUS_BAR_PANEL
262 * @see #TYPE_SYSTEM_DIALOG
263 * @see #TYPE_KEYGUARD_DIALOG
264 * @see #TYPE_SYSTEM_ERROR
265 * @see #TYPE_INPUT_METHOD
266 * @see #TYPE_INPUT_METHOD_DIALOG
267 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700268 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700269 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
270 to = "TYPE_BASE_APPLICATION"),
271 @ViewDebug.IntToString(from = TYPE_APPLICATION,
272 to = "TYPE_APPLICATION"),
273 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
274 to = "TYPE_APPLICATION_STARTING"),
275 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
276 to = "TYPE_DRAWN_APPLICATION"),
277 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
278 to = "TYPE_APPLICATION_PANEL"),
279 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
280 to = "TYPE_APPLICATION_MEDIA"),
281 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
282 to = "TYPE_APPLICATION_SUB_PANEL"),
283 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
284 to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"),
285 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
286 to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
287 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
288 to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
289 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
290 to = "TYPE_STATUS_BAR"),
291 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
292 to = "TYPE_SEARCH_BAR"),
293 @ViewDebug.IntToString(from = TYPE_PHONE,
294 to = "TYPE_PHONE"),
295 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
296 to = "TYPE_SYSTEM_ALERT"),
297 @ViewDebug.IntToString(from = TYPE_TOAST,
298 to = "TYPE_TOAST"),
299 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
300 to = "TYPE_SYSTEM_OVERLAY"),
301 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
302 to = "TYPE_PRIORITY_PHONE"),
303 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
304 to = "TYPE_SYSTEM_DIALOG"),
305 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
306 to = "TYPE_KEYGUARD_DIALOG"),
307 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
308 to = "TYPE_SYSTEM_ERROR"),
309 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
310 to = "TYPE_INPUT_METHOD"),
311 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
312 to = "TYPE_INPUT_METHOD_DIALOG"),
313 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
314 to = "TYPE_WALLPAPER"),
315 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
316 to = "TYPE_STATUS_BAR_PANEL"),
317 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
318 to = "TYPE_SECURE_SYSTEM_OVERLAY"),
319 @ViewDebug.IntToString(from = TYPE_DRAG,
320 to = "TYPE_DRAG"),
321 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
322 to = "TYPE_STATUS_BAR_SUB_PANEL"),
323 @ViewDebug.IntToString(from = TYPE_POINTER,
324 to = "TYPE_POINTER"),
325 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
326 to = "TYPE_NAVIGATION_BAR"),
327 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
328 to = "TYPE_VOLUME_OVERLAY"),
329 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
330 to = "TYPE_BOOT_PROGRESS"),
331 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
332 to = "TYPE_INPUT_CONSUMER"),
333 @ViewDebug.IntToString(from = TYPE_DREAM,
334 to = "TYPE_DREAM"),
335 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
336 to = "TYPE_NAVIGATION_BAR_PANEL"),
337 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
338 to = "TYPE_DISPLAY_OVERLAY"),
339 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
340 to = "TYPE_MAGNIFICATION_OVERLAY"),
341 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
342 to = "TYPE_PRESENTATION"),
343 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
344 to = "TYPE_PRIVATE_PRESENTATION"),
345 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
346 to = "TYPE_VOICE_INTERACTION"),
347 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
348 to = "TYPE_VOICE_INTERACTION_STARTING"),
349 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
350 to = "TYPE_DOCK_DIVIDER"),
351 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
352 to = "TYPE_QS_DIALOG"),
353 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800354 to = "TYPE_SCREENSHOT"),
355 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
356 to = "TYPE_APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700357 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700359
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 /**
361 * Start of window types that represent normal application windows.
362 */
363 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800365 /**
366 * Window type: an application window that serves as the "base" window
367 * of the overall application; all other application windows will
368 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700369 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 */
371 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 /**
374 * Window type: a normal application window. The {@link #token} must be
375 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700376 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377 */
378 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 /**
381 * Window type: special application window that is displayed while the
382 * application is starting. Not for use by applications themselves;
383 * this is used by the system to display something until the
384 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700385 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 */
387 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700388
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700390 * Window type: a variation on TYPE_APPLICATION that ensures the window
391 * manager will wait for this window to be drawn before the app is shown.
392 * In multiuser systems shows only on the owning user's window.
393 */
394 public static final int TYPE_DRAWN_APPLICATION = 4;
395
396 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 * End of types of application windows.
398 */
399 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700400
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 /**
402 * Start of types of sub-windows. The {@link #token} of these windows
403 * must be set to the window they are attached to. These types of
404 * windows are kept next to their attached window in Z-order, and their
405 * coordinate space is relative to their attached window.
406 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700407 public static final int FIRST_SUB_WINDOW = 1000;
408
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 /**
410 * Window type: a panel on top of an application window. These windows
411 * appear on top of their attached window.
412 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700413 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 /**
John Spurlock33291d82013-03-13 14:45:14 -0400416 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 * are displayed behind their attached window.
418 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700419 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 /**
422 * Window type: a sub-panel on top of an application window. These
423 * windows are displayed on top their attached window and any
424 * {@link #TYPE_APPLICATION_PANEL} panels.
425 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700426 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427
428 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
429 * of the window happens as that of a top-level window, <em>not</em>
430 * as a child of its container.
431 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700432 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
433
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700435 * Window type: window for showing overlays on top of media windows.
436 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
437 * application window. They should be translucent to be useful. This
438 * is a big ugly hack so:
439 * @hide
440 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700441 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
442
443 /**
444 * Window type: a above sub-panel on top of an application window and it's
445 * sub-panel windows. These windows are displayed on top of their attached window
446 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700447 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700448 */
449 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
450
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700451 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 * End of types of sub-windows.
453 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700454 public static final int LAST_SUB_WINDOW = 1999;
455
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800456 /**
457 * Start of system-specific window types. These are not normally
458 * created by applications.
459 */
460 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700461
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800462 /**
463 * Window type: the status bar. There can be only one status bar
464 * window; it is placed at the top of the screen, and all other
465 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700466 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 */
468 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700469
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 /**
471 * Window type: the search bar. There can be only one search bar
472 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700473 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800474 */
475 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 /**
478 * Window type: phone. These are non-application windows providing
479 * user interaction with the phone (in particular incoming calls).
480 * These windows are normally placed above all applications, but behind
481 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700482 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800483 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800484 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800485 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700487
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800488 /**
489 * Window type: system window, such as low power alert. These windows
490 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700491 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800492 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800494 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100496
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 /**
498 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700499 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200500 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 */
502 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800504 /**
505 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700506 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800507 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800508 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800509 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800510 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700511
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800512 /**
513 * Window type: system overlay windows, which need to be displayed
514 * on top of everything else. These windows must not take input
515 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700516 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800517 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800518 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800519 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700521
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800522 /**
523 * Window type: priority phone UI, which needs to be displayed even if
524 * the keyguard is active. These windows must not take input
525 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700526 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800527 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800528 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800529 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 /**
533 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700534 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 /**
539 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700540 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800541 */
542 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700543
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800544 /**
545 * Window type: internal system error windows, appear on top of
546 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700547 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800548 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800550 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700552
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 /**
554 * Window type: internal input methods windows, which appear above
555 * the normal UI. Application windows may be resized or panned to keep
556 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700557 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800558 */
559 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
560
561 /**
562 * Window type: internal input methods dialog windows, which appear above
563 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700564 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 */
566 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
567
568 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700569 * Window type: wallpaper window, placed behind any window that wants
570 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700571 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700572 */
573 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
574
575 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800576 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700577 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800578 */
579 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700580
581 /**
582 * Window type: secure system overlay windows, which need to be displayed
583 * on top of everything else. These windows must not take input
584 * focus, or they will interfere with the keyguard.
585 *
586 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
587 * system itself is allowed to create these overlays. Applications cannot
588 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700589 *
590 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700591 * @hide
592 */
593 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
594
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800595 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700596 * Window type: the drag-and-drop pseudowindow. There is only one
597 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700598 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700599 * @hide
600 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700601 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700602
603 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800604 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700605 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800606 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800607 */
608 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
609
Jeff Brown83c09682010-12-23 17:50:18 -0800610 /**
611 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700612 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800613 * @hide
614 */
615 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800616
617 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400618 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700619 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400620 * @hide
621 */
622 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
623
624 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700625 * Window type: The volume level overlay/dialog shown when the user
626 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700627 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700628 * @hide
629 */
630 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
631
632 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700633 * Window type: The boot progress dialog, goes on top of everything
634 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700635 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700636 * @hide
637 */
638 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
639
640 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700641 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700642 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700643 * @hide
644 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700645 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -0700646
647 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500648 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700649 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500650 * @hide
651 */
652 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
653
654 /**
Jim Millere898ac52012-04-06 17:10:57 -0700655 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700656 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700657 * @hide
658 */
659 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
660
661 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700662 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700663 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700664 * @hide
665 */
666 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
667
668 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700669 * Window type: Magnification overlay window. Used to highlight the magnified
670 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700671 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700672 * @hide
673 */
674 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
675
676 /**
keunyounga446bf02013-06-21 19:07:57 -0700677 * Window type: Window for Presentation on top of private
678 * virtual display.
679 */
680 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
681
682 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700683 * Window type: Windows in the voice interaction layer.
684 * @hide
685 */
686 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
687
688 /**
Phil Weaver40ded282016-01-25 15:49:02 -0800689 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -0700690 * android.accessibilityservice.AccessibilityService} for interception of
691 * user interactions without changing the windows an accessibility service
692 * can introspect. In particular, an accessibility service can introspect
693 * only windows that a sighted user can interact with which is they can touch
694 * these windows or can type into these windows. For example, if there
695 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -0800696 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -0700697 * they are covered by a touchable window.
698 */
699 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
700
701 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700702 * Window type: Starting window for voice interaction layer.
703 * @hide
704 */
705 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
706
707 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -0700708 * Window for displaying a handle used for resizing docked stacks. This window is owned
709 * by the system process.
710 * @hide
711 */
712 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
713
714 /**
Jason Monk8f7f3182015-11-18 16:35:14 -0500715 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
716 * by Quick Settings Tiles.
717 * @hide
718 */
719 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
720
721 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800722 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is
Muyuan Li36ca72c2016-08-06 20:24:06 -0700723 * reserved for screenshot region selection. These windows must not take input focus.
Muyuan Li6ca619f2016-03-08 13:30:42 -0800724 * @hide
725 */
726 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
727
728 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700729 * Window type: Window for Presentation on an external display.
730 * @see android.app.Presentation
731 * @hide
732 */
733 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
734
735 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800736 * Window type: Application overlay windows are displayed above all activity windows
737 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
738 * but below critical system windows like the status bar or IME.
739 * <p>
740 * The system may change the position, size, or visibility of these windows at anytime
741 * to reduce visual clutter to the user and also manage resources.
742 * <p>
743 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
744 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -0800745 * The system will adjust the importance of processes with this window type to reduce the
746 * chance of the low-memory-killer killing them.
747 * <p>
748 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800749 */
750 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
751
752 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800753 * End of types of system windows.
754 */
755 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800757 /**
Albert Chaulke4338f82017-04-19 15:54:08 -0400758 * @hide
759 * Used internally when there is no suitable type available.
760 */
761 public static final int INVALID_WINDOW_TYPE = -1;
762
763 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800764 * Return true if the window type is an alert window.
765 *
766 * @param type The window type.
767 * @return If the window type is an alert window.
768 * @hide
769 */
770 public static boolean isSystemAlertWindowType(int type) {
771 switch (type) {
772 case TYPE_PHONE:
773 case TYPE_PRIORITY_PHONE:
774 case TYPE_SYSTEM_ALERT:
775 case TYPE_SYSTEM_ERROR:
776 case TYPE_SYSTEM_OVERLAY:
777 case TYPE_APPLICATION_OVERLAY:
778 return true;
779 }
780 return false;
781 }
782
Mathias Agopiand2112302010-12-07 19:38:17 -0800783 /** @deprecated this is ignored, this value is set automatically when needed. */
784 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800785 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800786 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700787 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800789 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700790 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800791 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800792 /** @deprecated this is ignored, this value is set automatically when needed. */
793 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700795
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700797 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800798 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700799 @Deprecated
800 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700801
Mike Lockwoodef731622010-01-27 17:51:34 -0500802 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700803 * the lock screen to activate while the screen is on.
804 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800805 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500806 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
807
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800808 /** Window flag: everything behind this window will be dimmed.
809 * Use {@link #dimAmount} to control the amount of dim. */
810 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700811
812 /** Window flag: blur everything behind this window.
813 * @deprecated Blurring is no longer supported. */
814 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800815 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700816
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800817 /** Window flag: this window won't ever get key input focus, so the
818 * user can not send key or other button events to it. Those will
819 * instead go to whatever focusable window is behind it. This flag
820 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
821 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700822 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800823 * <p>Setting this flag also implies that the window will not need to
824 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700825 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 * independently of any active input method (typically this means it
827 * gets Z-ordered on top of the input method, so it can use the full
828 * screen for its content and cover the input method if needed. You
829 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
830 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700831
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800832 /** Window flag: this window can never receive touch events. */
833 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700834
John Spurlock33291d82013-03-13 14:45:14 -0400835 /** Window flag: even when this window is focusable (its
836 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800837 * outside of the window to be sent to the windows behind it. Otherwise
838 * it will consume all pointer events itself, regardless of whether they
839 * are inside of the window. */
840 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700841
John Spurlock33291d82013-03-13 14:45:14 -0400842 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 * screen is pressed, you will receive this first touch event. Usually
844 * the first touch event is consumed by the system since the user can
845 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700846 *
847 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800848 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700849 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700851
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 /** Window flag: as long as this window is visible to the user, keep
853 * the device's screen turned on and bright. */
854 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700855
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800856 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400857 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800858 * window must correctly position its contents to take the screen
859 * decoration into account. This flag is normally set for you
860 * by Window as described in {@link Window#setFlags}. */
861 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700862
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800863 /** Window flag: allow window to extend outside of the screen. */
864 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700865
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800866 /**
John Spurlock33291d82013-03-13 14:45:14 -0400867 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 * this window is displayed. This allows the window to use the entire
869 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700870 * an app window with this flag set is on the top layer. A fullscreen window
871 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
872 * {@link #softInputMode} field; the window will stay fullscreen
873 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800874 *
875 * <p>This flag can be controlled in your theme through the
876 * {@link android.R.attr#windowFullscreen} attribute; this attribute
877 * is automatically set for you in the standard fullscreen themes
878 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
879 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
880 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
881 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
882 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
883 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
884 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
885 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700887
John Spurlock33291d82013-03-13 14:45:14 -0400888 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
889 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700893 * the screen.
894 * @deprecated This flag is no longer used. */
895 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700897
John Spurlock33291d82013-03-13 14:45:14 -0400898 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700899 * it from appearing in screenshots or from being viewed on non-secure
900 * displays.
901 *
902 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
903 * secure surfaces and secure displays.
904 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700906
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 /** Window flag: a special mode where the layout parameters are used
908 * to perform scaling of the surface when it is composited to the
909 * screen. */
910 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700911
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800912 /** Window flag: intended for windows that will often be used when the user is
913 * holding the screen against their face, it will aggressively filter the event
914 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700915 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700917 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800918 * until the finger is released. */
919 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700920
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800921 /** Window flag: a special option only for use in combination with
922 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
923 * screen your window may appear on top of or behind screen decorations
924 * such as the status bar. By also including this flag, the window
925 * manager will report the inset rectangle needed to ensure your
926 * content is not covered by screen decorations. This flag is normally
927 * set for you by Window as described in {@link Window#setFlags}.*/
928 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700929
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800930 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
931 * respect to how this window interacts with the current method. That
932 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
933 * window will behave as if it needs to interact with the input method
934 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
935 * not set and this flag is set, then the window will behave as if it
936 * doesn't need to interact with the input method and can be placed
937 * to use more space and cover the input method.
938 */
939 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700940
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800941 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
942 * can set this flag to receive a single special MotionEvent with
943 * the action
944 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
945 * touches that occur outside of your window. Note that you will not
946 * receive the full down/move/up gesture, only the location of the
947 * first down as an ACTION_OUTSIDE.
948 */
949 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700950
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700951 /** Window flag: special flag to let windows be shown when the screen
952 * is locked. This will let application windows take precedence over
953 * key guard or any other lock screens. Can be used with
954 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700955 * directly before showing the key guard window. Can be used with
956 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
957 * non-secure keyguards. This flag only applies to the top-most
958 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -0700959 * @deprecated Use {@link android.R.attr#showWhenLocked} or
960 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
961 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700962 */
chaviw59b98852017-06-13 12:05:44 -0700963 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700964 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
965
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700966 /** Window flag: ask that the system wallpaper be shown behind
967 * your window. The window surface must be translucent to be able
968 * to actually see the wallpaper behind it; this flag just ensures
969 * that the wallpaper surface will be there if this window actually
970 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800971 *
972 * <p>This flag can be controlled in your theme through the
973 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
974 * is automatically set for you in the standard wallpaper themes
975 * such as {@link android.R.style#Theme_Wallpaper},
976 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
977 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
978 * {@link android.R.style#Theme_Holo_Wallpaper},
979 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
980 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
981 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700982 */
983 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700984
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700985 /** Window flag: when set as a window is being added or made
986 * visible, once the window has been shown then the system will
987 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -0700988 * up the device) to turn the screen on.
989 * @deprecated Use {@link android.R.attr#turnScreenOn} or
990 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
991 * unintentional double life-cycle event.
992 */
993 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700994 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700995
Jeff Sharkey67f9d502017-08-05 13:49:13 -0600996 /**
997 * Window flag: when set the window will cause the keyguard to be
998 * dismissed, only if it is not a secure lock keyguard. Because such a
999 * keyguard is not needed for security, it will never re-appear if the
1000 * user navigates to another window (in contrast to
1001 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1002 * secure and non-secure keyguards but ensure they reappear when the
1003 * user moves to another UI that doesn't hide them). If the keyguard is
1004 * currently active and is secure (requires an unlock credential) than
1005 * the user will still need to confirm it before seeing this window,
1006 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1007 *
1008 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1009 * {@link KeyguardManager#requestDismissKeyguard} instead.
1010 * Since keyguard was dismissed all the time as long as an
1011 * activity with this flag on its window was focused,
1012 * keyguard couldn't guard against unintentional touches on
1013 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001014 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001015 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001016 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001017
Jeff Brown01ce2e92010-09-26 22:20:12 -07001018 /** Window flag: when set the window will accept for touch events
1019 * outside of its bounds to be sent to other windows that also
1020 * support split touch. When this flag is not set, the first pointer
1021 * that goes down determines the window to which all subsequent touches
1022 * go until all pointers go up. When this flag is set, each pointer
1023 * (not necessarily the first) that goes down determines the window
1024 * to which all subsequent touches of that pointer will go until that
1025 * pointer goes up thereby enabling touches with multiple pointers
1026 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001027 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001028 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001029
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001030 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001031 * <p>Indicates whether this window should be hardware accelerated.
1032 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001033 *
Romain Guy72f0a272011-01-09 16:01:46 -08001034 * <p>This flag can be controlled programmatically <em>only</em> to enable
1035 * hardware acceleration. To enable hardware acceleration for a given
1036 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001037 *
Romain Guy72f0a272011-01-09 16:01:46 -08001038 * <pre>
1039 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1040 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1041 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1042 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001043 *
Romain Guy72f0a272011-01-09 16:01:46 -08001044 * <p>It is important to remember that this flag <strong>must</strong>
1045 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001046 *
Romain Guy72f0a272011-01-09 16:01:46 -08001047 * <p>This flag cannot be used to disable hardware acceleration after it
1048 * was enabled in your manifest using
1049 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1050 * and programmatically disable hardware acceleration (for automated testing
1051 * for instance), make sure it is turned off in your manifest and enable it
1052 * on your activity or dialog when you need it instead, using the method
1053 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001054 *
Romain Guy72f0a272011-01-09 16:01:46 -08001055 * <p>This flag is automatically set by the system if the
1056 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1057 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001058 */
1059 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001060
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001061 /**
1062 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001063 * overscan area, if there is one. The window should still correctly
1064 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001065 *
1066 * <p>This flag can be controlled in your theme through the
1067 * {@link android.R.attr#windowOverscan} attribute; this attribute
1068 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001069 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001070 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1071 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1072 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1073 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1074 *
1075 * <p>When this flag is enabled for a window, its normal content may be obscured
1076 * to some degree by the overscan region of the display. To ensure key parts of
1077 * that content are visible to the user, you can use
1078 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1079 * to set the point in the view hierarchy where the appropriate offsets should
1080 * be applied. (This can be done either by directly calling this function, using
1081 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1082 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1083 * View.fitSystemWindows(Rect)} method).</p>
1084 *
1085 * <p>This mechanism for positioning content elements is identical to its equivalent
1086 * use with layout and {@link View#setSystemUiVisibility(int)
1087 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1088 * position its UI elements with this overscan flag is set:</p>
1089 *
1090 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -08001091 */
1092 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1093
John Spurlockbd957402013-10-03 11:38:39 -04001094 /**
1095 * Window flag: request a translucent status bar with minimal system-provided
1096 * background protection.
1097 *
1098 * <p>This flag can be controlled in your theme through the
1099 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1100 * is automatically set for you in the standard translucent decor themes
1101 * such as
1102 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1103 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1104 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1105 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1106 *
1107 * <p>When this flag is enabled for a window, it automatically sets
1108 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1109 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
1110 */
1111 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1112
1113 /**
1114 * Window flag: request a translucent navigation bar with minimal system-provided
1115 * background protection.
1116 *
1117 * <p>This flag can be controlled in your theme through the
1118 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1119 * is automatically set for you in the standard translucent decor themes
1120 * such as
1121 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1122 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1123 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1124 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1125 *
1126 * <p>When this flag is enabled for a window, it automatically sets
1127 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1128 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
1129 */
1130 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1131
Adam Lesinski6a591f52013-10-01 18:11:17 -07001132 /**
1133 * Flag for a window in local focus mode.
1134 * Window in local focus mode can control focus independent of window manager using
1135 * {@link Window#setLocalFocus(boolean, boolean)}.
1136 * Usually window in this mode will not get touch/key events from window manager, but will
1137 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1138 */
1139 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1140
Jeff Brown98db5fa2011-06-08 15:37:10 -07001141 /** Window flag: Enable touches to slide out of a window into neighboring
1142 * windows in mid-gesture instead of being captured for the duration of
1143 * the gesture.
1144 *
1145 * This flag changes the behavior of touch focus for this window only.
1146 * Touches can slide out of the window but they cannot necessarily slide
1147 * back in (unless the other window with touch focus permits it).
1148 *
1149 * {@hide}
1150 */
Adam Lesinski6a591f52013-10-01 18:11:17 -07001151 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001152
Daniel Sandlere02d8082010-10-08 15:13:22 -04001153 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001154 * Window flag: When requesting layout with an attached window, the attached window may
1155 * overlap with the screen decorations of the parent window such as the navigation bar. By
1156 * including this flag, the window manager will layout the attached window within the decor
1157 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001158 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001159 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001160
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001162 * Flag indicating that this Window is responsible for drawing the background for the
1163 * system bars. If set, the system bars are drawn with a transparent background and the
1164 * corresponding areas in this window are filled with the colors specified in
1165 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1166 */
1167 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1168
1169 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001170 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001171 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001172 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1173 * @see #FLAG_DIM_BEHIND
1174 * @see #FLAG_NOT_FOCUSABLE
1175 * @see #FLAG_NOT_TOUCHABLE
1176 * @see #FLAG_NOT_TOUCH_MODAL
1177 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1178 * @see #FLAG_KEEP_SCREEN_ON
1179 * @see #FLAG_LAYOUT_IN_SCREEN
1180 * @see #FLAG_LAYOUT_NO_LIMITS
1181 * @see #FLAG_FULLSCREEN
1182 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001183 * @see #FLAG_SECURE
1184 * @see #FLAG_SCALED
1185 * @see #FLAG_IGNORE_CHEEK_PRESSES
1186 * @see #FLAG_LAYOUT_INSET_DECOR
1187 * @see #FLAG_ALT_FOCUSABLE_IM
1188 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1189 * @see #FLAG_SHOW_WHEN_LOCKED
1190 * @see #FLAG_SHOW_WALLPAPER
1191 * @see #FLAG_TURN_SCREEN_ON
1192 * @see #FLAG_DISMISS_KEYGUARD
1193 * @see #FLAG_SPLIT_TOUCH
1194 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001195 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001196 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001197 */
1198 @ViewDebug.ExportedProperty(flagMapping = {
1199 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
1200 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
1201 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
1202 name = "FLAG_DIM_BEHIND"),
1203 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
1204 name = "FLAG_BLUR_BEHIND"),
1205 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
1206 name = "FLAG_NOT_FOCUSABLE"),
1207 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
1208 name = "FLAG_NOT_TOUCHABLE"),
1209 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
1210 name = "FLAG_NOT_TOUCH_MODAL"),
1211 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
1212 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
1213 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
1214 name = "FLAG_KEEP_SCREEN_ON"),
1215 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
1216 name = "FLAG_LAYOUT_IN_SCREEN"),
1217 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
1218 name = "FLAG_LAYOUT_NO_LIMITS"),
1219 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
1220 name = "FLAG_FULLSCREEN"),
1221 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
1222 name = "FLAG_FORCE_NOT_FULLSCREEN"),
1223 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
1224 name = "FLAG_DITHER"),
1225 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
1226 name = "FLAG_SECURE"),
1227 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
1228 name = "FLAG_SCALED"),
1229 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
1230 name = "FLAG_IGNORE_CHEEK_PRESSES"),
1231 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
1232 name = "FLAG_LAYOUT_INSET_DECOR"),
1233 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
1234 name = "FLAG_ALT_FOCUSABLE_IM"),
1235 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
1236 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
1237 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
1238 name = "FLAG_SHOW_WHEN_LOCKED"),
1239 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
1240 name = "FLAG_SHOW_WALLPAPER"),
1241 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
1242 name = "FLAG_TURN_SCREEN_ON"),
1243 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1244 name = "FLAG_DISMISS_KEYGUARD"),
1245 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1246 name = "FLAG_SPLIT_TOUCH"),
1247 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001248 name = "FLAG_HARDWARE_ACCELERATED"),
1249 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001250 name = "FLAG_LOCAL_FOCUS_MODE"),
1251 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1252 name = "FLAG_TRANSLUCENT_STATUS"),
1253 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001254 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1255 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1256 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001257 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001258 public int flags;
1259
1260 /**
John Reck61375a82014-09-18 19:27:48 +00001261 * If the window has requested hardware acceleration, but this is not
1262 * allowed in the process it is in, then still render it as if it is
1263 * hardware accelerated. This is used for the starting preview windows
1264 * in the system process, which don't need to have the overhead of
1265 * hardware acceleration (they are just a static rendering), but should
1266 * be rendered as such to match the actual window of the app even if it
1267 * is hardware accelerated.
1268 * Even if the window isn't hardware accelerated, still do its rendering
1269 * as if it was.
1270 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1271 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001272 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001273 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1274 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001275 *
John Reck61375a82014-09-18 19:27:48 +00001276 * @hide
1277 */
1278 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1279
1280 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001281 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001282 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001283 * If certain parts of the UI that really do want to use hardware
1284 * acceleration, this flag can be set to force it. This is basically
1285 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001286 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001287 * @hide
1288 */
1289 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1290
1291 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001292 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001293 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001294 * them (they do not affect the wallpaper scrolling operation) by calling
1295 * {@link
1296 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1297 *
1298 * @hide
1299 */
1300 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1301
Craig Mautner88400d32012-09-30 12:35:45 -07001302 /** In a multiuser system if this flag is set and the owner is a system process then this
1303 * window will appear on all user screens. This overrides the default behavior of window
1304 * types that normally only appear on the owning user's screen. Refer to each window type
1305 * to determine its default behavior.
1306 *
1307 * {@hide} */
1308 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1309
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001310 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001311 * Never animate position changes of the window.
1312 *
Robert Carrb48380a2017-04-04 14:56:37 -07001313 * {@hide}
1314 */
1315 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001316 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1317
Adam Lesinski6a591f52013-10-01 18:11:17 -07001318 /** Window flag: special flag to limit the size of the window to be
1319 * original size ([320x480] x density). Used to create window for applications
1320 * running under compatibility mode.
1321 *
1322 * {@hide} */
1323 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1324
1325 /** Window flag: a special option intended for system dialogs. When
1326 * this flag is set, the window will demand focus unconditionally when
1327 * it is created.
1328 * {@hide} */
1329 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1330
John Spurlock3f7cd512013-10-07 12:25:09 -04001331 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001332 * becomes top-most.
1333 * {@hide} */
1334 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1335
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001336 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001337 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1338 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1339 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1340 * {@hide}
1341 */
1342 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1343
1344 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001345 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1346 *
1347 * {@hide}
1348 */
1349 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1350
1351 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001352 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1353 * this flag is set it will be shown again and the bar will have a transparent background.
1354 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1355 *
1356 * {@hide}
1357 */
1358 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1359
1360 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001361 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001362 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001363 * because they are being managed externally through repositionChild.
1364 *
1365 * {@hide}
1366 */
1367 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1368
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001369 /**
1370 * Flag that will make window ignore app visibility and instead depend purely on the decor
1371 * view visibility for determining window visibility. This is used by recents to keep
1372 * drawing after it launches an app.
1373 * @hide
1374 */
1375 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1376
Robert Carra1eb4392015-12-10 12:43:51 -08001377 /**
1378 * Flag to indicate that this window is not expected to be replaced across
1379 * configuration change triggered activity relaunches. In general the WindowManager
1380 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1381 * until the replacement is ready to show in order to prevent visual glitch. However
1382 * some windows, such as PopupWindows expect to be cleared across configuration change,
1383 * and thus should hint to the WindowManager that it should not wait for a replacement.
1384 * @hide
1385 */
1386 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001387
1388 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001389 * Flag to indicate that this child window should always be laid-out in the parent
1390 * frame regardless of the current windowing mode configuration.
1391 * @hide
1392 */
1393 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1394
1395 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001396 * Flag to indicate that this window is always drawing the status bar background, no matter
1397 * what the other flags are.
1398 * @hide
1399 */
1400 public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000;
1401
1402 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001403 * Flag to indicate that this window needs Sustained Performance Mode if
1404 * the device supports it.
1405 * @hide
1406 */
John Reck60e885f2016-04-21 15:40:45 -07001407 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001408
1409 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001410 * Flag to indicate that any window added by an application process that is of type
1411 * {@link #TYPE_TOAST} or that requires
1412 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1413 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001414 * @hide
1415 */
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001416 @RequiresPermission(android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
1417 public static final int PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001418
1419 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001420 * Indicates that this window is the rounded corners overlay present on some
1421 * devices this means that it will be excluded from: screenshots,
1422 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001423 * @hide
1424 */
Robert Carr132c9f52017-07-31 17:02:30 -07001425 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001426
1427 /**
Jorim Jaggif12ec0f2017-08-23 16:14:10 +02001428 * If this flag is set on the window, window manager will acquire a sleep token that puts
1429 * all activities to sleep as long as this window is visible. When this flag is set, the
1430 * window needs to occlude all activity windows.
1431 * @hide
1432 */
1433 @RequiresPermission(permission.DEVICE_POWER)
1434 public static final int PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN = 0x00200000;
1435
1436 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001437 * Control flags that are private to the platform.
1438 * @hide
1439 */
Robert Carrb48380a2017-04-04 14:56:37 -07001440 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001441 public int privateFlags;
1442
1443 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001444 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1445 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1446 * key. For this case, we should look at windows behind it to determine the appropriate
1447 * value.
1448 *
1449 * @hide
1450 */
1451 public static final int NEEDS_MENU_UNSET = 0;
1452
1453 /**
1454 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1455 * menu key.
1456 *
1457 * @hide
1458 */
1459 public static final int NEEDS_MENU_SET_TRUE = 1;
1460
1461 /**
1462 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1463 * needs a menu key.
1464 *
1465 * @hide
1466 */
1467 public static final int NEEDS_MENU_SET_FALSE = 2;
1468
1469 /**
1470 * State variable for a window belonging to an activity that responds to
1471 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1472 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1473 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1474 *
1475 * (Note that Action Bars, when available, are the preferred way to offer additional
1476 * functions otherwise accessed via an options menu.)
1477 *
1478 * {@hide}
1479 */
1480 public int needsMenuKey = NEEDS_MENU_UNSET;
1481
1482 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001483 * Given a particular set of window manager flags, determine whether
1484 * such a window may be a target for an input method when it has
1485 * focus. In particular, this checks the
1486 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1487 * flags and returns true if the combination of the two corresponds
1488 * to a window that needs to be behind the input method so that the
1489 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001490 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001491 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001492 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001493 * @return Returns true if such a window should be behind/interact
1494 * with an input method, false if not.
1495 */
1496 public static boolean mayUseInputMethod(int flags) {
1497 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1498 case 0:
1499 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1500 return true;
1501 }
1502 return false;
1503 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001505 /**
1506 * Mask for {@link #softInputMode} of the bits that determine the
1507 * desired visibility state of the soft input area for this window.
1508 */
1509 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001510
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001511 /**
1512 * Visibility state for {@link #softInputMode}: no state has been specified.
1513 */
1514 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001515
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 /**
1517 * Visibility state for {@link #softInputMode}: please don't change the state of
1518 * the soft input area.
1519 */
1520 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001521
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001522 /**
1523 * Visibility state for {@link #softInputMode}: please hide any soft input
1524 * area when normally appropriate (when the user is navigating
1525 * forward to your window).
1526 */
1527 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001528
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001529 /**
1530 * Visibility state for {@link #softInputMode}: please always hide any
1531 * soft input area when this window receives focus.
1532 */
1533 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001535 /**
1536 * Visibility state for {@link #softInputMode}: please show the soft
1537 * input area when normally appropriate (when the user is navigating
1538 * forward to your window).
1539 */
1540 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001541
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001542 /**
1543 * Visibility state for {@link #softInputMode}: please always make the
1544 * soft input area visible when this window receives input focus.
1545 */
1546 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001547
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001548 /**
1549 * Mask for {@link #softInputMode} of the bits that determine the
1550 * way that the window should be adjusted to accommodate the soft
1551 * input window.
1552 */
1553 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001554
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001555 /** Adjustment option for {@link #softInputMode}: nothing specified.
1556 * The system will try to pick one or
1557 * the other depending on the contents of the window.
1558 */
1559 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001560
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001561 /** Adjustment option for {@link #softInputMode}: set to allow the
1562 * window to be resized when an input
1563 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001564 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001565 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1566 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001567 * the other depending on the contents of the window. If the window's
1568 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1569 * value for {@link #softInputMode} will be ignored; the window will
1570 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001571 */
1572 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001574 /** Adjustment option for {@link #softInputMode}: set to have a window
1575 * pan when an input method is
1576 * shown, so it doesn't need to deal with resizing but just panned
1577 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001578 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001579 * neither of these are set, then the system will try to pick one or
1580 * the other depending on the contents of the window.
1581 */
1582 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001583
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001584 /** Adjustment option for {@link #softInputMode}: set to have a window
1585 * not adjust for a shown input method. The window will not be resized,
1586 * and it will not be panned to make its focus visible.
1587 */
1588 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 /**
1591 * Bit for {@link #softInputMode}: set when the user has navigated
1592 * forward to the window. This is normally set automatically for
1593 * you by the system, though you may want to set it in certain cases
1594 * when you are displaying a window yourself. This flag will always
1595 * be cleared automatically after the window is displayed.
1596 */
1597 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001598
1599 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001600 * An internal annotation for flags that can be specified to {@link #softInputMode}.
1601 *
1602 * @hide
1603 */
1604 @Retention(RetentionPolicy.SOURCE)
1605 @IntDef(flag = true, value = {
1606 SOFT_INPUT_STATE_UNSPECIFIED,
1607 SOFT_INPUT_STATE_UNCHANGED,
1608 SOFT_INPUT_STATE_HIDDEN,
1609 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
1610 SOFT_INPUT_STATE_VISIBLE,
1611 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
1612 SOFT_INPUT_ADJUST_UNSPECIFIED,
1613 SOFT_INPUT_ADJUST_RESIZE,
1614 SOFT_INPUT_ADJUST_PAN,
1615 SOFT_INPUT_ADJUST_NOTHING,
1616 SOFT_INPUT_IS_FORWARD_NAVIGATION,
1617 })
1618 public @interface SoftInputModeFlags {}
1619
1620 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001621 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001622 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001623 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 * <ul>
1625 * <li> One of the visibility states
1626 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001627 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
1628 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001629 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001630 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
1631 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001632 * </ul>
1633 *
1634 *
1635 * <p>This flag can be controlled in your theme through the
1636 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001637 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001638 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001639 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001641 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001642 * Placement of window within the screen as per {@link Gravity}. Both
1643 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1644 * android.graphics.Rect) Gravity.apply} and
1645 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1646 * Gravity.applyDisplay} are used during window layout, with this value
1647 * given as the desired gravity. For example you can specify
1648 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1649 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1650 * to control the behavior of
1651 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1652 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001653 *
1654 * @see Gravity
1655 */
1656 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001657
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001658 /**
1659 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001660 * between the container and the widget. See
1661 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1662 * android.graphics.Rect) Gravity.apply} for how this is used. This
1663 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001664 */
1665 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001667 /**
1668 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001669 * between the container and the widget. See
1670 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1671 * android.graphics.Rect) Gravity.apply} for how this is used. This
1672 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001673 */
1674 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001675
1676 /**
1677 * Positive insets between the drawing surface and window content.
1678 *
1679 * @hide
1680 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07001681 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08001682
1683 /**
1684 * Whether the surface insets have been manually set. When set to
1685 * {@code false}, the view root will automatically determine the
1686 * appropriate surface insets.
1687 *
1688 * @see #surfaceInsets
1689 * @hide
1690 */
1691 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001692
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001693 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07001694 * Whether the previous surface insets should be used vs. what is currently set. When set
1695 * to {@code true}, the view root will ignore surfaces insets in this object and use what
1696 * it currently has.
1697 *
1698 * @see #surfaceInsets
1699 * @hide
1700 */
1701 public boolean preservePreviousSurfaceInsets = true;
1702
1703 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001704 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08001705 * {@link android.graphics.PixelFormat}. The choice of format
1706 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001707 */
1708 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001710 /**
1711 * A style resource defining the animations to use for this window.
1712 * This must be a system resource; it can not be an application resource
1713 * because the window manager does not have access to applications.
1714 */
1715 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001716
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001717 /**
1718 * An alpha value to apply to this entire window.
1719 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1720 */
1721 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001722
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001723 /**
1724 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1725 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1726 * dim.
1727 */
1728 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001729
1730 /**
1731 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1732 * indicating that the brightness value is not overridden for this window
1733 * and normal brightness policy should be used.
1734 */
1735 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1736
1737 /**
1738 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1739 * indicating that the screen or button backlight brightness should be set
1740 * to the lowest value when this window is in front.
1741 */
1742 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1743
1744 /**
1745 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1746 * indicating that the screen or button backlight brightness should be set
1747 * to the hightest value when this window is in front.
1748 */
1749 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001750
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001751 /**
1752 * This can be used to override the user's preferred brightness of
1753 * the screen. A value of less than 0, the default, means to use the
1754 * preferred screen brightness. 0 to 1 adjusts the brightness from
1755 * dark to full bright.
1756 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001757 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001759 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001760 * This can be used to override the standard behavior of the button and
1761 * keyboard backlights. A value of less than 0, the default, means to
1762 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1763 * from dark to full bright.
1764 */
1765 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1766
1767 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07001768 * Unspecified value for {@link #rotationAnimation} indicating
1769 * a lack of preference.
1770 * @hide
1771 */
1772 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
1773
1774 /**
Robert Carr652aae42016-10-17 16:48:14 -07001775 * Value for {@link #rotationAnimation} which specifies that this
1776 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08001777 */
1778 public static final int ROTATION_ANIMATION_ROTATE = 0;
1779
1780 /**
Robert Carr652aae42016-10-17 16:48:14 -07001781 * Value for {@link #rotationAnimation} which specifies that this
1782 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08001783 */
1784 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1785
1786 /**
Robert Carr652aae42016-10-17 16:48:14 -07001787 * Value for {@link #rotationAnimation} which specifies that this window
1788 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08001789 */
1790 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1791
1792 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07001793 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
1794 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07001795 * can't be applied without pausing the screen. For example, this is ideal
1796 * for Camera apps which don't want the viewfinder contents to ever rotate
1797 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
1798 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07001799 */
1800 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
1801
1802 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001803 * Define the exit and entry animations used on this window when the device is rotated.
1804 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001805 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001806 * by other windows. All other situations default to the
1807 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001808 *
Craig Mautner3c174372013-02-21 17:54:37 -08001809 * @see #ROTATION_ANIMATION_ROTATE
1810 * @see #ROTATION_ANIMATION_CROSSFADE
1811 * @see #ROTATION_ANIMATION_JUMPCUT
1812 */
1813 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1814
1815 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001816 * Identifier for this window. This will usually be filled in for
1817 * you.
1818 */
1819 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001821 /**
1822 * Name of the package owning this window.
1823 */
1824 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001825
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001826 /**
1827 * Specific orientation value for a window.
1828 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001829 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1830 * If not set, a default value of
1831 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001832 * will be used.
1833 */
1834 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001835
1836 /**
Michael Wright3f145a22014-07-22 19:46:03 -07001837 * The preferred refresh rate for the window.
1838 *
1839 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001840 * is on. The selected refresh rate will be applied to the display's default mode.
1841 *
1842 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07001843 *
1844 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001845 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07001846 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001847 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07001848 public float preferredRefreshRate;
1849
1850 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001851 * Id of the preferred display mode for the window.
1852 * <p>
1853 * This must be one of the supported modes obtained for the display(s) the window is on.
1854 * A value of {@code 0} means no preference.
1855 *
1856 * @see Display#getSupportedModes()
1857 * @see Display.Mode#getModeId()
1858 */
1859 public int preferredDisplayModeId;
1860
1861 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001862 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001863 *
1864 * @see View#STATUS_BAR_VISIBLE
1865 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001866 */
1867 public int systemUiVisibility;
1868
1869 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001870 * @hide
1871 * The ui visibility as requested by the views in this hierarchy.
1872 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1873 */
1874 public int subtreeSystemUiVisibility;
1875
1876 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001877 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001878 *
Joe Onorato664644d2011-01-23 17:53:23 -08001879 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1880 *
1881 * @hide
1882 */
1883 public boolean hasSystemUiListeners;
1884
Jeff Brown474dcb52011-06-14 20:22:50 -07001885 /**
1886 * When this window has focus, disable touch pad pointer gesture processing.
1887 * The window will receive raw position updates from the touch pad instead
1888 * of pointer movements and synthetic touch events.
1889 *
1890 * @hide
1891 */
1892 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1893
1894 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001895 * Does not construct an input channel for this window. The channel will therefore
1896 * be incapable of receiving input.
1897 *
1898 * @hide
1899 */
1900 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1901
1902 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001903 * When this window has focus, does not call user activity for all input events so
1904 * the application will have to do it itself. Should only be used by
1905 * the keyguard and phone app.
1906 * <p>
1907 * Should only be used by the keyguard and phone app.
1908 * </p>
1909 *
1910 * @hide
1911 */
1912 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1913
1914 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001915 * Control special features of the input subsystem.
1916 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001917 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001918 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001919 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001920 * @hide
1921 */
1922 public int inputFeatures;
1923
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001924 /**
1925 * Sets the number of milliseconds before the user activity timeout occurs
1926 * when this window has focus. A value of -1 uses the standard timeout.
1927 * A value of 0 uses the minimum support display timeout.
1928 * <p>
1929 * This property can only be used to reduce the user specified display timeout;
1930 * it can never make the timeout longer than it normally would be.
1931 * </p><p>
1932 * Should only be used by the keyguard and phone app.
1933 * </p>
1934 *
1935 * @hide
1936 */
1937 public long userActivityTimeout = -1;
1938
Phil Weaver396d5492016-03-22 17:53:50 -07001939 /**
1940 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
1941 * window.
1942 *
1943 * @hide
1944 */
1945 public int accessibilityIdOfAnchor = -1;
1946
Phil Weaver9be3c7b2016-04-07 15:15:41 -07001947 /**
1948 * The window title isn't kept in sync with what is displayed in the title bar, so we
1949 * separately track the currently shown title to provide to accessibility.
1950 *
1951 * @hide
1952 */
Alan Viverette39259dd2017-05-25 11:10:46 -04001953 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07001954 public CharSequence accessibilityTitle;
1955
Robert Carr70f0d222016-04-10 16:33:08 -07001956 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07001957 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07001958 * by the window manager. Useful for transient notifications like toasts
1959 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07001960 * is hidden. Must be specified at window creation time. Note that apps
1961 * are not prepared to handle their windows being removed without their
1962 * explicit request and may try to interact with the removed window
1963 * resulting in undefined behavior and crashes. Therefore, we do hide
1964 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07001965 *
1966 * @hide
1967 */
Svetoslav Ganovaa076532016-08-01 19:16:43 -07001968 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07001969
Romain Guy48327452017-01-23 17:03:35 -08001970 /**
1971 * The color mode requested by this window. The target display may
1972 * not be able to honor the request. When the color mode is not set
1973 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
1974 * pixel format specified in {@link #format}.
1975 *
1976 * @hide
1977 */
1978 @ActivityInfo.ColorMode
1979 private int mColorMode = ActivityInfo.COLOR_MODE_DEFAULT;
1980
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001981 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001982 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001983 type = TYPE_APPLICATION;
1984 format = PixelFormat.OPAQUE;
1985 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001986
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001987 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001988 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001989 type = _type;
1990 format = PixelFormat.OPAQUE;
1991 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001992
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001993 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001994 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001995 type = _type;
1996 flags = _flags;
1997 format = PixelFormat.OPAQUE;
1998 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001999
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002000 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002001 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002002 type = _type;
2003 flags = _flags;
2004 format = _format;
2005 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002006
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002007 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2008 super(w, h);
2009 type = _type;
2010 flags = _flags;
2011 format = _format;
2012 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002013
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002014 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2015 int _flags, int _format) {
2016 super(w, h);
2017 x = xpos;
2018 y = ypos;
2019 type = _type;
2020 flags = _flags;
2021 format = _format;
2022 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002023
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002024 public final void setTitle(CharSequence title) {
2025 if (null == title)
2026 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002027
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002028 mTitle = TextUtils.stringOrSpannedString(title);
2029 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002030
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002031 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002032 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002033 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002034
Wale Ogunwale246c2092016-04-07 14:12:44 -07002035 /**
2036 * Sets the surface insets based on the elevation (visual z position) of the input view.
2037 * @hide
2038 */
2039 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
2040 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07002041 // Partial workaround for b/28318973. Every inset change causes a freeform window
2042 // to jump a little for a few frames. If we never allow surface insets to decrease,
2043 // they will stabilize quickly (often from the very beginning, as most windows start
2044 // as focused).
2045 // TODO(b/22668382) to fix this properly.
2046 if (surfaceInset == 0) {
2047 // OK to have 0 (this is the case for non-freeform windows).
2048 surfaceInsets.set(0, 0, 0, 0);
2049 } else {
2050 surfaceInsets.set(
2051 Math.max(surfaceInset, surfaceInsets.left),
2052 Math.max(surfaceInset, surfaceInsets.top),
2053 Math.max(surfaceInset, surfaceInsets.right),
2054 Math.max(surfaceInset, surfaceInsets.bottom));
2055 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002056 hasManualSurfaceInsets = manual;
2057 preservePreviousSurfaceInsets = preservePrevious;
2058 }
2059
Romain Guy48327452017-01-23 17:03:35 -08002060 /**
2061 * <p>Set the color mode of the window. Setting the color mode might
2062 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
2063 *
2064 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2065 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
2066 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
2067 *
2068 * @see #getColorMode()
2069 */
2070 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
2071 mColorMode = colorMode;
2072 }
2073
2074 /**
2075 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2076 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
2077 *
2078 * @see #setColorMode(int)
2079 */
2080 @ActivityInfo.ColorMode
2081 public int getColorMode() {
2082 return mColorMode;
2083 }
2084
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002085 /** @hide */
2086 @SystemApi
2087 public final void setUserActivityTimeout(long timeout) {
2088 userActivityTimeout = timeout;
2089 }
2090
2091 /** @hide */
2092 @SystemApi
2093 public final long getUserActivityTimeout() {
2094 return userActivityTimeout;
2095 }
2096
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002097 public int describeContents() {
2098 return 0;
2099 }
2100
2101 public void writeToParcel(Parcel out, int parcelableFlags) {
2102 out.writeInt(width);
2103 out.writeInt(height);
2104 out.writeInt(x);
2105 out.writeInt(y);
2106 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002107 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002108 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002109 out.writeInt(softInputMode);
2110 out.writeInt(gravity);
2111 out.writeFloat(horizontalMargin);
2112 out.writeFloat(verticalMargin);
2113 out.writeInt(format);
2114 out.writeInt(windowAnimations);
2115 out.writeFloat(alpha);
2116 out.writeFloat(dimAmount);
2117 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002118 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08002119 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002120 out.writeStrongBinder(token);
2121 out.writeString(packageName);
2122 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
2123 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07002124 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002125 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08002126 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08002127 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08002128 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07002129 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002130 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07002131 out.writeInt(surfaceInsets.left);
2132 out.writeInt(surfaceInsets.top);
2133 out.writeInt(surfaceInsets.right);
2134 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08002135 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07002136 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002137 out.writeInt(needsMenuKey);
Phil Weaver396d5492016-03-22 17:53:50 -07002138 out.writeInt(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002139 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07002140 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002141 out.writeLong(hideTimeoutMilliseconds);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002142 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002144 public static final Parcelable.Creator<LayoutParams> CREATOR
2145 = new Parcelable.Creator<LayoutParams>() {
2146 public LayoutParams createFromParcel(Parcel in) {
2147 return new LayoutParams(in);
2148 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002149
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 public LayoutParams[] newArray(int size) {
2151 return new LayoutParams[size];
2152 }
2153 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002154
2155
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002156 public LayoutParams(Parcel in) {
2157 width = in.readInt();
2158 height = in.readInt();
2159 x = in.readInt();
2160 y = in.readInt();
2161 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002162 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002163 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002164 softInputMode = in.readInt();
2165 gravity = in.readInt();
2166 horizontalMargin = in.readFloat();
2167 verticalMargin = in.readFloat();
2168 format = in.readInt();
2169 windowAnimations = in.readInt();
2170 alpha = in.readFloat();
2171 dimAmount = in.readFloat();
2172 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002173 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08002174 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002175 token = in.readStrongBinder();
2176 packageName = in.readString();
2177 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
2178 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07002179 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002180 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002181 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08002182 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002183 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07002184 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002185 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07002186 surfaceInsets.left = in.readInt();
2187 surfaceInsets.top = in.readInt();
2188 surfaceInsets.right = in.readInt();
2189 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08002190 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07002191 preservePreviousSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002192 needsMenuKey = in.readInt();
Phil Weaver396d5492016-03-22 17:53:50 -07002193 accessibilityIdOfAnchor = in.readInt();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002194 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07002195 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002196 hideTimeoutMilliseconds = in.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002197 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002198
Romain Guy72998072009-06-22 11:09:20 -07002199 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002200 public static final int LAYOUT_CHANGED = 1<<0;
2201 public static final int TYPE_CHANGED = 1<<1;
2202 public static final int FLAGS_CHANGED = 1<<2;
2203 public static final int FORMAT_CHANGED = 1<<3;
2204 public static final int ANIMATION_CHANGED = 1<<4;
2205 public static final int DIM_AMOUNT_CHANGED = 1<<5;
2206 public static final int TITLE_CHANGED = 1<<6;
2207 public static final int ALPHA_CHANGED = 1<<7;
2208 public static final int MEMORY_TYPE_CHANGED = 1<<8;
2209 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
2210 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
2211 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08002212 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002213 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002214 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08002215 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002216 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08002217 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002218 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07002219 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002220 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002221 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002222 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07002223 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002224 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002225 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04002226 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
2227 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07002228 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002229 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07002230 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
2231 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002232 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
2233 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002234 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
2235 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07002236 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
2237 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04002238 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002239 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
2240 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07002241 public static final int COLOR_MODE_CHANGED = 1 << 26;
2242 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07002243 public static final int EVERYTHING_CHANGED = 0xffffffff;
2244
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002245 // internal buffer to backup/restore parameters under compatibility mode.
2246 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002248 public final int copyFrom(LayoutParams o) {
2249 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002250
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002251 if (width != o.width) {
2252 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07002253 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002254 }
2255 if (height != o.height) {
2256 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07002257 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 }
2259 if (x != o.x) {
2260 x = o.x;
2261 changes |= LAYOUT_CHANGED;
2262 }
2263 if (y != o.y) {
2264 y = o.y;
2265 changes |= LAYOUT_CHANGED;
2266 }
2267 if (horizontalWeight != o.horizontalWeight) {
2268 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002269 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002270 }
2271 if (verticalWeight != o.verticalWeight) {
2272 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002273 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002274 }
2275 if (horizontalMargin != o.horizontalMargin) {
2276 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002277 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002278 }
2279 if (verticalMargin != o.verticalMargin) {
2280 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002281 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002282 }
2283 if (type != o.type) {
2284 type = o.type;
2285 changes |= TYPE_CHANGED;
2286 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002287 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04002288 final int diff = flags ^ o.flags;
2289 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
2290 changes |= TRANSLUCENT_FLAGS_CHANGED;
2291 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002292 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07002293 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002294 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002295 if (privateFlags != o.privateFlags) {
2296 privateFlags = o.privateFlags;
2297 changes |= PRIVATE_FLAGS_CHANGED;
2298 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002299 if (softInputMode != o.softInputMode) {
2300 softInputMode = o.softInputMode;
2301 changes |= SOFT_INPUT_MODE_CHANGED;
2302 }
2303 if (gravity != o.gravity) {
2304 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07002305 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002306 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 if (format != o.format) {
2308 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07002309 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002310 }
2311 if (windowAnimations != o.windowAnimations) {
2312 windowAnimations = o.windowAnimations;
2313 changes |= ANIMATION_CHANGED;
2314 }
2315 if (token == null) {
2316 // NOTE: token only copied if the recipient doesn't
2317 // already have one.
2318 token = o.token;
2319 }
2320 if (packageName == null) {
2321 // NOTE: packageName only copied if the recipient doesn't
2322 // already have one.
2323 packageName = o.packageName;
2324 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08002325 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002326 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002327 mTitle = o.mTitle;
2328 changes |= TITLE_CHANGED;
2329 }
2330 if (alpha != o.alpha) {
2331 alpha = o.alpha;
2332 changes |= ALPHA_CHANGED;
2333 }
2334 if (dimAmount != o.dimAmount) {
2335 dimAmount = o.dimAmount;
2336 changes |= DIM_AMOUNT_CHANGED;
2337 }
2338 if (screenBrightness != o.screenBrightness) {
2339 screenBrightness = o.screenBrightness;
2340 changes |= SCREEN_BRIGHTNESS_CHANGED;
2341 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002342 if (buttonBrightness != o.buttonBrightness) {
2343 buttonBrightness = o.buttonBrightness;
2344 changes |= BUTTON_BRIGHTNESS_CHANGED;
2345 }
Craig Mautner3c174372013-02-21 17:54:37 -08002346 if (rotationAnimation != o.rotationAnimation) {
2347 rotationAnimation = o.rotationAnimation;
2348 changes |= ROTATION_ANIMATION_CHANGED;
2349 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002350
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002351 if (screenOrientation != o.screenOrientation) {
2352 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07002353 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002354 }
Romain Guy529b60a2010-08-03 18:05:47 -07002355
Michael Wright3f145a22014-07-22 19:46:03 -07002356 if (preferredRefreshRate != o.preferredRefreshRate) {
2357 preferredRefreshRate = o.preferredRefreshRate;
2358 changes |= PREFERRED_REFRESH_RATE_CHANGED;
2359 }
2360
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002361 if (preferredDisplayModeId != o.preferredDisplayModeId) {
2362 preferredDisplayModeId = o.preferredDisplayModeId;
2363 changes |= PREFERRED_DISPLAY_MODE_ID;
2364 }
2365
Joe Onorato14782f72011-01-25 19:53:17 -08002366 if (systemUiVisibility != o.systemUiVisibility
2367 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08002368 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08002369 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08002370 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
2371 }
2372
2373 if (hasSystemUiListeners != o.hasSystemUiListeners) {
2374 hasSystemUiListeners = o.hasSystemUiListeners;
2375 changes |= SYSTEM_UI_LISTENER_CHANGED;
2376 }
2377
Jeff Brown474dcb52011-06-14 20:22:50 -07002378 if (inputFeatures != o.inputFeatures) {
2379 inputFeatures = o.inputFeatures;
2380 changes |= INPUT_FEATURES_CHANGED;
2381 }
2382
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002383 if (userActivityTimeout != o.userActivityTimeout) {
2384 userActivityTimeout = o.userActivityTimeout;
2385 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
2386 }
2387
Alan Viverette49a22e82014-07-12 20:01:27 -07002388 if (!surfaceInsets.equals(o.surfaceInsets)) {
2389 surfaceInsets.set(o.surfaceInsets);
2390 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002391 }
2392
Alan Viverette5435a302015-01-29 10:25:34 -08002393 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
2394 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
2395 changes |= SURFACE_INSETS_CHANGED;
2396 }
2397
Wale Ogunwale246c2092016-04-07 14:12:44 -07002398 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
2399 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
2400 changes |= SURFACE_INSETS_CHANGED;
2401 }
2402
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002403 if (needsMenuKey != o.needsMenuKey) {
2404 needsMenuKey = o.needsMenuKey;
2405 changes |= NEEDS_MENU_KEY_CHANGED;
2406 }
2407
Phil Weaver396d5492016-03-22 17:53:50 -07002408 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
2409 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
2410 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
2411 }
2412
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002413 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
2414 && o.accessibilityTitle != null) {
2415 // NOTE: accessibilityTitle only copied if the originator set one.
2416 accessibilityTitle = o.accessibilityTitle;
2417 changes |= ACCESSIBILITY_TITLE_CHANGED;
2418 }
2419
Romain Guy26a2b972017-04-17 09:39:51 -07002420 if (mColorMode != o.mColorMode) {
2421 mColorMode = o.mColorMode;
2422 changes |= COLOR_MODE_CHANGED;
2423 }
2424
Robert Carr70f0d222016-04-10 16:33:08 -07002425 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002426 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07002427
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002428 return changes;
2429 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002430
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002431 @Override
2432 public String debug(String output) {
2433 output += "Contents of " + this + ":";
2434 Log.d("Debug", output);
2435 output = super.debug("");
2436 Log.d("Debug", output);
2437 Log.d("Debug", "");
2438 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
2439 return "";
2440 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002441
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002442 @Override
2443 public String toString() {
2444 StringBuilder sb = new StringBuilder(256);
2445 sb.append("WM.LayoutParams{");
2446 sb.append("(");
2447 sb.append(x);
2448 sb.append(',');
2449 sb.append(y);
2450 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08002451 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
2452 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002453 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08002454 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
2455 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002456 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002457 if (horizontalMargin != 0) {
2458 sb.append(" hm=");
2459 sb.append(horizontalMargin);
2460 }
2461 if (verticalMargin != 0) {
2462 sb.append(" vm=");
2463 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002464 }
2465 if (gravity != 0) {
2466 sb.append(" gr=#");
2467 sb.append(Integer.toHexString(gravity));
2468 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002469 if (softInputMode != 0) {
2470 sb.append(" sim=#");
2471 sb.append(Integer.toHexString(softInputMode));
2472 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002473 sb.append(" ty=");
2474 sb.append(type);
2475 sb.append(" fl=#");
2476 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002477 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07002478 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
2479 sb.append(" compatible=true");
2480 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002481 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
2482 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002483 if (format != PixelFormat.OPAQUE) {
2484 sb.append(" fmt=");
2485 sb.append(format);
2486 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002487 if (windowAnimations != 0) {
2488 sb.append(" wanim=0x");
2489 sb.append(Integer.toHexString(windowAnimations));
2490 }
2491 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
2492 sb.append(" or=");
2493 sb.append(screenOrientation);
2494 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002495 if (alpha != 1.0f) {
2496 sb.append(" alpha=");
2497 sb.append(alpha);
2498 }
2499 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2500 sb.append(" sbrt=");
2501 sb.append(screenBrightness);
2502 }
2503 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2504 sb.append(" bbrt=");
2505 sb.append(buttonBrightness);
2506 }
Craig Mautner3c174372013-02-21 17:54:37 -08002507 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
2508 sb.append(" rotAnim=");
2509 sb.append(rotationAnimation);
2510 }
Michael Wright3f145a22014-07-22 19:46:03 -07002511 if (preferredRefreshRate != 0) {
2512 sb.append(" preferredRefreshRate=");
2513 sb.append(preferredRefreshRate);
2514 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002515 if (preferredDisplayModeId != 0) {
2516 sb.append(" preferredDisplayMode=");
2517 sb.append(preferredDisplayModeId);
2518 }
Joe Onorato664644d2011-01-23 17:53:23 -08002519 if (systemUiVisibility != 0) {
2520 sb.append(" sysui=0x");
2521 sb.append(Integer.toHexString(systemUiVisibility));
2522 }
Joe Onorato14782f72011-01-25 19:53:17 -08002523 if (subtreeSystemUiVisibility != 0) {
2524 sb.append(" vsysui=0x");
2525 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
2526 }
Joe Onorato664644d2011-01-23 17:53:23 -08002527 if (hasSystemUiListeners) {
2528 sb.append(" sysuil=");
2529 sb.append(hasSystemUiListeners);
2530 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002531 if (inputFeatures != 0) {
2532 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
2533 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002534 if (userActivityTimeout >= 0) {
2535 sb.append(" userActivityTimeout=").append(userActivityTimeout);
2536 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07002537 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07002538 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
2539 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07002540 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08002541 if (hasManualSurfaceInsets) {
2542 sb.append(" (manual)");
2543 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002544 if (!preservePreviousSurfaceInsets) {
2545 sb.append(" (!preservePreviousSurfaceInsets)");
2546 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07002547 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002548 if (needsMenuKey != NEEDS_MENU_UNSET) {
2549 sb.append(" needsMenuKey=");
2550 sb.append(needsMenuKey);
2551 }
Romain Guy48327452017-01-23 17:03:35 -08002552 sb.append(" colorMode=").append(mColorMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002553 sb.append('}');
2554 return sb.toString();
2555 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002556
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002557 /**
2558 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002559 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002560 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002561 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002562 x = (int) (x * scale + 0.5f);
2563 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002564 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002565 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002566 }
2567 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002568 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002569 }
2570 }
2571
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002572 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002573 * Backup the layout parameters used in compatibility mode.
2574 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002575 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002576 void backup() {
2577 int[] backup = mCompatibilityParamsBackup;
2578 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002579 // we backup 4 elements, x, y, width, height
2580 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002581 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002582 backup[0] = x;
2583 backup[1] = y;
2584 backup[2] = width;
2585 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002586 }
2587
2588 /**
2589 * Restore the layout params' coordinates, size and gravity
2590 * @see LayoutParams#backup()
2591 */
2592 void restore() {
2593 int[] backup = mCompatibilityParamsBackup;
2594 if (backup != null) {
2595 x = backup[0];
2596 y = backup[1];
2597 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002598 height = backup[3];
2599 }
2600 }
2601
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002602 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07002603
2604 /** @hide */
2605 @Override
2606 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
2607 super.encodeProperties(encoder);
2608
2609 encoder.addProperty("x", x);
2610 encoder.addProperty("y", y);
2611 encoder.addProperty("horizontalWeight", horizontalWeight);
2612 encoder.addProperty("verticalWeight", verticalWeight);
2613 encoder.addProperty("type", type);
2614 encoder.addProperty("flags", flags);
2615 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02002616
2617 /**
2618 * @hide
2619 * @return True if the layout parameters will cause the window to cover the full screen;
2620 * false otherwise.
2621 */
2622 public boolean isFullscreen() {
2623 return x == 0 && y == 0
2624 && width == WindowManager.LayoutParams.MATCH_PARENT
2625 && height == WindowManager.LayoutParams.MATCH_PARENT;
2626 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002627 }
2628}