blob: 37aca260c9376ebd27d2ff6ffcd90e4c608b62ba [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 Jaggi484851b2017-09-22 16:03:27 +020019import static android.content.pm.ActivityInfo.COLOR_MODE_DEFAULT;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080020import static android.view.WindowLayoutParamsProto.ALPHA;
21import static android.view.WindowLayoutParamsProto.BUTTON_BRIGHTNESS;
22import static android.view.WindowLayoutParamsProto.COLOR_MODE;
23import static android.view.WindowLayoutParamsProto.FLAGS;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080024import static android.view.WindowLayoutParamsProto.FORMAT;
25import static android.view.WindowLayoutParamsProto.GRAVITY;
26import static android.view.WindowLayoutParamsProto.HAS_SYSTEM_UI_LISTENERS;
27import static android.view.WindowLayoutParamsProto.HEIGHT;
28import static android.view.WindowLayoutParamsProto.HORIZONTAL_MARGIN;
29import static android.view.WindowLayoutParamsProto.INPUT_FEATURE_FLAGS;
30import static android.view.WindowLayoutParamsProto.NEEDS_MENU_KEY;
31import static android.view.WindowLayoutParamsProto.PREFERRED_REFRESH_RATE;
32import static android.view.WindowLayoutParamsProto.PRIVATE_FLAGS;
33import static android.view.WindowLayoutParamsProto.ROTATION_ANIMATION;
34import static android.view.WindowLayoutParamsProto.SCREEN_BRIGHTNESS;
35import static android.view.WindowLayoutParamsProto.SOFT_INPUT_MODE;
36import static android.view.WindowLayoutParamsProto.SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS;
37import static android.view.WindowLayoutParamsProto.SYSTEM_UI_VISIBILITY_FLAGS;
38import static android.view.WindowLayoutParamsProto.TYPE;
39import static android.view.WindowLayoutParamsProto.USER_ACTIVITY_TIMEOUT;
40import static android.view.WindowLayoutParamsProto.VERTICAL_MARGIN;
41import static android.view.WindowLayoutParamsProto.WIDTH;
42import static android.view.WindowLayoutParamsProto.WINDOW_ANIMATIONS;
43import static android.view.WindowLayoutParamsProto.X;
44import static android.view.WindowLayoutParamsProto.Y;
Jorim Jaggi484851b2017-09-22 16:03:27 +020045
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020046import android.Manifest.permission;
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080047import android.annotation.IntDef;
Siva Velusamy0d857b92015-04-22 10:23:56 -070048import android.annotation.NonNull;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040049import android.annotation.RequiresPermission;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080050import android.annotation.SystemApi;
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060051import android.annotation.SystemService;
Robert Carrb48380a2017-04-04 14:56:37 -070052import android.annotation.TestApi;
Jorim Jaggi241ae102016-11-02 21:57:33 -070053import android.app.KeyguardManager;
Jeff Browna492c3a2012-08-23 19:48:44 -070054import android.app.Presentation;
55import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056import android.content.pm.ActivityInfo;
57import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070058import android.graphics.Rect;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040059import android.graphics.Region;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060import android.os.IBinder;
61import android.os.Parcel;
62import android.os.Parcelable;
63import android.text.TextUtils;
64import android.util.Log;
Steven Timotiusaf03df62017-07-18 16:56:43 -070065import android.util.proto.ProtoOutputStream;
Phil Weaver8583ae82018-02-13 11:01:24 -080066import android.view.accessibility.AccessibilityNodeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080068import java.lang.annotation.Retention;
69import java.lang.annotation.RetentionPolicy;
Clara Bayarri75e09792015-07-29 16:20:40 +010070import java.util.List;
Wale Ogunwale1f240c92016-02-22 18:04:58 -080071import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072
73/**
74 * The interface that apps use to talk to the window manager.
Jeff Browna492c3a2012-08-23 19:48:44 -070075 * </p><p>
76 * Each window manager instance is bound to a particular {@link Display}.
77 * To obtain a {@link WindowManager} for a different display, use
78 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
79 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
80 * to get the WindowManager.
81 * </p><p>
82 * The simplest way to show a window on another display is to create a
83 * {@link Presentation}. The presentation will automatically obtain a
84 * {@link WindowManager} and {@link Context} for that display.
85 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 */
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060087@SystemService(Context.WINDOW_SERVICE)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088public interface WindowManager extends ViewManager {
Jorim Jaggi61f39a72015-10-29 16:54:18 +010089
90 /** @hide */
91 int DOCKED_INVALID = -1;
92 /** @hide */
93 int DOCKED_LEFT = 1;
94 /** @hide */
95 int DOCKED_TOP = 2;
96 /** @hide */
97 int DOCKED_RIGHT = 3;
98 /** @hide */
99 int DOCKED_BOTTOM = 4;
100
Winson41275482016-10-10 15:17:45 -0700101 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000102 String INPUT_CONSUMER_PIP = "pip_input_consumer";
Winson41275482016-10-10 15:17:45 -0700103 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000104 String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer";
Winson41275482016-10-10 15:17:45 -0700105 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000106 String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer";
107 /** @hide */
108 String INPUT_CONSUMER_RECENTS_ANIMATION = "recents_animation_input_consumer";
Winson41275482016-10-10 15:17:45 -0700109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100111 * Not set up for a transition.
112 * @hide
113 */
114 int TRANSIT_UNSET = -1;
115
116 /**
117 * No animation for transition.
118 * @hide
119 */
120 int TRANSIT_NONE = 0;
121
122 /**
123 * A window in a new activity is being opened on top of an existing one in the same task.
124 * @hide
125 */
126 int TRANSIT_ACTIVITY_OPEN = 6;
127
128 /**
129 * The window in the top-most activity is being closed to reveal the previous activity in the
130 * same task.
131 * @hide
132 */
133 int TRANSIT_ACTIVITY_CLOSE = 7;
134
135 /**
136 * A window in a new task is being opened on top of an existing one in another activity's task.
137 * @hide
138 */
139 int TRANSIT_TASK_OPEN = 8;
140
141 /**
142 * A window in the top-most activity is being closed to reveal the previous activity in a
143 * different task.
144 * @hide
145 */
146 int TRANSIT_TASK_CLOSE = 9;
147
148 /**
149 * A window in an existing task is being displayed on top of an existing one in another
150 * activity's task.
151 * @hide
152 */
153 int TRANSIT_TASK_TO_FRONT = 10;
154
155 /**
156 * A window in an existing task is being put below all other tasks.
157 * @hide
158 */
159 int TRANSIT_TASK_TO_BACK = 11;
160
161 /**
162 * A window in a new activity that doesn't have a wallpaper is being opened on top of one that
163 * does, effectively closing the wallpaper.
164 * @hide
165 */
166 int TRANSIT_WALLPAPER_CLOSE = 12;
167
168 /**
169 * A window in a new activity that does have a wallpaper is being opened on one that didn't,
170 * effectively opening the wallpaper.
171 * @hide
172 */
173 int TRANSIT_WALLPAPER_OPEN = 13;
174
175 /**
176 * A window in a new activity is being opened on top of an existing one, and both are on top
177 * of the wallpaper.
178 * @hide
179 */
180 int TRANSIT_WALLPAPER_INTRA_OPEN = 14;
181
182 /**
183 * The window in the top-most activity is being closed to reveal the previous activity, and
184 * both are on top of the wallpaper.
185 * @hide
186 */
187 int TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
188
189 /**
190 * A window in a new task is being opened behind an existing one in another activity's task.
191 * The new window will show briefly and then be gone.
192 * @hide
193 */
194 int TRANSIT_TASK_OPEN_BEHIND = 16;
195
196 /**
197 * A window in a task is being animated in-place.
198 * @hide
199 */
200 int TRANSIT_TASK_IN_PLACE = 17;
201
202 /**
203 * An activity is being relaunched (e.g. due to configuration change).
204 * @hide
205 */
206 int TRANSIT_ACTIVITY_RELAUNCH = 18;
207
208 /**
209 * A task is being docked from recents.
210 * @hide
211 */
212 int TRANSIT_DOCK_TASK_FROM_RECENTS = 19;
213
214 /**
215 * Keyguard is going away.
216 * @hide
217 */
218 int TRANSIT_KEYGUARD_GOING_AWAY = 20;
219
220 /**
221 * Keyguard is going away with showing an activity behind that requests wallpaper.
222 * @hide
223 */
224 int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
225
226 /**
227 * Keyguard is being occluded.
228 * @hide
229 */
230 int TRANSIT_KEYGUARD_OCCLUDE = 22;
231
232 /**
233 * Keyguard is being unoccluded.
234 * @hide
235 */
236 int TRANSIT_KEYGUARD_UNOCCLUDE = 23;
237
238 /**
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200239 * A translucent activity is being opened.
240 * @hide
241 */
242 int TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24;
243
244 /**
245 * A translucent activity is being closed.
246 * @hide
247 */
248 int TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25;
249
250 /**
Adrian Roos93577212018-04-10 14:12:10 -0700251 * A crashing activity is being closed.
252 * @hide
253 */
254 int TRANSIT_CRASHING_ACTIVITY_CLOSE = 26;
255
256 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100257 * @hide
258 */
259 @IntDef(prefix = { "TRANSIT_" }, value = {
260 TRANSIT_UNSET,
261 TRANSIT_NONE,
262 TRANSIT_ACTIVITY_OPEN,
263 TRANSIT_ACTIVITY_CLOSE,
264 TRANSIT_TASK_OPEN,
265 TRANSIT_TASK_CLOSE,
266 TRANSIT_TASK_TO_FRONT,
267 TRANSIT_TASK_TO_BACK,
268 TRANSIT_WALLPAPER_CLOSE,
269 TRANSIT_WALLPAPER_OPEN,
270 TRANSIT_WALLPAPER_INTRA_OPEN,
271 TRANSIT_WALLPAPER_INTRA_CLOSE,
272 TRANSIT_TASK_OPEN_BEHIND,
273 TRANSIT_TASK_IN_PLACE,
274 TRANSIT_ACTIVITY_RELAUNCH,
275 TRANSIT_DOCK_TASK_FROM_RECENTS,
276 TRANSIT_KEYGUARD_GOING_AWAY,
277 TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
278 TRANSIT_KEYGUARD_OCCLUDE,
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200279 TRANSIT_KEYGUARD_UNOCCLUDE,
280 TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
281 TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100282 })
283 @Retention(RetentionPolicy.SOURCE)
284 @interface TransitionType {}
285
286 /**
287 * Transition flag: Keyguard is going away, but keeping the notification shade open
288 * @hide
289 */
290 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE = 0x1;
291
292 /**
293 * Transition flag: Keyguard is going away, but doesn't want an animation for it
294 * @hide
295 */
296 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION = 0x2;
297
298 /**
299 * Transition flag: Keyguard is going away while it was showing the system wallpaper.
300 * @hide
301 */
302 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER = 0x4;
303
304 /**
305 * @hide
306 */
307 @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = {
308 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE,
309 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION,
310 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER,
311 })
312 @Retention(RetentionPolicy.SOURCE)
313 @interface TransitionFlags {}
314
315 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100317 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 * is invalid.
319 */
320 public static class BadTokenException extends RuntimeException {
321 public BadTokenException() {
322 }
323
324 public BadTokenException(String name) {
325 super(name);
326 }
327 }
328
329 /**
Craig Mautner6018aee2012-10-23 14:27:49 -0700330 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
331 * be found. See {@link android.app.Presentation} for more information on secondary displays.
332 */
333 public static class InvalidDisplayException extends RuntimeException {
334 public InvalidDisplayException() {
335 }
336
337 public InvalidDisplayException(String name) {
338 super(name);
339 }
340 }
341
342 /**
Jeff Browna492c3a2012-08-23 19:48:44 -0700343 * Returns the {@link Display} upon which this {@link WindowManager} instance
344 * will create new windows.
345 * <p>
346 * Despite the name of this method, the display that is returned is not
347 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
348 * The returned display could instead be a secondary display that this
349 * window manager instance is managing. Think of it as the display that
350 * this {@link WindowManager} instance uses by default.
351 * </p><p>
352 * To create windows on a different display, you need to obtain a
353 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
354 * class documentation for more information.)
355 * </p>
356 *
357 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 */
359 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 /**
362 * Special variation of {@link #removeView} that immediately invokes
363 * the given view hierarchy's {@link View#onDetachedFromWindow()
364 * View.onDetachedFromWindow()} methods before returning. This is not
365 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700366 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 * @param view The view to be removed.
368 */
369 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700370
Clara Bayarri75e09792015-07-29 16:20:40 +0100371 /**
372 * Used to asynchronously request Keyboard Shortcuts from the focused window.
373 *
374 * @hide
375 */
376 public interface KeyboardShortcutsReceiver {
377 /**
378 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
379 *
380 * @param result The keyboard shortcuts to be displayed.
381 */
382 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
383 }
384
385 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800386 * Message for taking fullscreen screenshot
387 * @hide
388 */
389 final int TAKE_SCREENSHOT_FULLSCREEN = 1;
390
391 /**
392 * Message for taking screenshot of selected region.
393 * @hide
394 */
395 final int TAKE_SCREENSHOT_SELECTED_REGION = 2;
396
397 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100398 * @hide
399 */
400 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
401
402 /**
403 * Request for keyboard shortcuts to be retrieved asynchronously.
404 *
405 * @param receiver The callback to be triggered when the result is ready.
406 *
407 * @hide
408 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000409 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100410
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400411 /**
412 * Return the touch region for the current IME window, or an empty region if there is none.
413 *
414 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
415 * region or there was an error.
416 *
417 * @hide
418 */
419 @SystemApi
420 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
421 public Region getCurrentImeTouchRegion();
422
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800423 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 /**
425 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700426 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
427 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 */
Romain Guy529b60a2010-08-03 18:05:47 -0700429 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800432 /**
433 * Y position for this window. With the default gravity it is ignored.
434 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
435 * an offset from the given edge.
436 */
Romain Guy529b60a2010-08-03 18:05:47 -0700437 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 public int y;
439
440 /**
441 * Indicates how much of the extra space will be allocated horizontally
442 * to the view associated with these LayoutParams. Specify 0 if the view
443 * should not be stretched. Otherwise the extra pixels will be pro-rated
444 * among all views whose weight is greater than 0.
445 */
Romain Guy529b60a2010-08-03 18:05:47 -0700446 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 public float horizontalWeight;
448
449 /**
450 * Indicates how much of the extra space will be allocated vertically
451 * to the view associated with these LayoutParams. Specify 0 if the view
452 * should not be stretched. Otherwise the extra pixels will be pro-rated
453 * among all views whose weight is greater than 0.
454 */
Romain Guy529b60a2010-08-03 18:05:47 -0700455 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800456 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700457
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 /**
459 * The general type of window. There are three main classes of
460 * window types:
461 * <ul>
462 * <li> <strong>Application windows</strong> (ranging from
463 * {@link #FIRST_APPLICATION_WINDOW} to
464 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
465 * windows. For these types of windows, the {@link #token} must be
466 * set to the token of the activity they are a part of (this will
467 * normally be done for you if {@link #token} is null).
468 * <li> <strong>Sub-windows</strong> (ranging from
469 * {@link #FIRST_SUB_WINDOW} to
470 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
471 * window. For these types of windows, the {@link #token} must be
472 * the token of the window it is attached to.
473 * <li> <strong>System windows</strong> (ranging from
474 * {@link #FIRST_SYSTEM_WINDOW} to
475 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
476 * use by the system for specific purposes. They should not normally
477 * be used by applications, and a special permission is required
478 * to use them.
479 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700480 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800481 * @see #TYPE_BASE_APPLICATION
482 * @see #TYPE_APPLICATION
483 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700484 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 * @see #TYPE_APPLICATION_PANEL
486 * @see #TYPE_APPLICATION_MEDIA
487 * @see #TYPE_APPLICATION_SUB_PANEL
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700488 * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
490 * @see #TYPE_STATUS_BAR
491 * @see #TYPE_SEARCH_BAR
492 * @see #TYPE_PHONE
493 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 * @see #TYPE_TOAST
495 * @see #TYPE_SYSTEM_OVERLAY
496 * @see #TYPE_PRIORITY_PHONE
497 * @see #TYPE_STATUS_BAR_PANEL
498 * @see #TYPE_SYSTEM_DIALOG
499 * @see #TYPE_KEYGUARD_DIALOG
500 * @see #TYPE_SYSTEM_ERROR
501 * @see #TYPE_INPUT_METHOD
502 * @see #TYPE_INPUT_METHOD_DIALOG
503 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700504 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700505 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200506 to = "BASE_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700507 @ViewDebug.IntToString(from = TYPE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200508 to = "APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700509 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200510 to = "APPLICATION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700511 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200512 to = "DRAWN_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700513 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200514 to = "APPLICATION_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700515 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200516 to = "APPLICATION_MEDIA"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700517 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200518 to = "APPLICATION_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700519 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200520 to = "APPLICATION_ABOVE_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700521 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200522 to = "APPLICATION_ATTACHED_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700523 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200524 to = "APPLICATION_MEDIA_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700525 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200526 to = "STATUS_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700527 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200528 to = "SEARCH_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700529 @ViewDebug.IntToString(from = TYPE_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200530 to = "PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700531 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200532 to = "SYSTEM_ALERT"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700533 @ViewDebug.IntToString(from = TYPE_TOAST,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200534 to = "TOAST"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700535 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200536 to = "SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700537 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200538 to = "PRIORITY_PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700539 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200540 to = "SYSTEM_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700541 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200542 to = "KEYGUARD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700543 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200544 to = "SYSTEM_ERROR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700545 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200546 to = "INPUT_METHOD"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700547 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200548 to = "INPUT_METHOD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700549 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200550 to = "WALLPAPER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700551 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200552 to = "STATUS_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700553 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200554 to = "SECURE_SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700555 @ViewDebug.IntToString(from = TYPE_DRAG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200556 to = "DRAG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700557 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200558 to = "STATUS_BAR_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700559 @ViewDebug.IntToString(from = TYPE_POINTER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200560 to = "POINTER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700561 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200562 to = "NAVIGATION_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700563 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200564 to = "VOLUME_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700565 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200566 to = "BOOT_PROGRESS"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700567 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200568 to = "INPUT_CONSUMER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700569 @ViewDebug.IntToString(from = TYPE_DREAM,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200570 to = "DREAM"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700571 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200572 to = "NAVIGATION_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700573 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200574 to = "DISPLAY_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700575 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200576 to = "MAGNIFICATION_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700577 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200578 to = "PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700579 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200580 to = "PRIVATE_PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700581 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200582 to = "VOICE_INTERACTION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700583 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200584 to = "VOICE_INTERACTION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700585 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200586 to = "DOCK_DIVIDER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700587 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200588 to = "QS_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700589 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200590 to = "SCREENSHOT"),
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800591 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200592 to = "APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700593 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800594 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700595
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800596 /**
597 * Start of window types that represent normal application windows.
598 */
599 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700600
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800601 /**
602 * Window type: an application window that serves as the "base" window
603 * of the overall application; all other application windows will
604 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700605 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 */
607 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 /**
610 * Window type: a normal application window. The {@link #token} must be
611 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700612 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 */
614 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700615
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800616 /**
617 * Window type: special application window that is displayed while the
618 * application is starting. Not for use by applications themselves;
619 * this is used by the system to display something until the
620 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700621 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 */
623 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700626 * Window type: a variation on TYPE_APPLICATION that ensures the window
627 * manager will wait for this window to be drawn before the app is shown.
628 * In multiuser systems shows only on the owning user's window.
629 */
630 public static final int TYPE_DRAWN_APPLICATION = 4;
631
632 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 * End of types of application windows.
634 */
635 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700636
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 /**
638 * Start of types of sub-windows. The {@link #token} of these windows
639 * must be set to the window they are attached to. These types of
640 * windows are kept next to their attached window in Z-order, and their
641 * coordinate space is relative to their attached window.
642 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700643 public static final int FIRST_SUB_WINDOW = 1000;
644
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 /**
646 * Window type: a panel on top of an application window. These windows
647 * appear on top of their attached window.
648 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700649 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
650
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 /**
John Spurlock33291d82013-03-13 14:45:14 -0400652 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800653 * are displayed behind their attached window.
654 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700655 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
656
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 /**
658 * Window type: a sub-panel on top of an application window. These
659 * windows are displayed on top their attached window and any
660 * {@link #TYPE_APPLICATION_PANEL} panels.
661 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700662 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663
664 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
665 * of the window happens as that of a top-level window, <em>not</em>
666 * as a child of its container.
667 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700668 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700671 * Window type: window for showing overlays on top of media windows.
672 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
673 * application window. They should be translucent to be useful. This
674 * is a big ugly hack so:
675 * @hide
676 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700677 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
678
679 /**
680 * Window type: a above sub-panel on top of an application window and it's
681 * sub-panel windows. These windows are displayed on top of their attached window
682 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700683 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700684 */
685 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
686
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700687 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 * End of types of sub-windows.
689 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700690 public static final int LAST_SUB_WINDOW = 1999;
691
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 /**
693 * Start of system-specific window types. These are not normally
694 * created by applications.
695 */
696 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700697
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 /**
699 * Window type: the status bar. There can be only one status bar
700 * window; it is placed at the top of the screen, and all other
701 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700702 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 */
704 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700705
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800706 /**
707 * Window type: the search bar. There can be only one search bar
708 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700709 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 */
711 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700712
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800713 /**
714 * Window type: phone. These are non-application windows providing
715 * user interaction with the phone (in particular incoming calls).
716 * These windows are normally placed above all applications, but behind
717 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700718 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800719 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800721 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800722 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700723
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 /**
725 * Window type: system window, such as low power alert. These windows
726 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700727 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800728 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800730 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800731 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100732
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 /**
734 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700735 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200736 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800737 */
738 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100739
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800740 /**
741 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700742 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800743 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800744 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800745 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700747
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748 /**
749 * Window type: system overlay windows, which need to be displayed
750 * on top of everything else. These windows must not take input
751 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700752 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800753 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800754 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800755 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700757
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758 /**
759 * Window type: priority phone UI, which needs to be displayed even if
760 * the keyguard is active. These windows must not take input
761 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700762 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800763 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800765 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 /**
769 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700770 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800771 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800772 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700773
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800774 /**
775 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700776 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777 */
778 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700779
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800780 /**
781 * Window type: internal system error windows, appear on top of
782 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700783 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800784 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800785 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800786 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700788
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 /**
790 * Window type: internal input methods windows, which appear above
791 * the normal UI. Application windows may be resized or panned to keep
792 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700793 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 */
795 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
796
797 /**
798 * Window type: internal input methods dialog windows, which appear above
799 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700800 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800801 */
802 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
803
804 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700805 * Window type: wallpaper window, placed behind any window that wants
806 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700807 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700808 */
809 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
810
811 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800812 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700813 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800814 */
815 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700816
817 /**
818 * Window type: secure system overlay windows, which need to be displayed
819 * on top of everything else. These windows must not take input
820 * focus, or they will interfere with the keyguard.
821 *
822 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
823 * system itself is allowed to create these overlays. Applications cannot
824 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700825 *
826 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700827 * @hide
828 */
829 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
830
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800831 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700832 * Window type: the drag-and-drop pseudowindow. There is only one
833 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700834 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700835 * @hide
836 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700837 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700838
839 /**
Robert Carr8360a782017-11-22 12:47:58 -0800840 * Window type: panel that slides out from over the status bar
841 * In multiuser systems shows on all users' windows. These windows
842 * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL}
843 * windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800844 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800845 */
846 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
847
Jeff Brown83c09682010-12-23 17:50:18 -0800848 /**
849 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700850 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800851 * @hide
852 */
853 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800854
855 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400856 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700857 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400858 * @hide
859 */
860 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
861
862 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700863 * Window type: The volume level overlay/dialog shown when the user
864 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700865 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700866 * @hide
867 */
868 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
869
870 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700871 * Window type: The boot progress dialog, goes on top of everything
872 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700873 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700874 * @hide
875 */
876 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
877
878 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700879 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700880 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700881 * @hide
882 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700883 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -0700884
885 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500886 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700887 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500888 * @hide
889 */
890 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
891
892 /**
Jim Millere898ac52012-04-06 17:10:57 -0700893 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700894 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700895 * @hide
896 */
897 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
898
899 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700900 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700901 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700902 * @hide
903 */
904 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
905
906 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700907 * Window type: Magnification overlay window. Used to highlight the magnified
908 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700909 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700910 * @hide
911 */
912 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
913
914 /**
keunyounga446bf02013-06-21 19:07:57 -0700915 * Window type: Window for Presentation on top of private
916 * virtual display.
917 */
918 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
919
920 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700921 * Window type: Windows in the voice interaction layer.
922 * @hide
923 */
924 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
925
926 /**
Phil Weaver40ded282016-01-25 15:49:02 -0800927 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -0700928 * android.accessibilityservice.AccessibilityService} for interception of
929 * user interactions without changing the windows an accessibility service
930 * can introspect. In particular, an accessibility service can introspect
931 * only windows that a sighted user can interact with which is they can touch
932 * these windows or can type into these windows. For example, if there
933 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -0800934 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -0700935 * they are covered by a touchable window.
936 */
937 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
938
939 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700940 * Window type: Starting window for voice interaction layer.
941 * @hide
942 */
943 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
944
945 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -0700946 * Window for displaying a handle used for resizing docked stacks. This window is owned
947 * by the system process.
948 * @hide
949 */
950 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
951
952 /**
Jason Monk8f7f3182015-11-18 16:35:14 -0500953 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
954 * by Quick Settings Tiles.
955 * @hide
956 */
957 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
958
959 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800960 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is
Muyuan Li36ca72c2016-08-06 20:24:06 -0700961 * reserved for screenshot region selection. These windows must not take input focus.
Muyuan Li6ca619f2016-03-08 13:30:42 -0800962 * @hide
963 */
964 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
965
966 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700967 * Window type: Window for Presentation on an external display.
968 * @see android.app.Presentation
969 * @hide
970 */
971 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
972
973 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800974 * Window type: Application overlay windows are displayed above all activity windows
975 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
976 * but below critical system windows like the status bar or IME.
977 * <p>
978 * The system may change the position, size, or visibility of these windows at anytime
979 * to reduce visual clutter to the user and also manage resources.
980 * <p>
981 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
982 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -0800983 * The system will adjust the importance of processes with this window type to reduce the
984 * chance of the low-memory-killer killing them.
985 * <p>
986 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800987 */
988 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
989
990 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800991 * End of types of system windows.
992 */
993 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800995 /**
Albert Chaulke4338f82017-04-19 15:54:08 -0400996 * @hide
997 * Used internally when there is no suitable type available.
998 */
999 public static final int INVALID_WINDOW_TYPE = -1;
1000
1001 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001002 * Return true if the window type is an alert window.
1003 *
1004 * @param type The window type.
1005 * @return If the window type is an alert window.
1006 * @hide
1007 */
1008 public static boolean isSystemAlertWindowType(int type) {
1009 switch (type) {
1010 case TYPE_PHONE:
1011 case TYPE_PRIORITY_PHONE:
1012 case TYPE_SYSTEM_ALERT:
1013 case TYPE_SYSTEM_ERROR:
1014 case TYPE_SYSTEM_OVERLAY:
1015 case TYPE_APPLICATION_OVERLAY:
1016 return true;
1017 }
1018 return false;
1019 }
1020
Mathias Agopiand2112302010-12-07 19:38:17 -08001021 /** @deprecated this is ignored, this value is set automatically when needed. */
1022 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -08001024 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001025 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001026 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -08001027 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001028 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -08001030 /** @deprecated this is ignored, this value is set automatically when needed. */
1031 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001032 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001033
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001035 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001036 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001037 @Deprecated
1038 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001039
Mike Lockwoodef731622010-01-27 17:51:34 -05001040 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001041 * the lock screen to activate while the screen is on.
1042 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -08001043 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -05001044 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
1045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001046 /** Window flag: everything behind this window will be dimmed.
1047 * Use {@link #dimAmount} to control the amount of dim. */
1048 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001049
1050 /** Window flag: blur everything behind this window.
1051 * @deprecated Blurring is no longer supported. */
1052 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 /** Window flag: this window won't ever get key input focus, so the
1056 * user can not send key or other button events to it. Those will
1057 * instead go to whatever focusable window is behind it. This flag
1058 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
1059 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001060 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001061 * <p>Setting this flag also implies that the window will not need to
1062 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001063 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001064 * independently of any active input method (typically this means it
1065 * gets Z-ordered on top of the input method, so it can use the full
1066 * screen for its content and cover the input method if needed. You
1067 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
1068 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001070 /** Window flag: this window can never receive touch events. */
1071 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001072
John Spurlock33291d82013-03-13 14:45:14 -04001073 /** Window flag: even when this window is focusable (its
1074 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 * outside of the window to be sent to the windows behind it. Otherwise
1076 * it will consume all pointer events itself, regardless of whether they
1077 * are inside of the window. */
1078 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001079
John Spurlock33291d82013-03-13 14:45:14 -04001080 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 * screen is pressed, you will receive this first touch event. Usually
1082 * the first touch event is consumed by the system since the user can
1083 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -07001084 *
1085 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001086 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001087 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001088 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 /** Window flag: as long as this window is visible to the user, keep
1091 * the device's screen turned on and bright. */
1092 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -04001095 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 * window must correctly position its contents to take the screen
1097 * decoration into account. This flag is normally set for you
Adrian Roosfa02da62018-01-15 16:01:18 +01001098 * by Window as described in {@link Window#setFlags}.
1099 *
1100 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed
1101 * such that it avoids the {@link DisplayCutout} area if necessary according to the
1102 * {@link #layoutInDisplayCutoutMode}.
1103 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001104 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001105
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 /** Window flag: allow window to extend outside of the screen. */
1107 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001108
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001109 /**
John Spurlock33291d82013-03-13 14:45:14 -04001110 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001111 * this window is displayed. This allows the window to use the entire
1112 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -07001113 * an app window with this flag set is on the top layer. A fullscreen window
1114 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
1115 * {@link #softInputMode} field; the window will stay fullscreen
1116 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001117 *
1118 * <p>This flag can be controlled in your theme through the
1119 * {@link android.R.attr#windowFullscreen} attribute; this attribute
1120 * is automatically set for you in the standard fullscreen themes
1121 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
1122 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
1123 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
1124 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
1125 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
1126 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
1127 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
1128 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001129 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001130
John Spurlock33291d82013-03-13 14:45:14 -04001131 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
1132 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -07001136 * the screen.
1137 * @deprecated This flag is no longer used. */
1138 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001139 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001140
John Spurlock33291d82013-03-13 14:45:14 -04001141 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -07001142 * it from appearing in screenshots or from being viewed on non-secure
1143 * displays.
1144 *
1145 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
1146 * secure surfaces and secure displays.
1147 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001149
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001150 /** Window flag: a special mode where the layout parameters are used
1151 * to perform scaling of the surface when it is composited to the
1152 * screen. */
1153 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 /** Window flag: intended for windows that will often be used when the user is
1156 * holding the screen against their face, it will aggressively filter the event
1157 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001158 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001160 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 * until the finger is released. */
1162 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001163
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001164 /** Window flag: a special option only for use in combination with
1165 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
1166 * screen your window may appear on top of or behind screen decorations
1167 * such as the status bar. By also including this flag, the window
1168 * manager will report the inset rectangle needed to ensure your
1169 * content is not covered by screen decorations. This flag is normally
1170 * set for you by Window as described in {@link Window#setFlags}.*/
1171 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
1174 * respect to how this window interacts with the current method. That
1175 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
1176 * window will behave as if it needs to interact with the input method
1177 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
1178 * not set and this flag is set, then the window will behave as if it
1179 * doesn't need to interact with the input method and can be placed
1180 * to use more space and cover the input method.
1181 */
1182 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
1185 * can set this flag to receive a single special MotionEvent with
1186 * the action
1187 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
1188 * touches that occur outside of your window. Note that you will not
1189 * receive the full down/move/up gesture, only the location of the
1190 * first down as an ACTION_OUTSIDE.
1191 */
1192 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001193
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001194 /** Window flag: special flag to let windows be shown when the screen
1195 * is locked. This will let application windows take precedence over
1196 * key guard or any other lock screens. Can be used with
1197 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001198 * directly before showing the key guard window. Can be used with
1199 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
1200 * non-secure keyguards. This flag only applies to the top-most
1201 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -07001202 * @deprecated Use {@link android.R.attr#showWhenLocked} or
1203 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
1204 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001205 */
chaviw59b98852017-06-13 12:05:44 -07001206 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001207 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
1208
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001209 /** Window flag: ask that the system wallpaper be shown behind
1210 * your window. The window surface must be translucent to be able
1211 * to actually see the wallpaper behind it; this flag just ensures
1212 * that the wallpaper surface will be there if this window actually
1213 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001214 *
1215 * <p>This flag can be controlled in your theme through the
1216 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
1217 * is automatically set for you in the standard wallpaper themes
1218 * such as {@link android.R.style#Theme_Wallpaper},
1219 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
1220 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
1221 * {@link android.R.style#Theme_Holo_Wallpaper},
1222 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
1223 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
1224 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001225 */
1226 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001227
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001228 /** Window flag: when set as a window is being added or made
1229 * visible, once the window has been shown then the system will
1230 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -07001231 * up the device) to turn the screen on.
1232 * @deprecated Use {@link android.R.attr#turnScreenOn} or
1233 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
1234 * unintentional double life-cycle event.
1235 */
1236 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001237 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001238
Jeff Sharkey67f9d502017-08-05 13:49:13 -06001239 /**
1240 * Window flag: when set the window will cause the keyguard to be
1241 * dismissed, only if it is not a secure lock keyguard. Because such a
1242 * keyguard is not needed for security, it will never re-appear if the
1243 * user navigates to another window (in contrast to
1244 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1245 * secure and non-secure keyguards but ensure they reappear when the
1246 * user moves to another UI that doesn't hide them). If the keyguard is
1247 * currently active and is secure (requires an unlock credential) than
1248 * the user will still need to confirm it before seeing this window,
1249 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1250 *
1251 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1252 * {@link KeyguardManager#requestDismissKeyguard} instead.
1253 * Since keyguard was dismissed all the time as long as an
1254 * activity with this flag on its window was focused,
1255 * keyguard couldn't guard against unintentional touches on
1256 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001257 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001258 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001259 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001260
Jeff Brown01ce2e92010-09-26 22:20:12 -07001261 /** Window flag: when set the window will accept for touch events
1262 * outside of its bounds to be sent to other windows that also
1263 * support split touch. When this flag is not set, the first pointer
1264 * that goes down determines the window to which all subsequent touches
1265 * go until all pointers go up. When this flag is set, each pointer
1266 * (not necessarily the first) that goes down determines the window
1267 * to which all subsequent touches of that pointer will go until that
1268 * pointer goes up thereby enabling touches with multiple pointers
1269 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001270 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001271 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001272
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001273 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001274 * <p>Indicates whether this window should be hardware accelerated.
1275 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001276 *
Romain Guy72f0a272011-01-09 16:01:46 -08001277 * <p>This flag can be controlled programmatically <em>only</em> to enable
1278 * hardware acceleration. To enable hardware acceleration for a given
1279 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001280 *
Romain Guy72f0a272011-01-09 16:01:46 -08001281 * <pre>
1282 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1283 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1284 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1285 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001286 *
Romain Guy72f0a272011-01-09 16:01:46 -08001287 * <p>It is important to remember that this flag <strong>must</strong>
1288 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001289 *
Romain Guy72f0a272011-01-09 16:01:46 -08001290 * <p>This flag cannot be used to disable hardware acceleration after it
1291 * was enabled in your manifest using
1292 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1293 * and programmatically disable hardware acceleration (for automated testing
1294 * for instance), make sure it is turned off in your manifest and enable it
1295 * on your activity or dialog when you need it instead, using the method
1296 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001297 *
Romain Guy72f0a272011-01-09 16:01:46 -08001298 * <p>This flag is automatically set by the system if the
1299 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1300 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001301 */
1302 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001303
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001304 /**
1305 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001306 * overscan area, if there is one. The window should still correctly
1307 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001308 *
1309 * <p>This flag can be controlled in your theme through the
1310 * {@link android.R.attr#windowOverscan} attribute; this attribute
1311 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001312 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001313 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1314 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1315 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1316 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1317 *
1318 * <p>When this flag is enabled for a window, its normal content may be obscured
1319 * to some degree by the overscan region of the display. To ensure key parts of
1320 * that content are visible to the user, you can use
1321 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1322 * to set the point in the view hierarchy where the appropriate offsets should
1323 * be applied. (This can be done either by directly calling this function, using
1324 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1325 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1326 * View.fitSystemWindows(Rect)} method).</p>
1327 *
1328 * <p>This mechanism for positioning content elements is identical to its equivalent
1329 * use with layout and {@link View#setSystemUiVisibility(int)
1330 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1331 * position its UI elements with this overscan flag is set:</p>
1332 *
1333 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -08001334 */
1335 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1336
John Spurlockbd957402013-10-03 11:38:39 -04001337 /**
1338 * Window flag: request a translucent status bar with minimal system-provided
1339 * background protection.
1340 *
1341 * <p>This flag can be controlled in your theme through the
1342 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1343 * is automatically set for you in the standard translucent decor themes
1344 * such as
1345 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1346 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1347 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1348 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1349 *
1350 * <p>When this flag is enabled for a window, it automatically sets
1351 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1352 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
1353 */
1354 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1355
1356 /**
1357 * Window flag: request a translucent navigation bar with minimal system-provided
1358 * background protection.
1359 *
1360 * <p>This flag can be controlled in your theme through the
1361 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1362 * is automatically set for you in the standard translucent decor themes
1363 * such as
1364 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1365 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1366 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1367 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1368 *
1369 * <p>When this flag is enabled for a window, it automatically sets
1370 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1371 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
1372 */
1373 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1374
Adam Lesinski6a591f52013-10-01 18:11:17 -07001375 /**
1376 * Flag for a window in local focus mode.
1377 * Window in local focus mode can control focus independent of window manager using
1378 * {@link Window#setLocalFocus(boolean, boolean)}.
1379 * Usually window in this mode will not get touch/key events from window manager, but will
1380 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1381 */
1382 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1383
Jeff Brown98db5fa2011-06-08 15:37:10 -07001384 /** Window flag: Enable touches to slide out of a window into neighboring
1385 * windows in mid-gesture instead of being captured for the duration of
1386 * the gesture.
1387 *
1388 * This flag changes the behavior of touch focus for this window only.
1389 * Touches can slide out of the window but they cannot necessarily slide
1390 * back in (unless the other window with touch focus permits it).
1391 *
1392 * {@hide}
1393 */
Adam Lesinski6a591f52013-10-01 18:11:17 -07001394 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001395
Daniel Sandlere02d8082010-10-08 15:13:22 -04001396 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001397 * Window flag: When requesting layout with an attached window, the attached window may
1398 * overlap with the screen decorations of the parent window such as the navigation bar. By
1399 * including this flag, the window manager will layout the attached window within the decor
1400 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001401 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001402 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001403
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001404 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001405 * Flag indicating that this Window is responsible for drawing the background for the
1406 * system bars. If set, the system bars are drawn with a transparent background and the
1407 * corresponding areas in this window are filled with the colors specified in
1408 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1409 */
1410 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1411
1412 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001413 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001414 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001415 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1416 * @see #FLAG_DIM_BEHIND
1417 * @see #FLAG_NOT_FOCUSABLE
1418 * @see #FLAG_NOT_TOUCHABLE
1419 * @see #FLAG_NOT_TOUCH_MODAL
1420 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1421 * @see #FLAG_KEEP_SCREEN_ON
1422 * @see #FLAG_LAYOUT_IN_SCREEN
1423 * @see #FLAG_LAYOUT_NO_LIMITS
1424 * @see #FLAG_FULLSCREEN
1425 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001426 * @see #FLAG_SECURE
1427 * @see #FLAG_SCALED
1428 * @see #FLAG_IGNORE_CHEEK_PRESSES
1429 * @see #FLAG_LAYOUT_INSET_DECOR
1430 * @see #FLAG_ALT_FOCUSABLE_IM
1431 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1432 * @see #FLAG_SHOW_WHEN_LOCKED
1433 * @see #FLAG_SHOW_WALLPAPER
1434 * @see #FLAG_TURN_SCREEN_ON
1435 * @see #FLAG_DISMISS_KEYGUARD
1436 * @see #FLAG_SPLIT_TOUCH
1437 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001438 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001439 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001440 */
1441 @ViewDebug.ExportedProperty(flagMapping = {
1442 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001443 name = "ALLOW_LOCK_WHILE_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001444 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001445 name = "DIM_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001446 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001447 name = "BLUR_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001448 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001449 name = "NOT_FOCUSABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001450 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001451 name = "NOT_TOUCHABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001452 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001453 name = "NOT_TOUCH_MODAL"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001454 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001455 name = "TOUCHABLE_WHEN_WAKING"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001456 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001457 name = "KEEP_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001458 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001459 name = "LAYOUT_IN_SCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001460 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001461 name = "LAYOUT_NO_LIMITS"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001462 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001463 name = "FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001464 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001465 name = "FORCE_NOT_FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001466 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001467 name = "DITHER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001468 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001469 name = "SECURE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001470 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001471 name = "SCALED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001472 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001473 name = "IGNORE_CHEEK_PRESSES"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001474 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001475 name = "LAYOUT_INSET_DECOR"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001476 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001477 name = "ALT_FOCUSABLE_IM"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001478 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001479 name = "WATCH_OUTSIDE_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001480 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001481 name = "SHOW_WHEN_LOCKED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001482 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001483 name = "SHOW_WALLPAPER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001484 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001485 name = "TURN_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001486 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001487 name = "DISMISS_KEYGUARD"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001488 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001489 name = "SPLIT_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001490 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001491 name = "HARDWARE_ACCELERATED"),
1492 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN,
1493 name = "LOCAL_FOCUS_MODE"),
John Spurlockbd957402013-10-03 11:38:39 -04001494 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001495 name = "TRANSLUCENT_STATUS"),
John Spurlockbd957402013-10-03 11:38:39 -04001496 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001497 name = "TRANSLUCENT_NAVIGATION"),
1498 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
1499 name = "LOCAL_FOCUS_MODE"),
1500 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY,
1501 name = "FLAG_SLIPPERY"),
1502 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR,
1503 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"),
Adrian Roos217ccd22014-05-09 14:29:04 +02001504 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001505 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001506 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001507 public int flags;
1508
1509 /**
John Reck61375a82014-09-18 19:27:48 +00001510 * If the window has requested hardware acceleration, but this is not
1511 * allowed in the process it is in, then still render it as if it is
1512 * hardware accelerated. This is used for the starting preview windows
1513 * in the system process, which don't need to have the overhead of
1514 * hardware acceleration (they are just a static rendering), but should
1515 * be rendered as such to match the actual window of the app even if it
1516 * is hardware accelerated.
1517 * Even if the window isn't hardware accelerated, still do its rendering
1518 * as if it was.
1519 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1520 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001521 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001522 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1523 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001524 *
John Reck61375a82014-09-18 19:27:48 +00001525 * @hide
1526 */
1527 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1528
1529 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001530 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001531 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001532 * If certain parts of the UI that really do want to use hardware
1533 * acceleration, this flag can be set to force it. This is basically
1534 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001535 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001536 * @hide
1537 */
1538 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1539
1540 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001541 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001542 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001543 * them (they do not affect the wallpaper scrolling operation) by calling
1544 * {@link
1545 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1546 *
1547 * @hide
1548 */
1549 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1550
Craig Mautner88400d32012-09-30 12:35:45 -07001551 /** In a multiuser system if this flag is set and the owner is a system process then this
1552 * window will appear on all user screens. This overrides the default behavior of window
1553 * types that normally only appear on the owning user's screen. Refer to each window type
1554 * to determine its default behavior.
1555 *
1556 * {@hide} */
1557 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1558
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001559 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001560 * Never animate position changes of the window.
1561 *
Robert Carrb48380a2017-04-04 14:56:37 -07001562 * {@hide}
1563 */
1564 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001565 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1566
Adam Lesinski6a591f52013-10-01 18:11:17 -07001567 /** Window flag: special flag to limit the size of the window to be
1568 * original size ([320x480] x density). Used to create window for applications
1569 * running under compatibility mode.
1570 *
1571 * {@hide} */
1572 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1573
1574 /** Window flag: a special option intended for system dialogs. When
1575 * this flag is set, the window will demand focus unconditionally when
1576 * it is created.
1577 * {@hide} */
1578 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1579
John Spurlock3f7cd512013-10-07 12:25:09 -04001580 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001581 * becomes top-most.
1582 * {@hide} */
1583 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1584
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001585 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001586 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1587 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1588 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1589 * {@hide}
1590 */
1591 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1592
1593 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001594 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1595 *
1596 * {@hide}
1597 */
1598 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1599
1600 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001601 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1602 * this flag is set it will be shown again and the bar will have a transparent background.
1603 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1604 *
1605 * {@hide}
1606 */
1607 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1608
1609 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001610 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001611 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001612 * because they are being managed externally through repositionChild.
1613 *
1614 * {@hide}
1615 */
1616 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1617
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001618 /**
1619 * Flag that will make window ignore app visibility and instead depend purely on the decor
1620 * view visibility for determining window visibility. This is used by recents to keep
1621 * drawing after it launches an app.
1622 * @hide
1623 */
1624 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1625
Robert Carra1eb4392015-12-10 12:43:51 -08001626 /**
1627 * Flag to indicate that this window is not expected to be replaced across
1628 * configuration change triggered activity relaunches. In general the WindowManager
1629 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1630 * until the replacement is ready to show in order to prevent visual glitch. However
1631 * some windows, such as PopupWindows expect to be cleared across configuration change,
1632 * and thus should hint to the WindowManager that it should not wait for a replacement.
1633 * @hide
1634 */
1635 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001636
1637 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001638 * Flag to indicate that this child window should always be laid-out in the parent
1639 * frame regardless of the current windowing mode configuration.
1640 * @hide
1641 */
1642 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1643
1644 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001645 * Flag to indicate that this window is always drawing the status bar background, no matter
1646 * what the other flags are.
1647 * @hide
1648 */
1649 public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000;
1650
1651 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001652 * Flag to indicate that this window needs Sustained Performance Mode if
1653 * the device supports it.
1654 * @hide
1655 */
John Reck60e885f2016-04-21 15:40:45 -07001656 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001657
1658 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001659 * Flag to indicate that any window added by an application process that is of type
1660 * {@link #TYPE_TOAST} or that requires
1661 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1662 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001663 * @hide
1664 */
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001665 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001666 public static final int PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001667
1668 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001669 * Indicates that this window is the rounded corners overlay present on some
1670 * devices this means that it will be excluded from: screenshots,
1671 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001672 * @hide
1673 */
Robert Carr132c9f52017-07-31 17:02:30 -07001674 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001675
1676 /**
Jorim Jaggif12ec0f2017-08-23 16:14:10 +02001677 * If this flag is set on the window, window manager will acquire a sleep token that puts
1678 * all activities to sleep as long as this window is visible. When this flag is set, the
1679 * window needs to occlude all activity windows.
1680 * @hide
1681 */
1682 @RequiresPermission(permission.DEVICE_POWER)
1683 public static final int PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN = 0x00200000;
1684
1685 /**
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001686 * Flag to indicate that this window should be considered a screen decoration similar to the
1687 * nav bar and status bar. This will cause this window to affect the window insets reported
1688 * to other windows when it is visible.
1689 * @hide
1690 */
1691 @RequiresPermission(permission.STATUS_BAR_SERVICE)
1692 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
1693
1694 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001695 * Control flags that are private to the platform.
1696 * @hide
1697 */
Jorim Jaggi484851b2017-09-22 16:03:27 +02001698 @ViewDebug.ExportedProperty(flagMapping = {
1699 @ViewDebug.FlagToString(
1700 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1701 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1702 name = "FAKE_HARDWARE_ACCELERATED"),
1703 @ViewDebug.FlagToString(
1704 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1705 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1706 name = "FORCE_HARDWARE_ACCELERATED"),
1707 @ViewDebug.FlagToString(
1708 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1709 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1710 name = "WANTS_OFFSET_NOTIFICATIONS"),
1711 @ViewDebug.FlagToString(
1712 mask = PRIVATE_FLAG_SHOW_FOR_ALL_USERS,
1713 equals = PRIVATE_FLAG_SHOW_FOR_ALL_USERS,
1714 name = "SHOW_FOR_ALL_USERS"),
1715 @ViewDebug.FlagToString(
1716 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1717 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1718 name = "NO_MOVE_ANIMATION"),
1719 @ViewDebug.FlagToString(
1720 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1721 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1722 name = "COMPATIBLE_WINDOW"),
1723 @ViewDebug.FlagToString(
1724 mask = PRIVATE_FLAG_SYSTEM_ERROR,
1725 equals = PRIVATE_FLAG_SYSTEM_ERROR,
1726 name = "SYSTEM_ERROR"),
1727 @ViewDebug.FlagToString(
1728 mask = PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR,
1729 equals = PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR,
1730 name = "INHERIT_TRANSLUCENT_DECOR"),
1731 @ViewDebug.FlagToString(
1732 mask = PRIVATE_FLAG_KEYGUARD,
1733 equals = PRIVATE_FLAG_KEYGUARD,
1734 name = "KEYGUARD"),
1735 @ViewDebug.FlagToString(
1736 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1737 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1738 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"),
1739 @ViewDebug.FlagToString(
1740 mask = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1741 equals = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1742 name = "FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"),
1743 @ViewDebug.FlagToString(
1744 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1745 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1746 name = "PRESERVE_GEOMETRY"),
1747 @ViewDebug.FlagToString(
1748 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1749 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1750 name = "FORCE_DECOR_VIEW_VISIBILITY"),
1751 @ViewDebug.FlagToString(
1752 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1753 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1754 name = "WILL_NOT_REPLACE_ON_RELAUNCH"),
1755 @ViewDebug.FlagToString(
1756 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1757 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1758 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
1759 @ViewDebug.FlagToString(
1760 mask = PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND,
1761 equals = PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND,
1762 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
1763 @ViewDebug.FlagToString(
1764 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1765 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1766 name = "SUSTAINED_PERFORMANCE_MODE"),
1767 @ViewDebug.FlagToString(
1768 mask = PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1769 equals = PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1770 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"),
1771 @ViewDebug.FlagToString(
1772 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1773 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1774 name = "IS_ROUNDED_CORNERS_OVERLAY"),
1775 @ViewDebug.FlagToString(
1776 mask = PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN,
1777 equals = PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN,
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001778 name = "ACQUIRES_SLEEP_TOKEN"),
1779 @ViewDebug.FlagToString(
1780 mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
1781 equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
1782 name = "IS_SCREEN_DECOR")
Jorim Jaggi484851b2017-09-22 16:03:27 +02001783 })
Robert Carrb48380a2017-04-04 14:56:37 -07001784 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001785 public int privateFlags;
1786
1787 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001788 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1789 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1790 * key. For this case, we should look at windows behind it to determine the appropriate
1791 * value.
1792 *
1793 * @hide
1794 */
1795 public static final int NEEDS_MENU_UNSET = 0;
1796
1797 /**
1798 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1799 * menu key.
1800 *
1801 * @hide
1802 */
1803 public static final int NEEDS_MENU_SET_TRUE = 1;
1804
1805 /**
1806 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1807 * needs a menu key.
1808 *
1809 * @hide
1810 */
1811 public static final int NEEDS_MENU_SET_FALSE = 2;
1812
1813 /**
1814 * State variable for a window belonging to an activity that responds to
1815 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1816 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1817 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1818 *
1819 * (Note that Action Bars, when available, are the preferred way to offer additional
1820 * functions otherwise accessed via an options menu.)
1821 *
1822 * {@hide}
1823 */
1824 public int needsMenuKey = NEEDS_MENU_UNSET;
1825
1826 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001827 * Given a particular set of window manager flags, determine whether
1828 * such a window may be a target for an input method when it has
1829 * focus. In particular, this checks the
1830 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1831 * flags and returns true if the combination of the two corresponds
1832 * to a window that needs to be behind the input method so that the
1833 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001834 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001835 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001836 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001837 * @return Returns true if such a window should be behind/interact
1838 * with an input method, false if not.
1839 */
1840 public static boolean mayUseInputMethod(int flags) {
1841 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1842 case 0:
1843 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1844 return true;
1845 }
1846 return false;
1847 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001848
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001849 /**
1850 * Mask for {@link #softInputMode} of the bits that determine the
1851 * desired visibility state of the soft input area for this window.
1852 */
1853 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001855 /**
Yohei Yukawaa7547852018-03-27 15:47:45 -07001856 * Visibility state for {@link #softInputMode}: no state has been specified. The system may
1857 * show or hide the software keyboard for better user experience when the window gains
1858 * focus.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001859 */
1860 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001861
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001862 /**
1863 * Visibility state for {@link #softInputMode}: please don't change the state of
1864 * the soft input area.
1865 */
1866 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001867
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001868 /**
1869 * Visibility state for {@link #softInputMode}: please hide any soft input
1870 * area when normally appropriate (when the user is navigating
1871 * forward to your window).
1872 */
1873 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001874
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001875 /**
1876 * Visibility state for {@link #softInputMode}: please always hide any
1877 * soft input area when this window receives focus.
1878 */
1879 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001880
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001881 /**
1882 * Visibility state for {@link #softInputMode}: please show the soft
1883 * input area when normally appropriate (when the user is navigating
1884 * forward to your window).
Yohei Yukawacf68d522017-12-12 09:33:26 -08001885 *
1886 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
1887 * is ignored unless there is a focused view that returns {@code true} from
1888 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001889 */
1890 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001892 /**
1893 * Visibility state for {@link #softInputMode}: please always make the
1894 * soft input area visible when this window receives input focus.
Yohei Yukawacf68d522017-12-12 09:33:26 -08001895 *
1896 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
1897 * is ignored unless there is a focused view that returns {@code true} from
1898 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001899 */
1900 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001902 /**
1903 * Mask for {@link #softInputMode} of the bits that determine the
1904 * way that the window should be adjusted to accommodate the soft
1905 * input window.
1906 */
1907 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001908
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001909 /** Adjustment option for {@link #softInputMode}: nothing specified.
1910 * The system will try to pick one or
1911 * the other depending on the contents of the window.
1912 */
1913 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001914
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001915 /** Adjustment option for {@link #softInputMode}: set to allow the
1916 * window to be resized when an input
1917 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001918 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001919 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1920 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001921 * the other depending on the contents of the window. If the window's
1922 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1923 * value for {@link #softInputMode} will be ignored; the window will
1924 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001925 */
1926 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001927
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001928 /** Adjustment option for {@link #softInputMode}: set to have a window
1929 * pan when an input method is
1930 * shown, so it doesn't need to deal with resizing but just panned
1931 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001932 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001933 * neither of these are set, then the system will try to pick one or
1934 * the other depending on the contents of the window.
1935 */
1936 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001937
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001938 /** Adjustment option for {@link #softInputMode}: set to have a window
1939 * not adjust for a shown input method. The window will not be resized,
1940 * and it will not be panned to make its focus visible.
1941 */
1942 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1943
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001944 /**
1945 * Bit for {@link #softInputMode}: set when the user has navigated
1946 * forward to the window. This is normally set automatically for
1947 * you by the system, though you may want to set it in certain cases
1948 * when you are displaying a window yourself. This flag will always
1949 * be cleared automatically after the window is displayed.
1950 */
1951 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001952
1953 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001954 * An internal annotation for flags that can be specified to {@link #softInputMode}.
1955 *
1956 * @hide
1957 */
1958 @Retention(RetentionPolicy.SOURCE)
Jeff Sharkeyce8db992017-12-13 20:05:05 -07001959 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = {
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001960 SOFT_INPUT_STATE_UNSPECIFIED,
1961 SOFT_INPUT_STATE_UNCHANGED,
1962 SOFT_INPUT_STATE_HIDDEN,
1963 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
1964 SOFT_INPUT_STATE_VISIBLE,
1965 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
1966 SOFT_INPUT_ADJUST_UNSPECIFIED,
1967 SOFT_INPUT_ADJUST_RESIZE,
1968 SOFT_INPUT_ADJUST_PAN,
1969 SOFT_INPUT_ADJUST_NOTHING,
1970 SOFT_INPUT_IS_FORWARD_NAVIGATION,
1971 })
1972 public @interface SoftInputModeFlags {}
1973
1974 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001975 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001976 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001977 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001978 * <ul>
1979 * <li> One of the visibility states
1980 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001981 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
1982 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001983 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001984 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
1985 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001986 * </ul>
1987 *
1988 *
1989 * <p>This flag can be controlled in your theme through the
1990 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001991 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001992 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001993 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001994
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001995 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001996 * Placement of window within the screen as per {@link Gravity}. Both
1997 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1998 * android.graphics.Rect) Gravity.apply} and
1999 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2000 * Gravity.applyDisplay} are used during window layout, with this value
2001 * given as the desired gravity. For example you can specify
2002 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
2003 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
2004 * to control the behavior of
2005 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2006 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002007 *
2008 * @see Gravity
2009 */
2010 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002011
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002012 /**
2013 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002014 * between the container and the widget. See
2015 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2016 * android.graphics.Rect) Gravity.apply} for how this is used. This
2017 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002018 */
2019 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002020
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002021 /**
2022 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002023 * between the container and the widget. See
2024 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2025 * android.graphics.Rect) Gravity.apply} for how this is used. This
2026 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002027 */
2028 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002029
2030 /**
2031 * Positive insets between the drawing surface and window content.
2032 *
2033 * @hide
2034 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07002035 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08002036
2037 /**
2038 * Whether the surface insets have been manually set. When set to
2039 * {@code false}, the view root will automatically determine the
2040 * appropriate surface insets.
2041 *
2042 * @see #surfaceInsets
2043 * @hide
2044 */
2045 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002047 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07002048 * Whether the previous surface insets should be used vs. what is currently set. When set
2049 * to {@code true}, the view root will ignore surfaces insets in this object and use what
2050 * it currently has.
2051 *
2052 * @see #surfaceInsets
2053 * @hide
2054 */
2055 public boolean preservePreviousSurfaceInsets = true;
2056
2057 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002058 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08002059 * {@link android.graphics.PixelFormat}. The choice of format
2060 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002061 */
2062 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002063
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002064 /**
2065 * A style resource defining the animations to use for this window.
2066 * This must be a system resource; it can not be an application resource
2067 * because the window manager does not have access to applications.
2068 */
2069 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002070
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002071 /**
2072 * An alpha value to apply to this entire window.
2073 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
2074 */
2075 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002077 /**
2078 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
2079 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
2080 * dim.
2081 */
2082 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002083
2084 /**
2085 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
2086 * indicating that the brightness value is not overridden for this window
2087 * and normal brightness policy should be used.
2088 */
2089 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
2090
2091 /**
2092 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2093 * indicating that the screen or button backlight brightness should be set
2094 * to the lowest value when this window is in front.
2095 */
2096 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
2097
2098 /**
2099 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2100 * indicating that the screen or button backlight brightness should be set
2101 * to the hightest value when this window is in front.
2102 */
2103 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002104
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002105 /**
2106 * This can be used to override the user's preferred brightness of
2107 * the screen. A value of less than 0, the default, means to use the
2108 * preferred screen brightness. 0 to 1 adjusts the brightness from
2109 * dark to full bright.
2110 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002111 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002112
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002113 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002114 * This can be used to override the standard behavior of the button and
2115 * keyboard backlights. A value of less than 0, the default, means to
2116 * use the standard backlight behavior. 0 to 1 adjusts the brightness
2117 * from dark to full bright.
2118 */
2119 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
2120
2121 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07002122 * Unspecified value for {@link #rotationAnimation} indicating
2123 * a lack of preference.
2124 * @hide
2125 */
2126 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
2127
2128 /**
Robert Carr652aae42016-10-17 16:48:14 -07002129 * Value for {@link #rotationAnimation} which specifies that this
2130 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002131 */
2132 public static final int ROTATION_ANIMATION_ROTATE = 0;
2133
2134 /**
Robert Carr652aae42016-10-17 16:48:14 -07002135 * Value for {@link #rotationAnimation} which specifies that this
2136 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002137 */
2138 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
2139
2140 /**
Robert Carr652aae42016-10-17 16:48:14 -07002141 * Value for {@link #rotationAnimation} which specifies that this window
2142 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002143 */
2144 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
2145
2146 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07002147 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
2148 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07002149 * can't be applied without pausing the screen. For example, this is ideal
2150 * for Camera apps which don't want the viewfinder contents to ever rotate
2151 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
2152 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07002153 */
2154 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
2155
2156 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002157 * Define the exit and entry animations used on this window when the device is rotated.
2158 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08002159 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002160 * by other windows. All other situations default to the
2161 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002162 *
Craig Mautner3c174372013-02-21 17:54:37 -08002163 * @see #ROTATION_ANIMATION_ROTATE
2164 * @see #ROTATION_ANIMATION_CROSSFADE
2165 * @see #ROTATION_ANIMATION_JUMPCUT
2166 */
2167 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
2168
2169 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 * Identifier for this window. This will usually be filled in for
2171 * you.
2172 */
2173 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002175 /**
2176 * Name of the package owning this window.
2177 */
2178 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002180 /**
2181 * Specific orientation value for a window.
2182 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002183 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
2184 * If not set, a default value of
2185 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002186 * will be used.
2187 */
2188 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08002189
2190 /**
Michael Wright3f145a22014-07-22 19:46:03 -07002191 * The preferred refresh rate for the window.
2192 *
2193 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002194 * is on. The selected refresh rate will be applied to the display's default mode.
2195 *
2196 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07002197 *
2198 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002199 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07002200 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002201 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07002202 public float preferredRefreshRate;
2203
2204 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002205 * Id of the preferred display mode for the window.
2206 * <p>
2207 * This must be one of the supported modes obtained for the display(s) the window is on.
2208 * A value of {@code 0} means no preference.
2209 *
2210 * @see Display#getSupportedModes()
2211 * @see Display.Mode#getModeId()
2212 */
2213 public int preferredDisplayModeId;
2214
2215 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002216 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08002217 *
2218 * @see View#STATUS_BAR_VISIBLE
2219 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08002220 */
2221 public int systemUiVisibility;
2222
2223 /**
Joe Onorato14782f72011-01-25 19:53:17 -08002224 * @hide
2225 * The ui visibility as requested by the views in this hierarchy.
2226 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
2227 */
2228 public int subtreeSystemUiVisibility;
2229
2230 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002231 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002232 *
Joe Onorato664644d2011-01-23 17:53:23 -08002233 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
2234 *
2235 * @hide
2236 */
2237 public boolean hasSystemUiListeners;
2238
Adrian Roosfa02da62018-01-15 16:01:18 +01002239
2240 /** @hide */
2241 @Retention(RetentionPolicy.SOURCE)
2242 @IntDef(
2243 flag = true,
2244 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
Adrian Roos87526af2018-03-27 16:36:25 +02002245 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
Adrian Roosfa02da62018-01-15 16:01:18 +01002246 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER})
2247 @interface LayoutInDisplayCutoutMode {}
2248
2249 /**
2250 * Controls how the window is laid out if there is a {@link DisplayCutout}.
2251 *
2252 * <p>
2253 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}.
2254 *
2255 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
Adrian Roos87526af2018-03-27 16:36:25 +02002256 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Adrian Roosfa02da62018-01-15 16:01:18 +01002257 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
2258 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002259 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2260 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002261 */
2262 @LayoutInDisplayCutoutMode
2263 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
2264
2265 /**
2266 * The window is allowed to extend into the {@link DisplayCutout} area, only if the
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002267 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is
Adrian Roosfa02da62018-01-15 16:01:18 +01002268 * laid out such that it does not overlap with the {@link DisplayCutout} area.
2269 *
2270 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002271 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or
2272 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait
2273 * if the cutout is at the top edge. Similarly for
2274 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen.
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002275 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the
Adrian Roosfa02da62018-01-15 16:01:18 +01002276 * cutout area.
2277 *
2278 * <p>
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002279 * The usual precautions for not overlapping with the status and navigation bar are
2280 * sufficient for ensuring that no important content overlaps with the DisplayCutout.
Adrian Roosfa02da62018-01-15 16:01:18 +01002281 *
2282 * @see DisplayCutout
2283 * @see WindowInsets
Adrian Roos87526af2018-03-27 16:36:25 +02002284 * @see #layoutInDisplayCutoutMode
2285 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2286 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002287 */
2288 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;
2289
2290 /**
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002291 * @deprecated use {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES}
2292 * @hide
2293 */
2294 @Deprecated
2295 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 1;
2296
2297 /**
2298 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
2299 * edges of the screen.
2300 *
2301 * The window will never extend into a {@link DisplayCutout} area on the long edges of the
2302 * screen.
Adrian Roosfa02da62018-01-15 16:01:18 +01002303 *
2304 * <p>
2305 * The window must make sure that no important content overlaps with the
2306 * {@link DisplayCutout}.
2307 *
Adrian Roosad1da312018-03-27 19:17:50 +02002308 * <p>
2309 * In this mode, the window extends under cutouts on the short edge of the display in both
2310 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/>
2311 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png"
2312 * height="720"
2313 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in
2314 * portrait, no letterbox is applied."/>
2315 *
2316 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png"
2317 * width="720"
2318 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape,
2319 * no letterbox is applied."/>
2320 *
2321 * <p>
2322 * A cutout in the corner is considered to be on the short edge: <br/>
2323 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png"
2324 * height="720"
2325 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in
2326 * portrait, no letterbox is applied."/>
2327 *
2328 * <p>
2329 * On the other hand, should the cutout be on the long edge of the display, a letterbox will
2330 * be applied such that the window does not extend into the cutout on either long edge:
2331 * <br/>
2332 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png"
2333 * height="720"
2334 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait,
2335 * letterbox is applied."/>
2336 *
Adrian Roosfa02da62018-01-15 16:01:18 +01002337 * @see DisplayCutout
2338 * @see WindowInsets#getDisplayCutout()
Adrian Roos87526af2018-03-27 16:36:25 +02002339 * @see #layoutInDisplayCutoutMode
2340 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2341 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002342 */
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002343 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1;
Adrian Roosfa02da62018-01-15 16:01:18 +01002344
2345 /**
2346 * The window is never allowed to overlap with the DisplayCutout area.
2347 *
2348 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002349 * This should be used with windows that transiently set
2350 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION}
2351 * to avoid a relayout of the window when the respective flag is set or cleared.
Adrian Roosfa02da62018-01-15 16:01:18 +01002352 *
2353 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002354 * @see #layoutInDisplayCutoutMode
2355 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2356 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002357 */
2358 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;
2359
2360
Jeff Brown474dcb52011-06-14 20:22:50 -07002361 /**
2362 * When this window has focus, disable touch pad pointer gesture processing.
2363 * The window will receive raw position updates from the touch pad instead
2364 * of pointer movements and synthetic touch events.
2365 *
2366 * @hide
2367 */
2368 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
2369
2370 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07002371 * Does not construct an input channel for this window. The channel will therefore
2372 * be incapable of receiving input.
2373 *
2374 * @hide
2375 */
2376 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
2377
2378 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002379 * When this window has focus, does not call user activity for all input events so
2380 * the application will have to do it itself. Should only be used by
2381 * the keyguard and phone app.
2382 * <p>
2383 * Should only be used by the keyguard and phone app.
2384 * </p>
2385 *
2386 * @hide
2387 */
2388 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
2389
2390 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07002391 * Control special features of the input subsystem.
2392 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002393 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07002394 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002395 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07002396 * @hide
2397 */
2398 public int inputFeatures;
2399
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002400 /**
2401 * Sets the number of milliseconds before the user activity timeout occurs
2402 * when this window has focus. A value of -1 uses the standard timeout.
2403 * A value of 0 uses the minimum support display timeout.
2404 * <p>
2405 * This property can only be used to reduce the user specified display timeout;
2406 * it can never make the timeout longer than it normally would be.
2407 * </p><p>
2408 * Should only be used by the keyguard and phone app.
2409 * </p>
2410 *
2411 * @hide
2412 */
2413 public long userActivityTimeout = -1;
2414
Phil Weaver396d5492016-03-22 17:53:50 -07002415 /**
2416 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
2417 * window.
2418 *
2419 * @hide
2420 */
Phil Weaver8583ae82018-02-13 11:01:24 -08002421 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
Phil Weaver396d5492016-03-22 17:53:50 -07002422
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002423 /**
2424 * The window title isn't kept in sync with what is displayed in the title bar, so we
2425 * separately track the currently shown title to provide to accessibility.
2426 *
2427 * @hide
2428 */
Alan Viverette39259dd2017-05-25 11:10:46 -04002429 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002430 public CharSequence accessibilityTitle;
2431
Robert Carr70f0d222016-04-10 16:33:08 -07002432 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002433 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07002434 * by the window manager. Useful for transient notifications like toasts
2435 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002436 * is hidden. Must be specified at window creation time. Note that apps
2437 * are not prepared to handle their windows being removed without their
2438 * explicit request and may try to interact with the removed window
2439 * resulting in undefined behavior and crashes. Therefore, we do hide
2440 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07002441 *
2442 * @hide
2443 */
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002444 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07002445
Romain Guy48327452017-01-23 17:03:35 -08002446 /**
2447 * The color mode requested by this window. The target display may
2448 * not be able to honor the request. When the color mode is not set
2449 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
2450 * pixel format specified in {@link #format}.
2451 *
2452 * @hide
2453 */
2454 @ActivityInfo.ColorMode
Jorim Jaggi484851b2017-09-22 16:03:27 +02002455 private int mColorMode = COLOR_MODE_DEFAULT;
Romain Guy48327452017-01-23 17:03:35 -08002456
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08002458 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002459 type = TYPE_APPLICATION;
2460 format = PixelFormat.OPAQUE;
2461 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002463 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08002464 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002465 type = _type;
2466 format = PixelFormat.OPAQUE;
2467 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002468
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002469 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08002470 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002471 type = _type;
2472 flags = _flags;
2473 format = PixelFormat.OPAQUE;
2474 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002475
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002476 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002477 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 type = _type;
2479 flags = _flags;
2480 format = _format;
2481 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002483 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2484 super(w, h);
2485 type = _type;
2486 flags = _flags;
2487 format = _format;
2488 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002489
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002490 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2491 int _flags, int _format) {
2492 super(w, h);
2493 x = xpos;
2494 y = ypos;
2495 type = _type;
2496 flags = _flags;
2497 format = _format;
2498 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 public final void setTitle(CharSequence title) {
2501 if (null == title)
2502 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002504 mTitle = TextUtils.stringOrSpannedString(title);
2505 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002506
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002507 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002508 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002509 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002510
Wale Ogunwale246c2092016-04-07 14:12:44 -07002511 /**
2512 * Sets the surface insets based on the elevation (visual z position) of the input view.
2513 * @hide
2514 */
2515 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
2516 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07002517 // Partial workaround for b/28318973. Every inset change causes a freeform window
2518 // to jump a little for a few frames. If we never allow surface insets to decrease,
2519 // they will stabilize quickly (often from the very beginning, as most windows start
2520 // as focused).
2521 // TODO(b/22668382) to fix this properly.
2522 if (surfaceInset == 0) {
2523 // OK to have 0 (this is the case for non-freeform windows).
2524 surfaceInsets.set(0, 0, 0, 0);
2525 } else {
2526 surfaceInsets.set(
2527 Math.max(surfaceInset, surfaceInsets.left),
2528 Math.max(surfaceInset, surfaceInsets.top),
2529 Math.max(surfaceInset, surfaceInsets.right),
2530 Math.max(surfaceInset, surfaceInsets.bottom));
2531 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002532 hasManualSurfaceInsets = manual;
2533 preservePreviousSurfaceInsets = preservePrevious;
2534 }
2535
Romain Guy48327452017-01-23 17:03:35 -08002536 /**
2537 * <p>Set the color mode of the window. Setting the color mode might
2538 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
2539 *
2540 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2541 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
2542 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
2543 *
2544 * @see #getColorMode()
2545 */
2546 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
2547 mColorMode = colorMode;
2548 }
2549
2550 /**
2551 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2552 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
2553 *
2554 * @see #setColorMode(int)
2555 */
2556 @ActivityInfo.ColorMode
2557 public int getColorMode() {
2558 return mColorMode;
2559 }
2560
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002561 /** @hide */
2562 @SystemApi
2563 public final void setUserActivityTimeout(long timeout) {
2564 userActivityTimeout = timeout;
2565 }
2566
2567 /** @hide */
2568 @SystemApi
2569 public final long getUserActivityTimeout() {
2570 return userActivityTimeout;
2571 }
2572
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002573 public int describeContents() {
2574 return 0;
2575 }
2576
2577 public void writeToParcel(Parcel out, int parcelableFlags) {
2578 out.writeInt(width);
2579 out.writeInt(height);
2580 out.writeInt(x);
2581 out.writeInt(y);
2582 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002584 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 out.writeInt(softInputMode);
Adrian Roosfa02da62018-01-15 16:01:18 +01002586 out.writeInt(layoutInDisplayCutoutMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002587 out.writeInt(gravity);
2588 out.writeFloat(horizontalMargin);
2589 out.writeFloat(verticalMargin);
2590 out.writeInt(format);
2591 out.writeInt(windowAnimations);
2592 out.writeFloat(alpha);
2593 out.writeFloat(dimAmount);
2594 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002595 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08002596 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597 out.writeStrongBinder(token);
2598 out.writeString(packageName);
2599 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
2600 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07002601 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002602 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08002603 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08002604 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08002605 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07002606 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002607 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07002608 out.writeInt(surfaceInsets.left);
2609 out.writeInt(surfaceInsets.top);
2610 out.writeInt(surfaceInsets.right);
2611 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08002612 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07002613 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002614 out.writeInt(needsMenuKey);
Phil Weaver8583ae82018-02-13 11:01:24 -08002615 out.writeLong(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002616 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07002617 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002618 out.writeLong(hideTimeoutMilliseconds);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002619 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002620
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002621 public static final Parcelable.Creator<LayoutParams> CREATOR
2622 = new Parcelable.Creator<LayoutParams>() {
2623 public LayoutParams createFromParcel(Parcel in) {
2624 return new LayoutParams(in);
2625 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002626
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002627 public LayoutParams[] newArray(int size) {
2628 return new LayoutParams[size];
2629 }
2630 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002631
2632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002633 public LayoutParams(Parcel in) {
2634 width = in.readInt();
2635 height = in.readInt();
2636 x = in.readInt();
2637 y = in.readInt();
2638 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002640 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002641 softInputMode = in.readInt();
Adrian Roosfa02da62018-01-15 16:01:18 +01002642 layoutInDisplayCutoutMode = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 gravity = in.readInt();
2644 horizontalMargin = in.readFloat();
2645 verticalMargin = in.readFloat();
2646 format = in.readInt();
2647 windowAnimations = in.readInt();
2648 alpha = in.readFloat();
2649 dimAmount = in.readFloat();
2650 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002651 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08002652 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002653 token = in.readStrongBinder();
2654 packageName = in.readString();
2655 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
2656 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07002657 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002658 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002659 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08002660 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002661 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07002662 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002663 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07002664 surfaceInsets.left = in.readInt();
2665 surfaceInsets.top = in.readInt();
2666 surfaceInsets.right = in.readInt();
2667 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08002668 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07002669 preservePreviousSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002670 needsMenuKey = in.readInt();
Phil Weaver8583ae82018-02-13 11:01:24 -08002671 accessibilityIdOfAnchor = in.readLong();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002672 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07002673 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002674 hideTimeoutMilliseconds = in.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002675 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002676
Romain Guy72998072009-06-22 11:09:20 -07002677 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002678 public static final int LAYOUT_CHANGED = 1<<0;
2679 public static final int TYPE_CHANGED = 1<<1;
2680 public static final int FLAGS_CHANGED = 1<<2;
2681 public static final int FORMAT_CHANGED = 1<<3;
2682 public static final int ANIMATION_CHANGED = 1<<4;
2683 public static final int DIM_AMOUNT_CHANGED = 1<<5;
2684 public static final int TITLE_CHANGED = 1<<6;
2685 public static final int ALPHA_CHANGED = 1<<7;
2686 public static final int MEMORY_TYPE_CHANGED = 1<<8;
2687 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
2688 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
2689 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08002690 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002691 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002692 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08002693 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002694 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08002695 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002696 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07002697 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002698 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002699 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002700 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07002701 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002702 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002703 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04002704 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
2705 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07002706 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002707 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07002708 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
2709 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002710 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
2711 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002712 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
2713 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07002714 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
2715 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04002716 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002717 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
2718 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07002719 public static final int COLOR_MODE_CHANGED = 1 << 26;
2720 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07002721 public static final int EVERYTHING_CHANGED = 0xffffffff;
2722
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002723 // internal buffer to backup/restore parameters under compatibility mode.
2724 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002725
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002726 public final int copyFrom(LayoutParams o) {
2727 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 if (width != o.width) {
2730 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07002731 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002732 }
2733 if (height != o.height) {
2734 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07002735 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 }
2737 if (x != o.x) {
2738 x = o.x;
2739 changes |= LAYOUT_CHANGED;
2740 }
2741 if (y != o.y) {
2742 y = o.y;
2743 changes |= LAYOUT_CHANGED;
2744 }
2745 if (horizontalWeight != o.horizontalWeight) {
2746 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002747 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002748 }
2749 if (verticalWeight != o.verticalWeight) {
2750 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002751 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 }
2753 if (horizontalMargin != o.horizontalMargin) {
2754 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002755 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002756 }
2757 if (verticalMargin != o.verticalMargin) {
2758 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002759 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002760 }
2761 if (type != o.type) {
2762 type = o.type;
2763 changes |= TYPE_CHANGED;
2764 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04002766 final int diff = flags ^ o.flags;
2767 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
2768 changes |= TRANSLUCENT_FLAGS_CHANGED;
2769 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07002771 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002772 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002773 if (privateFlags != o.privateFlags) {
2774 privateFlags = o.privateFlags;
2775 changes |= PRIVATE_FLAGS_CHANGED;
2776 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002777 if (softInputMode != o.softInputMode) {
2778 softInputMode = o.softInputMode;
2779 changes |= SOFT_INPUT_MODE_CHANGED;
2780 }
Adrian Roosfa02da62018-01-15 16:01:18 +01002781 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) {
2782 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode;
2783 changes |= LAYOUT_CHANGED;
2784 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002785 if (gravity != o.gravity) {
2786 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07002787 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002788 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002789 if (format != o.format) {
2790 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07002791 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002792 }
2793 if (windowAnimations != o.windowAnimations) {
2794 windowAnimations = o.windowAnimations;
2795 changes |= ANIMATION_CHANGED;
2796 }
2797 if (token == null) {
2798 // NOTE: token only copied if the recipient doesn't
2799 // already have one.
2800 token = o.token;
2801 }
2802 if (packageName == null) {
2803 // NOTE: packageName only copied if the recipient doesn't
2804 // already have one.
2805 packageName = o.packageName;
2806 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08002807 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002808 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002809 mTitle = o.mTitle;
2810 changes |= TITLE_CHANGED;
2811 }
2812 if (alpha != o.alpha) {
2813 alpha = o.alpha;
2814 changes |= ALPHA_CHANGED;
2815 }
2816 if (dimAmount != o.dimAmount) {
2817 dimAmount = o.dimAmount;
2818 changes |= DIM_AMOUNT_CHANGED;
2819 }
2820 if (screenBrightness != o.screenBrightness) {
2821 screenBrightness = o.screenBrightness;
2822 changes |= SCREEN_BRIGHTNESS_CHANGED;
2823 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002824 if (buttonBrightness != o.buttonBrightness) {
2825 buttonBrightness = o.buttonBrightness;
2826 changes |= BUTTON_BRIGHTNESS_CHANGED;
2827 }
Craig Mautner3c174372013-02-21 17:54:37 -08002828 if (rotationAnimation != o.rotationAnimation) {
2829 rotationAnimation = o.rotationAnimation;
2830 changes |= ROTATION_ANIMATION_CHANGED;
2831 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002832
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002833 if (screenOrientation != o.screenOrientation) {
2834 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07002835 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 }
Romain Guy529b60a2010-08-03 18:05:47 -07002837
Michael Wright3f145a22014-07-22 19:46:03 -07002838 if (preferredRefreshRate != o.preferredRefreshRate) {
2839 preferredRefreshRate = o.preferredRefreshRate;
2840 changes |= PREFERRED_REFRESH_RATE_CHANGED;
2841 }
2842
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002843 if (preferredDisplayModeId != o.preferredDisplayModeId) {
2844 preferredDisplayModeId = o.preferredDisplayModeId;
2845 changes |= PREFERRED_DISPLAY_MODE_ID;
2846 }
2847
Joe Onorato14782f72011-01-25 19:53:17 -08002848 if (systemUiVisibility != o.systemUiVisibility
2849 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08002850 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08002851 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08002852 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
2853 }
2854
2855 if (hasSystemUiListeners != o.hasSystemUiListeners) {
2856 hasSystemUiListeners = o.hasSystemUiListeners;
2857 changes |= SYSTEM_UI_LISTENER_CHANGED;
2858 }
2859
Jeff Brown474dcb52011-06-14 20:22:50 -07002860 if (inputFeatures != o.inputFeatures) {
2861 inputFeatures = o.inputFeatures;
2862 changes |= INPUT_FEATURES_CHANGED;
2863 }
2864
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002865 if (userActivityTimeout != o.userActivityTimeout) {
2866 userActivityTimeout = o.userActivityTimeout;
2867 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
2868 }
2869
Alan Viverette49a22e82014-07-12 20:01:27 -07002870 if (!surfaceInsets.equals(o.surfaceInsets)) {
2871 surfaceInsets.set(o.surfaceInsets);
2872 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002873 }
2874
Alan Viverette5435a302015-01-29 10:25:34 -08002875 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
2876 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
2877 changes |= SURFACE_INSETS_CHANGED;
2878 }
2879
Wale Ogunwale246c2092016-04-07 14:12:44 -07002880 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
2881 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
2882 changes |= SURFACE_INSETS_CHANGED;
2883 }
2884
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002885 if (needsMenuKey != o.needsMenuKey) {
2886 needsMenuKey = o.needsMenuKey;
2887 changes |= NEEDS_MENU_KEY_CHANGED;
2888 }
2889
Phil Weaver396d5492016-03-22 17:53:50 -07002890 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
2891 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
2892 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
2893 }
2894
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002895 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
2896 && o.accessibilityTitle != null) {
2897 // NOTE: accessibilityTitle only copied if the originator set one.
2898 accessibilityTitle = o.accessibilityTitle;
2899 changes |= ACCESSIBILITY_TITLE_CHANGED;
2900 }
2901
Romain Guy26a2b972017-04-17 09:39:51 -07002902 if (mColorMode != o.mColorMode) {
2903 mColorMode = o.mColorMode;
2904 changes |= COLOR_MODE_CHANGED;
2905 }
2906
Robert Carr70f0d222016-04-10 16:33:08 -07002907 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002908 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07002909
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 return changes;
2911 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002913 @Override
2914 public String debug(String output) {
2915 output += "Contents of " + this + ":";
2916 Log.d("Debug", output);
2917 output = super.debug("");
2918 Log.d("Debug", output);
2919 Log.d("Debug", "");
2920 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
2921 return "";
2922 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002923
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002924 @Override
2925 public String toString() {
Jorim Jaggi484851b2017-09-22 16:03:27 +02002926 return toString("");
2927 }
2928
2929 /**
2930 * @hide
2931 */
Felipe Lemeda9ea342018-03-22 15:19:51 -07002932 public void dumpDimensions(StringBuilder sb) {
2933 sb.append('(');
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002934 sb.append(x);
2935 sb.append(',');
2936 sb.append(y);
2937 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08002938 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
2939 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002940 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08002941 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
2942 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 sb.append(")");
Felipe Lemeda9ea342018-03-22 15:19:51 -07002944 }
2945
2946 /**
2947 * @hide
2948 */
2949 public String toString(String prefix) {
2950 StringBuilder sb = new StringBuilder(256);
2951 sb.append('{');
2952 dumpDimensions(sb);
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002953 if (horizontalMargin != 0) {
2954 sb.append(" hm=");
2955 sb.append(horizontalMargin);
2956 }
2957 if (verticalMargin != 0) {
2958 sb.append(" vm=");
2959 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002960 }
2961 if (gravity != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02002962 sb.append(" gr=");
2963 sb.append(Gravity.toString(gravity));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002964 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002965 if (softInputMode != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02002966 sb.append(" sim={");
2967 sb.append(softInputModeToString(softInputMode));
2968 sb.append('}');
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002969 }
Adrian Roosfa02da62018-01-15 16:01:18 +01002970 if (layoutInDisplayCutoutMode != 0) {
2971 sb.append(" layoutInDisplayCutoutMode=");
2972 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode));
2973 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002974 sb.append(" ty=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02002975 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002976 if (format != PixelFormat.OPAQUE) {
2977 sb.append(" fmt=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02002978 sb.append(PixelFormat.formatToString(format));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002979 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002980 if (windowAnimations != 0) {
2981 sb.append(" wanim=0x");
2982 sb.append(Integer.toHexString(windowAnimations));
2983 }
2984 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
2985 sb.append(" or=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02002986 sb.append(ActivityInfo.screenOrientationToString(screenOrientation));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002988 if (alpha != 1.0f) {
2989 sb.append(" alpha=");
2990 sb.append(alpha);
2991 }
2992 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2993 sb.append(" sbrt=");
2994 sb.append(screenBrightness);
2995 }
2996 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2997 sb.append(" bbrt=");
2998 sb.append(buttonBrightness);
2999 }
Craig Mautner3c174372013-02-21 17:54:37 -08003000 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
3001 sb.append(" rotAnim=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003002 sb.append(rotationAnimationToString(rotationAnimation));
Craig Mautner3c174372013-02-21 17:54:37 -08003003 }
Michael Wright3f145a22014-07-22 19:46:03 -07003004 if (preferredRefreshRate != 0) {
3005 sb.append(" preferredRefreshRate=");
3006 sb.append(preferredRefreshRate);
3007 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003008 if (preferredDisplayModeId != 0) {
3009 sb.append(" preferredDisplayMode=");
3010 sb.append(preferredDisplayModeId);
3011 }
Joe Onorato664644d2011-01-23 17:53:23 -08003012 if (hasSystemUiListeners) {
3013 sb.append(" sysuil=");
3014 sb.append(hasSystemUiListeners);
3015 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003016 if (inputFeatures != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003017 sb.append(" if=").append(inputFeatureToString(inputFeatures));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003018 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003019 if (userActivityTimeout >= 0) {
3020 sb.append(" userActivityTimeout=").append(userActivityTimeout);
3021 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07003022 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07003023 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
3024 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07003025 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08003026 if (hasManualSurfaceInsets) {
3027 sb.append(" (manual)");
3028 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003029 if (!preservePreviousSurfaceInsets) {
3030 sb.append(" (!preservePreviousSurfaceInsets)");
3031 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07003032 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003033 if (needsMenuKey == NEEDS_MENU_SET_TRUE) {
3034 sb.append(" needsMenuKey");
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003035 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003036 if (mColorMode != COLOR_MODE_DEFAULT) {
3037 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode));
3038 }
3039 sb.append(System.lineSeparator());
3040 sb.append(prefix).append(" fl=").append(
3041 ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
3042 if (privateFlags != 0) {
3043 sb.append(System.lineSeparator());
3044 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString(
3045 LayoutParams.class, "privateFlags", privateFlags));
3046 }
3047 if (systemUiVisibility != 0) {
3048 sb.append(System.lineSeparator());
3049 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString(
3050 View.class, "mSystemUiVisibility", systemUiVisibility));
3051 }
3052 if (subtreeSystemUiVisibility != 0) {
3053 sb.append(System.lineSeparator());
3054 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString(
3055 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility));
3056 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003057 sb.append('}');
3058 return sb.toString();
3059 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003060
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003061 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07003062 * @hide
3063 */
3064 public void writeToProto(ProtoOutputStream proto, long fieldId) {
3065 final long token = proto.start(fieldId);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003066 proto.write(TYPE, type);
3067 proto.write(X, x);
3068 proto.write(Y, y);
3069 proto.write(WIDTH, width);
3070 proto.write(HEIGHT, height);
3071 proto.write(HORIZONTAL_MARGIN, horizontalMargin);
3072 proto.write(VERTICAL_MARGIN, verticalMargin);
3073 proto.write(GRAVITY, gravity);
3074 proto.write(SOFT_INPUT_MODE, softInputMode);
3075 proto.write(FORMAT, format);
3076 proto.write(WINDOW_ANIMATIONS, windowAnimations);
3077 proto.write(ALPHA, alpha);
3078 proto.write(SCREEN_BRIGHTNESS, screenBrightness);
3079 proto.write(BUTTON_BRIGHTNESS, buttonBrightness);
3080 proto.write(ROTATION_ANIMATION, rotationAnimation);
3081 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate);
3082 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId);
3083 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners);
3084 proto.write(INPUT_FEATURE_FLAGS, inputFeatures);
3085 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout);
3086 proto.write(NEEDS_MENU_KEY, needsMenuKey);
3087 proto.write(COLOR_MODE, mColorMode);
3088 proto.write(FLAGS, flags);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003089 proto.write(PRIVATE_FLAGS, privateFlags);
3090 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility);
3091 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility);
Steven Timotiusaf03df62017-07-18 16:56:43 -07003092 proto.end(token);
3093 }
3094
3095 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003096 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003097 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003098 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003099 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003100 x = (int) (x * scale + 0.5f);
3101 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003102 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003103 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003104 }
3105 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003106 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003107 }
3108 }
3109
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003110 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003111 * Backup the layout parameters used in compatibility mode.
3112 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003113 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003114 void backup() {
3115 int[] backup = mCompatibilityParamsBackup;
3116 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003117 // we backup 4 elements, x, y, width, height
3118 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003119 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003120 backup[0] = x;
3121 backup[1] = y;
3122 backup[2] = width;
3123 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003124 }
3125
3126 /**
3127 * Restore the layout params' coordinates, size and gravity
3128 * @see LayoutParams#backup()
3129 */
3130 void restore() {
3131 int[] backup = mCompatibilityParamsBackup;
3132 if (backup != null) {
3133 x = backup[0];
3134 y = backup[1];
3135 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003136 height = backup[3];
3137 }
3138 }
3139
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003140 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07003141
3142 /** @hide */
3143 @Override
3144 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
3145 super.encodeProperties(encoder);
3146
3147 encoder.addProperty("x", x);
3148 encoder.addProperty("y", y);
3149 encoder.addProperty("horizontalWeight", horizontalWeight);
3150 encoder.addProperty("verticalWeight", verticalWeight);
3151 encoder.addProperty("type", type);
3152 encoder.addProperty("flags", flags);
3153 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02003154
3155 /**
3156 * @hide
3157 * @return True if the layout parameters will cause the window to cover the full screen;
3158 * false otherwise.
3159 */
3160 public boolean isFullscreen() {
3161 return x == 0 && y == 0
3162 && width == WindowManager.LayoutParams.MATCH_PARENT
3163 && height == WindowManager.LayoutParams.MATCH_PARENT;
3164 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003165
Adrian Roosfa02da62018-01-15 16:01:18 +01003166 private static String layoutInDisplayCutoutModeToString(
3167 @LayoutInDisplayCutoutMode int mode) {
3168 switch (mode) {
3169 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT:
3170 return "default";
3171 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS:
3172 return "always";
3173 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER:
3174 return "never";
3175 default:
3176 return "unknown(" + mode + ")";
3177 }
3178 }
3179
Jorim Jaggi484851b2017-09-22 16:03:27 +02003180 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) {
3181 final StringBuilder result = new StringBuilder();
3182 final int state = softInputMode & SOFT_INPUT_MASK_STATE;
3183 if (state != 0) {
3184 result.append("state=");
3185 switch (state) {
3186 case SOFT_INPUT_STATE_UNCHANGED:
3187 result.append("unchanged");
3188 break;
3189 case SOFT_INPUT_STATE_HIDDEN:
3190 result.append("hidden");
3191 break;
3192 case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
3193 result.append("always_hidden");
3194 break;
3195 case SOFT_INPUT_STATE_VISIBLE:
3196 result.append("visible");
3197 break;
3198 case SOFT_INPUT_STATE_ALWAYS_VISIBLE:
3199 result.append("always_visible");
3200 break;
3201 default:
3202 result.append(state);
3203 break;
3204 }
3205 result.append(' ');
3206 }
3207 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST;
3208 if (adjust != 0) {
3209 result.append("adjust=");
3210 switch (adjust) {
3211 case SOFT_INPUT_ADJUST_RESIZE:
3212 result.append("resize");
3213 break;
3214 case SOFT_INPUT_ADJUST_PAN:
3215 result.append("pan");
3216 break;
3217 case SOFT_INPUT_ADJUST_NOTHING:
3218 result.append("nothing");
3219 break;
3220 default:
3221 result.append(adjust);
3222 break;
3223 }
3224 result.append(' ');
3225 }
3226 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
3227 result.append("forwardNavigation").append(' ');
3228 }
3229 result.deleteCharAt(result.length() - 1);
3230 return result.toString();
3231 }
3232
3233 private static String rotationAnimationToString(int rotationAnimation) {
3234 switch (rotationAnimation) {
3235 case ROTATION_ANIMATION_UNSPECIFIED:
3236 return "UNSPECIFIED";
3237 case ROTATION_ANIMATION_ROTATE:
3238 return "ROTATE";
3239 case ROTATION_ANIMATION_CROSSFADE:
3240 return "CROSSFADE";
3241 case ROTATION_ANIMATION_JUMPCUT:
3242 return "JUMPCUT";
3243 case ROTATION_ANIMATION_SEAMLESS:
3244 return "SEAMLESS";
3245 default:
3246 return Integer.toString(rotationAnimation);
3247 }
3248 }
3249
3250 private static String inputFeatureToString(int inputFeature) {
3251 switch (inputFeature) {
3252 case INPUT_FEATURE_DISABLE_POINTER_GESTURES:
3253 return "DISABLE_POINTER_GESTURES";
3254 case INPUT_FEATURE_NO_INPUT_CHANNEL:
3255 return "NO_INPUT_CHANNEL";
3256 case INPUT_FEATURE_DISABLE_USER_ACTIVITY:
3257 return "DISABLE_USER_ACTIVITY";
3258 default:
3259 return Integer.toString(inputFeature);
3260 }
3261 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 }
3263}