blob: 62a824d759f7c97e2b0e6bd028e07c8571a7ba18 [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;
Jorim Jaggib7848b72018-12-28 14:38:21 +010021import static android.view.WindowLayoutParamsProto.APPEARANCE;
22import static android.view.WindowLayoutParamsProto.BEHAVIOR;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080023import static android.view.WindowLayoutParamsProto.BUTTON_BRIGHTNESS;
24import static android.view.WindowLayoutParamsProto.COLOR_MODE;
25import static android.view.WindowLayoutParamsProto.FLAGS;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080026import static android.view.WindowLayoutParamsProto.FORMAT;
27import static android.view.WindowLayoutParamsProto.GRAVITY;
28import static android.view.WindowLayoutParamsProto.HAS_SYSTEM_UI_LISTENERS;
29import static android.view.WindowLayoutParamsProto.HEIGHT;
30import static android.view.WindowLayoutParamsProto.HORIZONTAL_MARGIN;
31import static android.view.WindowLayoutParamsProto.INPUT_FEATURE_FLAGS;
32import static android.view.WindowLayoutParamsProto.NEEDS_MENU_KEY;
33import static android.view.WindowLayoutParamsProto.PREFERRED_REFRESH_RATE;
34import static android.view.WindowLayoutParamsProto.PRIVATE_FLAGS;
35import static android.view.WindowLayoutParamsProto.ROTATION_ANIMATION;
36import static android.view.WindowLayoutParamsProto.SCREEN_BRIGHTNESS;
37import static android.view.WindowLayoutParamsProto.SOFT_INPUT_MODE;
38import static android.view.WindowLayoutParamsProto.SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS;
39import static android.view.WindowLayoutParamsProto.SYSTEM_UI_VISIBILITY_FLAGS;
40import static android.view.WindowLayoutParamsProto.TYPE;
41import static android.view.WindowLayoutParamsProto.USER_ACTIVITY_TIMEOUT;
42import static android.view.WindowLayoutParamsProto.VERTICAL_MARGIN;
43import static android.view.WindowLayoutParamsProto.WIDTH;
44import static android.view.WindowLayoutParamsProto.WINDOW_ANIMATIONS;
45import static android.view.WindowLayoutParamsProto.X;
46import static android.view.WindowLayoutParamsProto.Y;
Jorim Jaggi484851b2017-09-22 16:03:27 +020047
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020048import android.Manifest.permission;
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080049import android.annotation.IntDef;
Siva Velusamy0d857b92015-04-22 10:23:56 -070050import android.annotation.NonNull;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040051import android.annotation.RequiresPermission;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080052import android.annotation.SystemApi;
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060053import android.annotation.SystemService;
Robert Carrb48380a2017-04-04 14:56:37 -070054import android.annotation.TestApi;
Mathew Inwooda570dee2018-08-17 14:56:00 +010055import android.annotation.UnsupportedAppUsage;
Jorim Jaggi241ae102016-11-02 21:57:33 -070056import android.app.KeyguardManager;
Jeff Browna492c3a2012-08-23 19:48:44 -070057import android.app.Presentation;
58import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059import android.content.pm.ActivityInfo;
60import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070061import android.graphics.Rect;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040062import android.graphics.Region;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063import android.os.IBinder;
64import android.os.Parcel;
65import android.os.Parcelable;
66import android.text.TextUtils;
67import android.util.Log;
Steven Timotiusaf03df62017-07-18 16:56:43 -070068import android.util.proto.ProtoOutputStream;
Phil Weaver8583ae82018-02-13 11:01:24 -080069import android.view.accessibility.AccessibilityNodeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080071import java.lang.annotation.Retention;
72import java.lang.annotation.RetentionPolicy;
Clara Bayarri75e09792015-07-29 16:20:40 +010073import java.util.List;
Wale Ogunwale1f240c92016-02-22 18:04:58 -080074import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075
76/**
77 * The interface that apps use to talk to the window manager.
Jeff Browna492c3a2012-08-23 19:48:44 -070078 * </p><p>
79 * Each window manager instance is bound to a particular {@link Display}.
80 * To obtain a {@link WindowManager} for a different display, use
81 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
82 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
83 * to get the WindowManager.
84 * </p><p>
85 * The simplest way to show a window on another display is to create a
86 * {@link Presentation}. The presentation will automatically obtain a
87 * {@link WindowManager} and {@link Context} for that display.
88 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 */
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060090@SystemService(Context.WINDOW_SERVICE)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091public interface WindowManager extends ViewManager {
Jorim Jaggi61f39a72015-10-29 16:54:18 +010092
93 /** @hide */
94 int DOCKED_INVALID = -1;
95 /** @hide */
96 int DOCKED_LEFT = 1;
97 /** @hide */
98 int DOCKED_TOP = 2;
99 /** @hide */
100 int DOCKED_RIGHT = 3;
101 /** @hide */
102 int DOCKED_BOTTOM = 4;
103
Winson41275482016-10-10 15:17:45 -0700104 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000105 String INPUT_CONSUMER_PIP = "pip_input_consumer";
Winson41275482016-10-10 15:17:45 -0700106 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000107 String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer";
Winson41275482016-10-10 15:17:45 -0700108 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000109 String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer";
110 /** @hide */
111 String INPUT_CONSUMER_RECENTS_ANIMATION = "recents_animation_input_consumer";
Winson41275482016-10-10 15:17:45 -0700112
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100114 * Not set up for a transition.
115 * @hide
116 */
117 int TRANSIT_UNSET = -1;
118
119 /**
120 * No animation for transition.
121 * @hide
122 */
123 int TRANSIT_NONE = 0;
124
125 /**
126 * A window in a new activity is being opened on top of an existing one in the same task.
127 * @hide
128 */
129 int TRANSIT_ACTIVITY_OPEN = 6;
130
131 /**
132 * The window in the top-most activity is being closed to reveal the previous activity in the
133 * same task.
134 * @hide
135 */
136 int TRANSIT_ACTIVITY_CLOSE = 7;
137
138 /**
139 * A window in a new task is being opened on top of an existing one in another activity's task.
140 * @hide
141 */
142 int TRANSIT_TASK_OPEN = 8;
143
144 /**
145 * A window in the top-most activity is being closed to reveal the previous activity in a
146 * different task.
147 * @hide
148 */
149 int TRANSIT_TASK_CLOSE = 9;
150
151 /**
152 * A window in an existing task is being displayed on top of an existing one in another
153 * activity's task.
154 * @hide
155 */
156 int TRANSIT_TASK_TO_FRONT = 10;
157
158 /**
159 * A window in an existing task is being put below all other tasks.
160 * @hide
161 */
162 int TRANSIT_TASK_TO_BACK = 11;
163
164 /**
165 * A window in a new activity that doesn't have a wallpaper is being opened on top of one that
166 * does, effectively closing the wallpaper.
167 * @hide
168 */
169 int TRANSIT_WALLPAPER_CLOSE = 12;
170
171 /**
172 * A window in a new activity that does have a wallpaper is being opened on one that didn't,
173 * effectively opening the wallpaper.
174 * @hide
175 */
176 int TRANSIT_WALLPAPER_OPEN = 13;
177
178 /**
179 * A window in a new activity is being opened on top of an existing one, and both are on top
180 * of the wallpaper.
181 * @hide
182 */
183 int TRANSIT_WALLPAPER_INTRA_OPEN = 14;
184
185 /**
186 * The window in the top-most activity is being closed to reveal the previous activity, and
187 * both are on top of the wallpaper.
188 * @hide
189 */
190 int TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
191
192 /**
193 * A window in a new task is being opened behind an existing one in another activity's task.
194 * The new window will show briefly and then be gone.
195 * @hide
196 */
197 int TRANSIT_TASK_OPEN_BEHIND = 16;
198
199 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100200 * An activity is being relaunched (e.g. due to configuration change).
201 * @hide
202 */
203 int TRANSIT_ACTIVITY_RELAUNCH = 18;
204
205 /**
206 * A task is being docked from recents.
207 * @hide
208 */
209 int TRANSIT_DOCK_TASK_FROM_RECENTS = 19;
210
211 /**
212 * Keyguard is going away.
213 * @hide
214 */
215 int TRANSIT_KEYGUARD_GOING_AWAY = 20;
216
217 /**
218 * Keyguard is going away with showing an activity behind that requests wallpaper.
219 * @hide
220 */
221 int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
222
223 /**
224 * Keyguard is being occluded.
225 * @hide
226 */
227 int TRANSIT_KEYGUARD_OCCLUDE = 22;
228
229 /**
230 * Keyguard is being unoccluded.
231 * @hide
232 */
233 int TRANSIT_KEYGUARD_UNOCCLUDE = 23;
234
235 /**
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200236 * A translucent activity is being opened.
237 * @hide
238 */
239 int TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24;
240
241 /**
242 * A translucent activity is being closed.
243 * @hide
244 */
245 int TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25;
246
247 /**
Adrian Roos93577212018-04-10 14:12:10 -0700248 * A crashing activity is being closed.
249 * @hide
250 */
251 int TRANSIT_CRASHING_ACTIVITY_CLOSE = 26;
252
253 /**
Evan Rosky2289ba12018-11-19 18:28:18 -0800254 * A task is changing windowing modes
255 * @hide
256 */
257 int TRANSIT_TASK_CHANGE_WINDOWING_MODE = 27;
258
259 /**
Issei Suzukicac2a502019-04-16 16:52:50 +0200260 * A display which can only contain one task is being shown because the first activity is
261 * started or it's being turned on.
262 * @hide
263 */
264 int TRANSIT_SHOW_SINGLE_TASK_DISPLAY = 28;
265
266 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100267 * @hide
268 */
269 @IntDef(prefix = { "TRANSIT_" }, value = {
270 TRANSIT_UNSET,
271 TRANSIT_NONE,
272 TRANSIT_ACTIVITY_OPEN,
273 TRANSIT_ACTIVITY_CLOSE,
274 TRANSIT_TASK_OPEN,
275 TRANSIT_TASK_CLOSE,
276 TRANSIT_TASK_TO_FRONT,
277 TRANSIT_TASK_TO_BACK,
278 TRANSIT_WALLPAPER_CLOSE,
279 TRANSIT_WALLPAPER_OPEN,
280 TRANSIT_WALLPAPER_INTRA_OPEN,
281 TRANSIT_WALLPAPER_INTRA_CLOSE,
282 TRANSIT_TASK_OPEN_BEHIND,
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100283 TRANSIT_ACTIVITY_RELAUNCH,
284 TRANSIT_DOCK_TASK_FROM_RECENTS,
285 TRANSIT_KEYGUARD_GOING_AWAY,
286 TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
287 TRANSIT_KEYGUARD_OCCLUDE,
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200288 TRANSIT_KEYGUARD_UNOCCLUDE,
289 TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
Jorim Jaggi9c52ebb2018-06-01 14:45:24 +0200290 TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
Evan Rosky2289ba12018-11-19 18:28:18 -0800291 TRANSIT_CRASHING_ACTIVITY_CLOSE,
Issei Suzukicac2a502019-04-16 16:52:50 +0200292 TRANSIT_TASK_CHANGE_WINDOWING_MODE,
293 TRANSIT_SHOW_SINGLE_TASK_DISPLAY
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100294 })
295 @Retention(RetentionPolicy.SOURCE)
296 @interface TransitionType {}
297
298 /**
299 * Transition flag: Keyguard is going away, but keeping the notification shade open
300 * @hide
301 */
302 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE = 0x1;
303
304 /**
305 * Transition flag: Keyguard is going away, but doesn't want an animation for it
306 * @hide
307 */
308 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION = 0x2;
309
310 /**
311 * Transition flag: Keyguard is going away while it was showing the system wallpaper.
312 * @hide
313 */
314 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER = 0x4;
315
316 /**
Issei Suzuki5609ccb2019-06-13 15:04:08 +0200317 * Transition flag: Keyguard is going away with subtle animation.
318 * @hide
319 */
320 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION = 0x8;
321
322 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100323 * @hide
324 */
325 @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = {
326 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE,
327 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION,
328 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER,
329 })
330 @Retention(RetentionPolicy.SOURCE)
331 @interface TransitionFlags {}
332
333 /**
Chilun8753ad32018-10-09 15:56:45 +0800334 * Remove content mode: Indicates remove content mode is currently not defined.
335 * @hide
336 */
337 int REMOVE_CONTENT_MODE_UNDEFINED = 0;
338
339 /**
340 * Remove content mode: Indicates that when display is removed, all its activities will be moved
341 * to the primary display and the topmost activity should become focused.
342 * @hide
343 */
344 int REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY = 1;
345
346 /**
347 * Remove content mode: Indicates that when display is removed, all its stacks and tasks will be
348 * removed, all activities will be destroyed according to the usual lifecycle.
349 * @hide
350 */
351 int REMOVE_CONTENT_MODE_DESTROY = 2;
352
353 /**
354 * @hide
355 */
356 @IntDef(prefix = { "REMOVE_CONTENT_MODE_" }, value = {
357 REMOVE_CONTENT_MODE_UNDEFINED,
358 REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY,
359 REMOVE_CONTENT_MODE_DESTROY,
360 })
361 @interface RemoveContentMode {}
362
363 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100365 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 * is invalid.
367 */
368 public static class BadTokenException extends RuntimeException {
369 public BadTokenException() {
370 }
371
372 public BadTokenException(String name) {
373 super(name);
374 }
375 }
376
377 /**
Craig Mautner6018aee2012-10-23 14:27:49 -0700378 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
379 * be found. See {@link android.app.Presentation} for more information on secondary displays.
380 */
381 public static class InvalidDisplayException extends RuntimeException {
382 public InvalidDisplayException() {
383 }
384
385 public InvalidDisplayException(String name) {
386 super(name);
387 }
388 }
389
390 /**
Jeff Browna492c3a2012-08-23 19:48:44 -0700391 * Returns the {@link Display} upon which this {@link WindowManager} instance
392 * will create new windows.
393 * <p>
394 * Despite the name of this method, the display that is returned is not
395 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
396 * The returned display could instead be a secondary display that this
397 * window manager instance is managing. Think of it as the display that
398 * this {@link WindowManager} instance uses by default.
399 * </p><p>
400 * To create windows on a different display, you need to obtain a
401 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
402 * class documentation for more information.)
403 * </p>
404 *
405 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 */
407 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700408
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 /**
410 * Special variation of {@link #removeView} that immediately invokes
411 * the given view hierarchy's {@link View#onDetachedFromWindow()
412 * View.onDetachedFromWindow()} methods before returning. This is not
413 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700414 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 * @param view The view to be removed.
416 */
417 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700418
Clara Bayarri75e09792015-07-29 16:20:40 +0100419 /**
420 * Used to asynchronously request Keyboard Shortcuts from the focused window.
421 *
422 * @hide
423 */
424 public interface KeyboardShortcutsReceiver {
425 /**
426 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
427 *
428 * @param result The keyboard shortcuts to be displayed.
429 */
430 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
431 }
432
433 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800434 * Message for taking fullscreen screenshot
435 * @hide
436 */
437 final int TAKE_SCREENSHOT_FULLSCREEN = 1;
438
439 /**
440 * Message for taking screenshot of selected region.
441 * @hide
442 */
443 final int TAKE_SCREENSHOT_SELECTED_REGION = 2;
444
445 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100446 * @hide
447 */
448 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
449
450 /**
451 * Request for keyboard shortcuts to be retrieved asynchronously.
452 *
453 * @param receiver The callback to be triggered when the result is ready.
454 *
455 * @hide
456 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000457 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100458
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400459 /**
460 * Return the touch region for the current IME window, or an empty region if there is none.
461 *
462 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
463 * region or there was an error.
464 *
465 * @hide
466 */
467 @SystemApi
468 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
469 public Region getCurrentImeTouchRegion();
470
Chilun8753ad32018-10-09 15:56:45 +0800471 /**
472 * Sets that the display should show its content when non-secure keyguard is shown.
473 *
474 * @param displayId Display ID.
475 * @param shouldShow Indicates that the display should show its content when non-secure keyguard
476 * is shown.
477 * @see KeyguardManager#isDeviceSecure()
478 * @see KeyguardManager#isDeviceLocked()
479 * @hide
480 */
481 @TestApi
482 default void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
483 }
484
485 /**
486 * Sets that the display should show system decors.
487 * <p>
488 * System decors include status bar, navigation bar, launcher.
489 * </p>
490 *
491 * @param displayId The id of the display.
492 * @param shouldShow Indicates that the display should show system decors.
Andrii Kuliandd989612019-02-21 12:13:28 -0800493 * @see #shouldShowSystemDecors(int)
Chilun8753ad32018-10-09 15:56:45 +0800494 * @hide
495 */
496 @TestApi
497 default void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
498 }
499
500 /**
Andrii Kuliandd989612019-02-21 12:13:28 -0800501 * Checks if the display supports showing system decors.
502 * <p>
503 * System decors include status bar, navigation bar, launcher.
504 * </p>
505 *
506 * @param displayId The id of the display.
507 * @see #setShouldShowSystemDecors(int, boolean)
508 * @hide
509 */
510 @TestApi
511 default boolean shouldShowSystemDecors(int displayId) {
512 return false;
513 }
514
515 /**
Chilun8753ad32018-10-09 15:56:45 +0800516 * Sets that the display should show IME.
517 *
518 * @param displayId Display ID.
519 * @param shouldShow Indicates that the display should show IME.
Chilun8753ad32018-10-09 15:56:45 +0800520 * @hide
521 */
522 @TestApi
523 default void setShouldShowIme(int displayId, boolean shouldShow) {
524 }
525
lumark9a72d222019-03-30 18:31:45 +0800526 /**
527 * Indicates that the display should show IME.
528 *
529 * @param displayId The id of the display.
530 * @return {@code true} if the display should show IME when an input field becomes
531 * focused on it.
532 * @hide
533 */
534 @TestApi
535 default boolean shouldShowIme(int displayId) {
536 return false;
537 }
538
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800539 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 /**
541 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700542 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
543 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800544 */
Romain Guy529b60a2010-08-03 18:05:47 -0700545 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700547
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 /**
549 * Y position for this window. With the default gravity it is ignored.
550 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
551 * an offset from the given edge.
552 */
Romain Guy529b60a2010-08-03 18:05:47 -0700553 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 public int y;
555
556 /**
557 * Indicates how much of the extra space will be allocated horizontally
558 * to the view associated with these LayoutParams. Specify 0 if the view
559 * should not be stretched. Otherwise the extra pixels will be pro-rated
560 * among all views whose weight is greater than 0.
561 */
Romain Guy529b60a2010-08-03 18:05:47 -0700562 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 public float horizontalWeight;
564
565 /**
566 * Indicates how much of the extra space will be allocated vertically
567 * to the view associated with these LayoutParams. Specify 0 if the view
568 * should not be stretched. Otherwise the extra pixels will be pro-rated
569 * among all views whose weight is greater than 0.
570 */
Romain Guy529b60a2010-08-03 18:05:47 -0700571 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800572 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800574 /**
575 * The general type of window. There are three main classes of
576 * window types:
577 * <ul>
578 * <li> <strong>Application windows</strong> (ranging from
579 * {@link #FIRST_APPLICATION_WINDOW} to
580 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
581 * windows. For these types of windows, the {@link #token} must be
582 * set to the token of the activity they are a part of (this will
583 * normally be done for you if {@link #token} is null).
584 * <li> <strong>Sub-windows</strong> (ranging from
585 * {@link #FIRST_SUB_WINDOW} to
586 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
587 * window. For these types of windows, the {@link #token} must be
588 * the token of the window it is attached to.
589 * <li> <strong>System windows</strong> (ranging from
590 * {@link #FIRST_SYSTEM_WINDOW} to
591 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
592 * use by the system for specific purposes. They should not normally
593 * be used by applications, and a special permission is required
594 * to use them.
595 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700596 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 * @see #TYPE_BASE_APPLICATION
598 * @see #TYPE_APPLICATION
599 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700600 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800601 * @see #TYPE_APPLICATION_PANEL
602 * @see #TYPE_APPLICATION_MEDIA
603 * @see #TYPE_APPLICATION_SUB_PANEL
604 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
605 * @see #TYPE_STATUS_BAR
606 * @see #TYPE_SEARCH_BAR
607 * @see #TYPE_PHONE
608 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 * @see #TYPE_TOAST
610 * @see #TYPE_SYSTEM_OVERLAY
611 * @see #TYPE_PRIORITY_PHONE
612 * @see #TYPE_STATUS_BAR_PANEL
613 * @see #TYPE_SYSTEM_DIALOG
614 * @see #TYPE_KEYGUARD_DIALOG
615 * @see #TYPE_SYSTEM_ERROR
616 * @see #TYPE_INPUT_METHOD
617 * @see #TYPE_INPUT_METHOD_DIALOG
618 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700619 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700620 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200621 to = "BASE_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700622 @ViewDebug.IntToString(from = TYPE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200623 to = "APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700624 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200625 to = "APPLICATION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700626 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200627 to = "DRAWN_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700628 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200629 to = "APPLICATION_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700630 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200631 to = "APPLICATION_MEDIA"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700632 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200633 to = "APPLICATION_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700634 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200635 to = "APPLICATION_ABOVE_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700636 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200637 to = "APPLICATION_ATTACHED_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700638 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200639 to = "APPLICATION_MEDIA_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700640 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200641 to = "STATUS_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700642 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200643 to = "SEARCH_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700644 @ViewDebug.IntToString(from = TYPE_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200645 to = "PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700646 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200647 to = "SYSTEM_ALERT"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700648 @ViewDebug.IntToString(from = TYPE_TOAST,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200649 to = "TOAST"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700650 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200651 to = "SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700652 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200653 to = "PRIORITY_PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700654 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200655 to = "SYSTEM_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700656 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200657 to = "KEYGUARD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700658 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200659 to = "SYSTEM_ERROR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700660 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200661 to = "INPUT_METHOD"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700662 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200663 to = "INPUT_METHOD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700664 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200665 to = "WALLPAPER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700666 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200667 to = "STATUS_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700668 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200669 to = "SECURE_SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700670 @ViewDebug.IntToString(from = TYPE_DRAG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200671 to = "DRAG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700672 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200673 to = "STATUS_BAR_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700674 @ViewDebug.IntToString(from = TYPE_POINTER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200675 to = "POINTER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700676 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200677 to = "NAVIGATION_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700678 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200679 to = "VOLUME_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700680 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200681 to = "BOOT_PROGRESS"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700682 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200683 to = "INPUT_CONSUMER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700684 @ViewDebug.IntToString(from = TYPE_DREAM,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200685 to = "DREAM"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700686 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200687 to = "NAVIGATION_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700688 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200689 to = "DISPLAY_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700690 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200691 to = "MAGNIFICATION_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700692 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200693 to = "PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700694 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200695 to = "PRIVATE_PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700696 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200697 to = "VOICE_INTERACTION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700698 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200699 to = "VOICE_INTERACTION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700700 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200701 to = "DOCK_DIVIDER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700702 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200703 to = "QS_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700704 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200705 to = "SCREENSHOT"),
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800706 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200707 to = "APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700708 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 /**
712 * Start of window types that represent normal application windows.
713 */
714 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700715
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 /**
717 * Window type: an application window that serves as the "base" window
718 * of the overall application; all other application windows will
719 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700720 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 */
722 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700723
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 /**
725 * Window type: a normal application window. The {@link #token} must be
726 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700727 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 */
729 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800731 /**
732 * Window type: special application window that is displayed while the
733 * application is starting. Not for use by applications themselves;
734 * this is used by the system to display something until the
735 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700736 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800737 */
738 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700739
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800740 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700741 * Window type: a variation on TYPE_APPLICATION that ensures the window
742 * manager will wait for this window to be drawn before the app is shown.
743 * In multiuser systems shows only on the owning user's window.
744 */
745 public static final int TYPE_DRAWN_APPLICATION = 4;
746
747 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748 * End of types of application windows.
749 */
750 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700751
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 /**
753 * Start of types of sub-windows. The {@link #token} of these windows
754 * must be set to the window they are attached to. These types of
755 * windows are kept next to their attached window in Z-order, and their
756 * coordinate space is relative to their attached window.
757 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700758 public static final int FIRST_SUB_WINDOW = 1000;
759
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800760 /**
761 * Window type: a panel on top of an application window. These windows
762 * appear on top of their attached window.
763 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700764 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
765
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 /**
John Spurlock33291d82013-03-13 14:45:14 -0400767 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 * are displayed behind their attached window.
769 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700770 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
771
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800772 /**
773 * Window type: a sub-panel on top of an application window. These
774 * windows are displayed on top their attached window and any
775 * {@link #TYPE_APPLICATION_PANEL} panels.
776 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700777 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800778
779 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
780 * of the window happens as that of a top-level window, <em>not</em>
781 * as a child of its container.
782 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700783 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
784
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800785 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700786 * Window type: window for showing overlays on top of media windows.
787 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
788 * application window. They should be translucent to be useful. This
789 * is a big ugly hack so:
790 * @hide
791 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100792 @UnsupportedAppUsage
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700793 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
794
795 /**
796 * Window type: a above sub-panel on top of an application window and it's
797 * sub-panel windows. These windows are displayed on top of their attached window
798 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700799 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700800 */
801 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
802
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700803 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800804 * End of types of sub-windows.
805 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700806 public static final int LAST_SUB_WINDOW = 1999;
807
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800808 /**
809 * Start of system-specific window types. These are not normally
810 * created by applications.
811 */
812 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700813
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800814 /**
815 * Window type: the status bar. There can be only one status bar
816 * window; it is placed at the top of the screen, and all other
817 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700818 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 */
820 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 /**
823 * Window type: the search bar. There can be only one search bar
824 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700825 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 */
827 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700828
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 /**
830 * Window type: phone. These are non-application windows providing
831 * user interaction with the phone (in particular incoming calls).
832 * These windows are normally placed above all applications, but behind
833 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700834 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800835 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800836 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800837 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800838 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700839
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800840 /**
841 * Window type: system window, such as low power alert. These windows
842 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700843 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800844 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800845 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800846 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100848
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 /**
850 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700851 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200852 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800853 */
854 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100855
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800856 /**
857 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700858 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800859 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800861 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800862 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700863
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 /**
865 * Window type: system overlay windows, which need to be displayed
866 * on top of everything else. These windows must not take input
867 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700868 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800869 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800870 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800871 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800872 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700873
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800874 /**
875 * Window type: priority phone UI, which needs to be displayed even if
876 * the keyguard is active. These windows must not take input
877 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700878 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800879 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800880 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800881 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800882 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700883
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800884 /**
885 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700886 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800888 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700889
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 /**
891 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700892 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 */
894 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700895
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 /**
897 * Window type: internal system error windows, appear on top of
898 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700899 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800900 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800902 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700904
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 /**
906 * Window type: internal input methods windows, which appear above
907 * the normal UI. Application windows may be resized or panned to keep
908 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700909 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800910 */
911 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
912
913 /**
914 * Window type: internal input methods dialog windows, which appear above
915 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700916 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 */
918 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
919
920 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700921 * Window type: wallpaper window, placed behind any window that wants
922 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700923 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700924 */
925 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
926
927 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800928 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700929 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800930 */
931 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700932
933 /**
934 * Window type: secure system overlay windows, which need to be displayed
935 * on top of everything else. These windows must not take input
936 * focus, or they will interfere with the keyguard.
937 *
938 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
939 * system itself is allowed to create these overlays. Applications cannot
940 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700941 *
942 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700943 * @hide
944 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100945 @UnsupportedAppUsage
Jeff Brown3b2b3542010-10-15 00:54:27 -0700946 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
947
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800948 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700949 * Window type: the drag-and-drop pseudowindow. There is only one
950 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700951 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700952 * @hide
953 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700954 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700955
956 /**
Robert Carr8360a782017-11-22 12:47:58 -0800957 * Window type: panel that slides out from over the status bar
958 * In multiuser systems shows on all users' windows. These windows
959 * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL}
960 * windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800961 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800962 */
963 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
964
Jeff Brown83c09682010-12-23 17:50:18 -0800965 /**
966 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700967 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800968 * @hide
969 */
970 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800971
972 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400973 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700974 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400975 * @hide
976 */
977 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
978
979 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700980 * Window type: The volume level overlay/dialog shown when the user
981 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700982 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700983 * @hide
984 */
985 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
986
987 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700988 * Window type: The boot progress dialog, goes on top of everything
989 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700990 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700991 * @hide
992 */
993 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
994
995 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700996 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700997 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700998 * @hide
999 */
Selim Cinekf83e8242015-05-19 18:08:14 -07001000 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -07001001
1002 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -05001003 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -07001004 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -05001005 * @hide
1006 */
1007 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
1008
1009 /**
Jim Millere898ac52012-04-06 17:10:57 -07001010 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -07001011 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -07001012 * @hide
1013 */
1014 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
1015
1016 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -07001017 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -07001018 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -07001019 * @hide
1020 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001021 @UnsupportedAppUsage
Jeff Brownbd6e1502012-08-28 03:27:37 -07001022 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
1023
1024 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001025 * Window type: Magnification overlay window. Used to highlight the magnified
1026 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -07001027 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001028 * @hide
1029 */
1030 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
1031
1032 /**
keunyounga446bf02013-06-21 19:07:57 -07001033 * Window type: Window for Presentation on top of private
1034 * virtual display.
1035 */
1036 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
1037
1038 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -07001039 * Window type: Windows in the voice interaction layer.
1040 * @hide
1041 */
1042 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
1043
1044 /**
Phil Weaver40ded282016-01-25 15:49:02 -08001045 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -07001046 * android.accessibilityservice.AccessibilityService} for interception of
1047 * user interactions without changing the windows an accessibility service
1048 * can introspect. In particular, an accessibility service can introspect
1049 * only windows that a sighted user can interact with which is they can touch
1050 * these windows or can type into these windows. For example, if there
1051 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -08001052 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -07001053 * they are covered by a touchable window.
1054 */
1055 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
1056
1057 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -07001058 * Window type: Starting window for voice interaction layer.
1059 * @hide
1060 */
1061 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
1062
1063 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -07001064 * Window for displaying a handle used for resizing docked stacks. This window is owned
1065 * by the system process.
1066 * @hide
1067 */
1068 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
1069
1070 /**
Jason Monk8f7f3182015-11-18 16:35:14 -05001071 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
1072 * by Quick Settings Tiles.
1073 * @hide
1074 */
1075 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
1076
1077 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -08001078 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is
Muyuan Li36ca72c2016-08-06 20:24:06 -07001079 * reserved for screenshot region selection. These windows must not take input focus.
Muyuan Li6ca619f2016-03-08 13:30:42 -08001080 * @hide
1081 */
1082 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
1083
1084 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -07001085 * Window type: Window for Presentation on an external display.
1086 * @see android.app.Presentation
1087 * @hide
1088 */
1089 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
1090
1091 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001092 * Window type: Application overlay windows are displayed above all activity windows
1093 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
1094 * but below critical system windows like the status bar or IME.
1095 * <p>
1096 * The system may change the position, size, or visibility of these windows at anytime
1097 * to reduce visual clutter to the user and also manage resources.
1098 * <p>
1099 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
1100 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -08001101 * The system will adjust the importance of processes with this window type to reduce the
1102 * chance of the low-memory-killer killing them.
1103 * <p>
1104 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001105 */
1106 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
1107
1108 /**
chaviw8065f442019-11-18 13:20:58 -08001109 * Window type: Window for adding accessibility window magnification above other windows.
1110 * This will place the window in the overlay windows.
1111 * @hide
1112 */
1113 public static final int TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 39;
1114
1115 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001116 * End of types of system windows.
1117 */
1118 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001119
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001120 /**
Albert Chaulke4338f82017-04-19 15:54:08 -04001121 * @hide
1122 * Used internally when there is no suitable type available.
1123 */
1124 public static final int INVALID_WINDOW_TYPE = -1;
1125
1126 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001127 * Return true if the window type is an alert window.
1128 *
1129 * @param type The window type.
1130 * @return If the window type is an alert window.
1131 * @hide
1132 */
1133 public static boolean isSystemAlertWindowType(int type) {
1134 switch (type) {
1135 case TYPE_PHONE:
1136 case TYPE_PRIORITY_PHONE:
1137 case TYPE_SYSTEM_ALERT:
1138 case TYPE_SYSTEM_ERROR:
1139 case TYPE_SYSTEM_OVERLAY:
1140 case TYPE_APPLICATION_OVERLAY:
1141 return true;
1142 }
1143 return false;
1144 }
1145
Mathias Agopiand2112302010-12-07 19:38:17 -08001146 /** @deprecated this is ignored, this value is set automatically when needed. */
1147 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -08001149 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001150 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -08001152 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001153 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -08001155 /** @deprecated this is ignored, this value is set automatically when needed. */
1156 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001160 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001162 @Deprecated
1163 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001164
Mike Lockwoodef731622010-01-27 17:51:34 -05001165 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001166 * the lock screen to activate while the screen is on.
1167 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -08001168 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -05001169 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
1170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 /** Window flag: everything behind this window will be dimmed.
1172 * Use {@link #dimAmount} to control the amount of dim. */
1173 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001174
1175 /** Window flag: blur everything behind this window.
1176 * @deprecated Blurring is no longer supported. */
1177 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001180 /** Window flag: this window won't ever get key input focus, so the
1181 * user can not send key or other button events to it. Those will
1182 * instead go to whatever focusable window is behind it. This flag
1183 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
1184 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001185 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 * <p>Setting this flag also implies that the window will not need to
1187 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001188 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001189 * independently of any active input method (typically this means it
1190 * gets Z-ordered on top of the input method, so it can use the full
Andrew Chant17c896e2019-12-05 22:39:02 +00001191 * screen for its content and cover the input method if needed. You
1192 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001194
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001195 /** Window flag: this window can never receive touch events. */
1196 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001197
John Spurlock33291d82013-03-13 14:45:14 -04001198 /** Window flag: even when this window is focusable (its
1199 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001200 * outside of the window to be sent to the windows behind it. Otherwise
1201 * it will consume all pointer events itself, regardless of whether they
1202 * are inside of the window. */
1203 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001204
John Spurlock33291d82013-03-13 14:45:14 -04001205 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 * screen is pressed, you will receive this first touch event. Usually
1207 * the first touch event is consumed by the system since the user can
1208 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -07001209 *
1210 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001212 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 /** Window flag: as long as this window is visible to the user, keep
1216 * the device's screen turned on and bright. */
1217 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001218
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -04001220 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001221 * window must correctly position its contents to take the screen
1222 * decoration into account. This flag is normally set for you
Adrian Roosfa02da62018-01-15 16:01:18 +01001223 * by Window as described in {@link Window#setFlags}.
1224 *
1225 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed
1226 * such that it avoids the {@link DisplayCutout} area if necessary according to the
1227 * {@link #layoutInDisplayCutoutMode}.
1228 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 /** Window flag: allow window to extend outside of the screen. */
1232 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001233
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001234 /**
John Spurlock33291d82013-03-13 14:45:14 -04001235 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001236 * this window is displayed. This allows the window to use the entire
1237 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -07001238 * an app window with this flag set is on the top layer. A fullscreen window
1239 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
1240 * {@link #softInputMode} field; the window will stay fullscreen
1241 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001242 *
1243 * <p>This flag can be controlled in your theme through the
1244 * {@link android.R.attr#windowFullscreen} attribute; this attribute
1245 * is automatically set for you in the standard fullscreen themes
1246 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
1247 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
1248 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
1249 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
1250 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
1251 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
1252 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
1253 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001254 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001255
John Spurlock33291d82013-03-13 14:45:14 -04001256 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
1257 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001259
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -07001261 * the screen.
1262 * @deprecated This flag is no longer used. */
1263 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001265
John Spurlock33291d82013-03-13 14:45:14 -04001266 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -07001267 * it from appearing in screenshots or from being viewed on non-secure
1268 * displays.
1269 *
1270 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
1271 * secure surfaces and secure displays.
1272 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001275 /** Window flag: a special mode where the layout parameters are used
1276 * to perform scaling of the surface when it is composited to the
1277 * screen. */
1278 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 /** Window flag: intended for windows that will often be used when the user is
1281 * holding the screen against their face, it will aggressively filter the event
1282 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001283 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001285 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001286 * until the finger is released. */
1287 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001288
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001289 /** Window flag: a special option only for use in combination with
1290 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
1291 * screen your window may appear on top of or behind screen decorations
1292 * such as the status bar. By also including this flag, the window
1293 * manager will report the inset rectangle needed to ensure your
1294 * content is not covered by screen decorations. This flag is normally
1295 * set for you by Window as described in {@link Window#setFlags}.*/
1296 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001297
Andrew Chant17c896e2019-12-05 22:39:02 +00001298 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
1299 * respect to how this window interacts with the current method. That
1300 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
1301 * window will behave as if it needs to interact with the input method
1302 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
1303 * not set and this flag is set, then the window will behave as if it
1304 * doesn't need to interact with the input method and can be placed
1305 * to use more space and cover the input method.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001306 */
1307 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
1310 * can set this flag to receive a single special MotionEvent with
1311 * the action
1312 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
1313 * touches that occur outside of your window. Note that you will not
1314 * receive the full down/move/up gesture, only the location of the
1315 * first down as an ACTION_OUTSIDE.
1316 */
1317 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001318
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001319 /** Window flag: special flag to let windows be shown when the screen
1320 * is locked. This will let application windows take precedence over
1321 * key guard or any other lock screens. Can be used with
1322 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001323 * directly before showing the key guard window. Can be used with
1324 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
1325 * non-secure keyguards. This flag only applies to the top-most
1326 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -07001327 * @deprecated Use {@link android.R.attr#showWhenLocked} or
1328 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
1329 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001330 */
chaviw59b98852017-06-13 12:05:44 -07001331 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001332 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
1333
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001334 /** Window flag: ask that the system wallpaper be shown behind
1335 * your window. The window surface must be translucent to be able
1336 * to actually see the wallpaper behind it; this flag just ensures
1337 * that the wallpaper surface will be there if this window actually
1338 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001339 *
1340 * <p>This flag can be controlled in your theme through the
1341 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
1342 * is automatically set for you in the standard wallpaper themes
1343 * such as {@link android.R.style#Theme_Wallpaper},
1344 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
1345 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
1346 * {@link android.R.style#Theme_Holo_Wallpaper},
1347 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
1348 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
1349 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001350 */
1351 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001352
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001353 /** Window flag: when set as a window is being added or made
1354 * visible, once the window has been shown then the system will
1355 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -07001356 * up the device) to turn the screen on.
1357 * @deprecated Use {@link android.R.attr#turnScreenOn} or
1358 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
1359 * unintentional double life-cycle event.
1360 */
1361 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001362 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001363
Jeff Sharkey67f9d502017-08-05 13:49:13 -06001364 /**
1365 * Window flag: when set the window will cause the keyguard to be
1366 * dismissed, only if it is not a secure lock keyguard. Because such a
1367 * keyguard is not needed for security, it will never re-appear if the
1368 * user navigates to another window (in contrast to
1369 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1370 * secure and non-secure keyguards but ensure they reappear when the
1371 * user moves to another UI that doesn't hide them). If the keyguard is
1372 * currently active and is secure (requires an unlock credential) than
1373 * the user will still need to confirm it before seeing this window,
1374 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1375 *
1376 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1377 * {@link KeyguardManager#requestDismissKeyguard} instead.
1378 * Since keyguard was dismissed all the time as long as an
1379 * activity with this flag on its window was focused,
1380 * keyguard couldn't guard against unintentional touches on
1381 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001382 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001383 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001384 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001385
Jeff Brown01ce2e92010-09-26 22:20:12 -07001386 /** Window flag: when set the window will accept for touch events
1387 * outside of its bounds to be sent to other windows that also
1388 * support split touch. When this flag is not set, the first pointer
1389 * that goes down determines the window to which all subsequent touches
1390 * go until all pointers go up. When this flag is set, each pointer
1391 * (not necessarily the first) that goes down determines the window
1392 * to which all subsequent touches of that pointer will go until that
1393 * pointer goes up thereby enabling touches with multiple pointers
1394 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001395 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001396 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001397
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001398 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001399 * <p>Indicates whether this window should be hardware accelerated.
1400 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001401 *
Romain Guy72f0a272011-01-09 16:01:46 -08001402 * <p>This flag can be controlled programmatically <em>only</em> to enable
1403 * hardware acceleration. To enable hardware acceleration for a given
1404 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001405 *
Romain Guy72f0a272011-01-09 16:01:46 -08001406 * <pre>
1407 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1408 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1409 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1410 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001411 *
Romain Guy72f0a272011-01-09 16:01:46 -08001412 * <p>It is important to remember that this flag <strong>must</strong>
1413 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001414 *
Romain Guy72f0a272011-01-09 16:01:46 -08001415 * <p>This flag cannot be used to disable hardware acceleration after it
1416 * was enabled in your manifest using
1417 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1418 * and programmatically disable hardware acceleration (for automated testing
1419 * for instance), make sure it is turned off in your manifest and enable it
1420 * on your activity or dialog when you need it instead, using the method
1421 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001422 *
Romain Guy72f0a272011-01-09 16:01:46 -08001423 * <p>This flag is automatically set by the system if the
1424 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1425 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001426 */
1427 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001428
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001429 /**
1430 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001431 * overscan area, if there is one. The window should still correctly
1432 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001433 *
1434 * <p>This flag can be controlled in your theme through the
1435 * {@link android.R.attr#windowOverscan} attribute; this attribute
1436 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001437 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001438 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1439 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1440 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1441 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1442 *
1443 * <p>When this flag is enabled for a window, its normal content may be obscured
1444 * to some degree by the overscan region of the display. To ensure key parts of
1445 * that content are visible to the user, you can use
1446 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1447 * to set the point in the view hierarchy where the appropriate offsets should
1448 * be applied. (This can be done either by directly calling this function, using
1449 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1450 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1451 * View.fitSystemWindows(Rect)} method).</p>
1452 *
1453 * <p>This mechanism for positioning content elements is identical to its equivalent
1454 * use with layout and {@link View#setSystemUiVisibility(int)
1455 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1456 * position its UI elements with this overscan flag is set:</p>
1457 *
1458 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Jorim Jaggif081f062019-10-24 16:24:54 +02001459 *
1460 * @deprecated Overscan areas aren't set by any Android product anymore.
Dianne Hackbornc652de82013-02-15 16:32:56 -08001461 */
Jorim Jaggif081f062019-10-24 16:24:54 +02001462 @Deprecated
Dianne Hackbornc652de82013-02-15 16:32:56 -08001463 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1464
John Spurlockbd957402013-10-03 11:38:39 -04001465 /**
1466 * Window flag: request a translucent status bar with minimal system-provided
1467 * background protection.
1468 *
1469 * <p>This flag can be controlled in your theme through the
1470 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1471 * is automatically set for you in the standard translucent decor themes
1472 * such as
1473 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1474 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1475 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1476 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1477 *
1478 * <p>When this flag is enabled for a window, it automatically sets
1479 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1480 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001481 *
1482 * <p>Note: For devices that support
1483 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag may be ignored.
John Spurlockbd957402013-10-03 11:38:39 -04001484 */
1485 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1486
1487 /**
1488 * Window flag: request a translucent navigation bar with minimal system-provided
1489 * background protection.
1490 *
1491 * <p>This flag can be controlled in your theme through the
1492 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1493 * is automatically set for you in the standard translucent decor themes
1494 * such as
1495 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1496 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1497 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1498 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1499 *
1500 * <p>When this flag is enabled for a window, it automatically sets
1501 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1502 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001503 *
1504 * <p>Note: For devices that support
1505 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag can be disabled
1506 * by the car manufacturers.
John Spurlockbd957402013-10-03 11:38:39 -04001507 */
1508 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1509
Adam Lesinski6a591f52013-10-01 18:11:17 -07001510 /**
1511 * Flag for a window in local focus mode.
1512 * Window in local focus mode can control focus independent of window manager using
1513 * {@link Window#setLocalFocus(boolean, boolean)}.
1514 * Usually window in this mode will not get touch/key events from window manager, but will
1515 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1516 */
1517 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1518
Jeff Brown98db5fa2011-06-08 15:37:10 -07001519 /** Window flag: Enable touches to slide out of a window into neighboring
1520 * windows in mid-gesture instead of being captured for the duration of
1521 * the gesture.
1522 *
1523 * This flag changes the behavior of touch focus for this window only.
1524 * Touches can slide out of the window but they cannot necessarily slide
1525 * back in (unless the other window with touch focus permits it).
1526 *
1527 * {@hide}
1528 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001529 @UnsupportedAppUsage
Adam Lesinski6a591f52013-10-01 18:11:17 -07001530 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001531
Daniel Sandlere02d8082010-10-08 15:13:22 -04001532 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001533 * Window flag: When requesting layout with an attached window, the attached window may
1534 * overlap with the screen decorations of the parent window such as the navigation bar. By
1535 * including this flag, the window manager will layout the attached window within the decor
1536 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001537 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001538 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001539
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001540 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001541 * Flag indicating that this Window is responsible for drawing the background for the
1542 * system bars. If set, the system bars are drawn with a transparent background and the
1543 * corresponding areas in this window are filled with the colors specified in
1544 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1545 */
1546 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1547
1548 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001549 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001550 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001551 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1552 * @see #FLAG_DIM_BEHIND
1553 * @see #FLAG_NOT_FOCUSABLE
1554 * @see #FLAG_NOT_TOUCHABLE
1555 * @see #FLAG_NOT_TOUCH_MODAL
1556 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1557 * @see #FLAG_KEEP_SCREEN_ON
1558 * @see #FLAG_LAYOUT_IN_SCREEN
1559 * @see #FLAG_LAYOUT_NO_LIMITS
1560 * @see #FLAG_FULLSCREEN
1561 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001562 * @see #FLAG_SECURE
1563 * @see #FLAG_SCALED
1564 * @see #FLAG_IGNORE_CHEEK_PRESSES
1565 * @see #FLAG_LAYOUT_INSET_DECOR
1566 * @see #FLAG_ALT_FOCUSABLE_IM
1567 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1568 * @see #FLAG_SHOW_WHEN_LOCKED
1569 * @see #FLAG_SHOW_WALLPAPER
1570 * @see #FLAG_TURN_SCREEN_ON
1571 * @see #FLAG_DISMISS_KEYGUARD
1572 * @see #FLAG_SPLIT_TOUCH
1573 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001574 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001575 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001576 */
1577 @ViewDebug.ExportedProperty(flagMapping = {
1578 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001579 name = "ALLOW_LOCK_WHILE_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001580 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001581 name = "DIM_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001582 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001583 name = "BLUR_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001584 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001585 name = "NOT_FOCUSABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001586 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001587 name = "NOT_TOUCHABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001588 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001589 name = "NOT_TOUCH_MODAL"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001590 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001591 name = "TOUCHABLE_WHEN_WAKING"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001592 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001593 name = "KEEP_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001594 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001595 name = "LAYOUT_IN_SCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001596 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001597 name = "LAYOUT_NO_LIMITS"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001598 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001599 name = "FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001600 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001601 name = "FORCE_NOT_FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001602 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001603 name = "DITHER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001604 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001605 name = "SECURE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001606 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001607 name = "SCALED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001608 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001609 name = "IGNORE_CHEEK_PRESSES"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001610 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001611 name = "LAYOUT_INSET_DECOR"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001612 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001613 name = "ALT_FOCUSABLE_IM"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001614 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001615 name = "WATCH_OUTSIDE_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001616 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001617 name = "SHOW_WHEN_LOCKED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001618 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001619 name = "SHOW_WALLPAPER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001620 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001621 name = "TURN_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001622 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001623 name = "DISMISS_KEYGUARD"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001624 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001625 name = "SPLIT_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001626 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001627 name = "HARDWARE_ACCELERATED"),
1628 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN,
1629 name = "LOCAL_FOCUS_MODE"),
John Spurlockbd957402013-10-03 11:38:39 -04001630 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001631 name = "TRANSLUCENT_STATUS"),
John Spurlockbd957402013-10-03 11:38:39 -04001632 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001633 name = "TRANSLUCENT_NAVIGATION"),
1634 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
1635 name = "LOCAL_FOCUS_MODE"),
1636 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY,
1637 name = "FLAG_SLIPPERY"),
1638 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR,
1639 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"),
Adrian Roos217ccd22014-05-09 14:29:04 +02001640 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001641 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001642 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001643 public int flags;
1644
1645 /**
John Reck61375a82014-09-18 19:27:48 +00001646 * If the window has requested hardware acceleration, but this is not
1647 * allowed in the process it is in, then still render it as if it is
1648 * hardware accelerated. This is used for the starting preview windows
1649 * in the system process, which don't need to have the overhead of
1650 * hardware acceleration (they are just a static rendering), but should
1651 * be rendered as such to match the actual window of the app even if it
1652 * is hardware accelerated.
1653 * Even if the window isn't hardware accelerated, still do its rendering
1654 * as if it was.
1655 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1656 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001657 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001658 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1659 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001660 *
John Reck61375a82014-09-18 19:27:48 +00001661 * @hide
1662 */
1663 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1664
1665 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001666 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001667 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001668 * If certain parts of the UI that really do want to use hardware
1669 * acceleration, this flag can be set to force it. This is basically
1670 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001671 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001672 * @hide
1673 */
1674 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1675
1676 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001677 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001678 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001679 * them (they do not affect the wallpaper scrolling operation) by calling
1680 * {@link
1681 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1682 *
1683 * @hide
1684 */
1685 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1686
Craig Mautner88400d32012-09-30 12:35:45 -07001687 /** In a multiuser system if this flag is set and the owner is a system process then this
1688 * window will appear on all user screens. This overrides the default behavior of window
1689 * types that normally only appear on the owning user's screen. Refer to each window type
1690 * to determine its default behavior.
1691 *
1692 * {@hide} */
Roshan Piusa3f89c62019-10-11 08:50:53 -07001693 @SystemApi
1694 @RequiresPermission(permission.INTERNAL_SYSTEM_WINDOW)
1695 public static final int SYSTEM_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
Craig Mautner88400d32012-09-30 12:35:45 -07001696
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001697 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001698 * Never animate position changes of the window.
1699 *
Robert Carrb48380a2017-04-04 14:56:37 -07001700 * {@hide}
1701 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00001702 @UnsupportedAppUsage
Robert Carrb48380a2017-04-04 14:56:37 -07001703 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001704 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1705
Adam Lesinski6a591f52013-10-01 18:11:17 -07001706 /** Window flag: special flag to limit the size of the window to be
1707 * original size ([320x480] x density). Used to create window for applications
1708 * running under compatibility mode.
1709 *
1710 * {@hide} */
1711 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1712
1713 /** Window flag: a special option intended for system dialogs. When
1714 * this flag is set, the window will demand focus unconditionally when
1715 * it is created.
1716 * {@hide} */
1717 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1718
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001719 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001720 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1721 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1722 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1723 * {@hide}
1724 */
1725 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1726
1727 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001728 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1729 *
1730 * {@hide}
1731 */
1732 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1733
1734 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001735 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1736 * this flag is set it will be shown again and the bar will have a transparent background.
1737 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1738 *
1739 * {@hide}
1740 */
1741 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1742
1743 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001744 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001745 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001746 * because they are being managed externally through repositionChild.
1747 *
1748 * {@hide}
1749 */
1750 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1751
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001752 /**
1753 * Flag that will make window ignore app visibility and instead depend purely on the decor
1754 * view visibility for determining window visibility. This is used by recents to keep
1755 * drawing after it launches an app.
1756 * @hide
1757 */
1758 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1759
Robert Carra1eb4392015-12-10 12:43:51 -08001760 /**
1761 * Flag to indicate that this window is not expected to be replaced across
1762 * configuration change triggered activity relaunches. In general the WindowManager
1763 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1764 * until the replacement is ready to show in order to prevent visual glitch. However
1765 * some windows, such as PopupWindows expect to be cleared across configuration change,
1766 * and thus should hint to the WindowManager that it should not wait for a replacement.
1767 * @hide
1768 */
1769 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001770
1771 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001772 * Flag to indicate that this child window should always be laid-out in the parent
1773 * frame regardless of the current windowing mode configuration.
1774 * @hide
1775 */
1776 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1777
1778 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001779 * Flag to indicate that this window is always drawing the status bar background, no matter
1780 * what the other flags are.
1781 * @hide
1782 */
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001783 public static final int PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS = 0x00020000;
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001784
1785 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001786 * Flag to indicate that this window needs Sustained Performance Mode if
1787 * the device supports it.
1788 * @hide
1789 */
John Reck60e885f2016-04-21 15:40:45 -07001790 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001791
1792 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001793 * Flag to indicate that any window added by an application process that is of type
1794 * {@link #TYPE_TOAST} or that requires
1795 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1796 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001797 * @hide
1798 */
Philip P. Moltmannd66dd992018-09-17 11:26:04 -07001799 @SystemApi
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001800 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001801 public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001802
1803 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001804 * Indicates that this window is the rounded corners overlay present on some
1805 * devices this means that it will be excluded from: screenshots,
1806 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001807 * @hide
1808 */
Robert Carr132c9f52017-07-31 17:02:30 -07001809 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001810
1811 /**
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001812 * Flag to indicate that this window should be considered a screen decoration similar to the
1813 * nav bar and status bar. This will cause this window to affect the window insets reported
1814 * to other windows when it is visible.
1815 * @hide
1816 */
1817 @RequiresPermission(permission.STATUS_BAR_SERVICE)
1818 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
1819
1820 /**
Tiger Huanga90dea42018-08-03 17:20:17 +08001821 * Flag to indicate that the status bar window is in a state such that it forces showing
1822 * the navigation bar unless the navigation bar window is explicitly set to
1823 * {@link View#GONE}.
1824 * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}.
Tiger Huang34046012018-06-29 15:26:52 +08001825 * @hide
1826 */
Tiger Huanga90dea42018-08-03 17:20:17 +08001827 public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
Tiger Huang34046012018-06-29 15:26:52 +08001828
1829 /**
Peiyong Lin75045382019-03-04 19:22:33 -08001830 * Flag to indicate that the window is color space agnostic, and the color can be
1831 * interpreted to any color space.
1832 * @hide
1833 */
1834 public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000;
1835
1836 /**
Robert Carr48ec4e02019-07-16 14:28:47 -07001837 * Flag to request creation of a BLAST (Buffer as LayerState) Layer.
1838 * If not specified the client will receive a BufferQueue layer.
1839 * @hide
1840 */
1841 public static final int PRIVATE_FLAG_USE_BLAST = 0x02000000;
1842
1843 /**
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001844 * An internal annotation for flags that can be specified to {@link #softInputMode}.
1845 *
1846 * @hide
1847 */
1848 @SystemApi
1849 @Retention(RetentionPolicy.SOURCE)
1850 @IntDef(flag = true, prefix = { "SYSTEM_FLAG_" }, value = {
1851 SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Roshan Piusa3f89c62019-10-11 08:50:53 -07001852 SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001853 })
1854 public @interface SystemFlags {}
1855
1856 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001857 * Control flags that are private to the platform.
1858 * @hide
1859 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00001860 @UnsupportedAppUsage
Jorim Jaggi484851b2017-09-22 16:03:27 +02001861 @ViewDebug.ExportedProperty(flagMapping = {
1862 @ViewDebug.FlagToString(
1863 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1864 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1865 name = "FAKE_HARDWARE_ACCELERATED"),
1866 @ViewDebug.FlagToString(
1867 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1868 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1869 name = "FORCE_HARDWARE_ACCELERATED"),
1870 @ViewDebug.FlagToString(
1871 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1872 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1873 name = "WANTS_OFFSET_NOTIFICATIONS"),
1874 @ViewDebug.FlagToString(
Roshan Piusa3f89c62019-10-11 08:50:53 -07001875 mask = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
1876 equals = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001877 name = "SHOW_FOR_ALL_USERS"),
1878 @ViewDebug.FlagToString(
1879 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1880 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1881 name = "NO_MOVE_ANIMATION"),
1882 @ViewDebug.FlagToString(
1883 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1884 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1885 name = "COMPATIBLE_WINDOW"),
1886 @ViewDebug.FlagToString(
1887 mask = PRIVATE_FLAG_SYSTEM_ERROR,
1888 equals = PRIVATE_FLAG_SYSTEM_ERROR,
1889 name = "SYSTEM_ERROR"),
1890 @ViewDebug.FlagToString(
Jorim Jaggi484851b2017-09-22 16:03:27 +02001891 mask = PRIVATE_FLAG_KEYGUARD,
1892 equals = PRIVATE_FLAG_KEYGUARD,
1893 name = "KEYGUARD"),
1894 @ViewDebug.FlagToString(
1895 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1896 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1897 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"),
1898 @ViewDebug.FlagToString(
1899 mask = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1900 equals = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1901 name = "FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"),
1902 @ViewDebug.FlagToString(
1903 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1904 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1905 name = "PRESERVE_GEOMETRY"),
1906 @ViewDebug.FlagToString(
1907 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1908 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1909 name = "FORCE_DECOR_VIEW_VISIBILITY"),
1910 @ViewDebug.FlagToString(
1911 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1912 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1913 name = "WILL_NOT_REPLACE_ON_RELAUNCH"),
1914 @ViewDebug.FlagToString(
1915 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1916 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1917 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
1918 @ViewDebug.FlagToString(
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001919 mask = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
1920 equals = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001921 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
1922 @ViewDebug.FlagToString(
1923 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1924 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1925 name = "SUSTAINED_PERFORMANCE_MODE"),
1926 @ViewDebug.FlagToString(
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001927 mask = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1928 equals = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001929 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"),
1930 @ViewDebug.FlagToString(
1931 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1932 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1933 name = "IS_ROUNDED_CORNERS_OVERLAY"),
1934 @ViewDebug.FlagToString(
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001935 mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
1936 equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
Tiger Huang34046012018-06-29 15:26:52 +08001937 name = "IS_SCREEN_DECOR"),
1938 @ViewDebug.FlagToString(
Tiger Huanga90dea42018-08-03 17:20:17 +08001939 mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
1940 equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
Peiyong Lin75045382019-03-04 19:22:33 -08001941 name = "STATUS_FORCE_SHOW_NAVIGATION"),
1942 @ViewDebug.FlagToString(
1943 mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1944 equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1945 name = "COLOR_SPACE_AGNOSTIC")
Jorim Jaggi484851b2017-09-22 16:03:27 +02001946 })
Robert Carrb48380a2017-04-04 14:56:37 -07001947 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001948 public int privateFlags;
1949
1950 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001951 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1952 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1953 * key. For this case, we should look at windows behind it to determine the appropriate
1954 * value.
1955 *
1956 * @hide
1957 */
1958 public static final int NEEDS_MENU_UNSET = 0;
1959
1960 /**
1961 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1962 * menu key.
1963 *
1964 * @hide
1965 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001966 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001967 public static final int NEEDS_MENU_SET_TRUE = 1;
1968
1969 /**
1970 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1971 * needs a menu key.
1972 *
1973 * @hide
1974 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001975 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001976 public static final int NEEDS_MENU_SET_FALSE = 2;
1977
1978 /**
1979 * State variable for a window belonging to an activity that responds to
1980 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1981 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1982 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1983 *
1984 * (Note that Action Bars, when available, are the preferred way to offer additional
1985 * functions otherwise accessed via an options menu.)
1986 *
1987 * {@hide}
1988 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001989 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001990 public int needsMenuKey = NEEDS_MENU_UNSET;
1991
1992 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001993 * Given a particular set of window manager flags, determine whether
1994 * such a window may be a target for an input method when it has
1995 * focus. In particular, this checks the
1996 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1997 * flags and returns true if the combination of the two corresponds
1998 * to a window that needs to be behind the input method so that the
1999 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002000 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002001 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002002 *
Andrew Chant17c896e2019-12-05 22:39:02 +00002003 * @return Returns true if such a window should be behind/interact
2004 * with an input method, false if not.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002005 */
2006 public static boolean mayUseInputMethod(int flags) {
Andrew Chant17c896e2019-12-05 22:39:02 +00002007 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
2008 case 0:
2009 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
2010 return true;
2011 }
2012 return false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002013 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002015 /**
2016 * Mask for {@link #softInputMode} of the bits that determine the
2017 * desired visibility state of the soft input area for this window.
2018 */
2019 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002020
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002021 /**
Yohei Yukawaa7547852018-03-27 15:47:45 -07002022 * Visibility state for {@link #softInputMode}: no state has been specified. The system may
2023 * show or hide the software keyboard for better user experience when the window gains
2024 * focus.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002025 */
2026 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002027
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002028 /**
2029 * Visibility state for {@link #softInputMode}: please don't change the state of
2030 * the soft input area.
2031 */
2032 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002033
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002034 /**
2035 * Visibility state for {@link #softInputMode}: please hide any soft input
2036 * area when normally appropriate (when the user is navigating
2037 * forward to your window).
2038 */
2039 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002040
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002041 /**
2042 * Visibility state for {@link #softInputMode}: please always hide any
2043 * soft input area when this window receives focus.
2044 */
2045 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002047 /**
2048 * Visibility state for {@link #softInputMode}: please show the soft
2049 * input area when normally appropriate (when the user is navigating
2050 * forward to your window).
Yohei Yukawacf68d522017-12-12 09:33:26 -08002051 *
2052 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2053 * is ignored unless there is a focused view that returns {@code true} from
2054 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002055 */
2056 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002057
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002058 /**
2059 * Visibility state for {@link #softInputMode}: please always make the
2060 * soft input area visible when this window receives input focus.
Yohei Yukawacf68d522017-12-12 09:33:26 -08002061 *
2062 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2063 * is ignored unless there is a focused view that returns {@code true} from
2064 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 */
2066 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002068 /**
2069 * Mask for {@link #softInputMode} of the bits that determine the
2070 * way that the window should be adjusted to accommodate the soft
2071 * input window.
2072 */
2073 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002075 /** Adjustment option for {@link #softInputMode}: nothing specified.
2076 * The system will try to pick one or
2077 * the other depending on the contents of the window.
2078 */
2079 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002081 /** Adjustment option for {@link #softInputMode}: set to allow the
2082 * window to be resized when an input
2083 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07002084 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002085 * {@link #SOFT_INPUT_ADJUST_PAN}; if
2086 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07002087 * the other depending on the contents of the window. If the window's
2088 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
2089 * value for {@link #softInputMode} will be ignored; the window will
2090 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002091 */
2092 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002094 /** Adjustment option for {@link #softInputMode}: set to have a window
2095 * pan when an input method is
2096 * shown, so it doesn't need to deal with resizing but just panned
2097 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07002098 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002099 * neither of these are set, then the system will try to pick one or
2100 * the other depending on the contents of the window.
2101 */
2102 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002103
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002104 /** Adjustment option for {@link #softInputMode}: set to have a window
2105 * not adjust for a shown input method. The window will not be resized,
2106 * and it will not be panned to make its focus visible.
2107 */
2108 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
2109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002110 /**
2111 * Bit for {@link #softInputMode}: set when the user has navigated
2112 * forward to the window. This is normally set automatically for
2113 * you by the system, though you may want to set it in certain cases
2114 * when you are displaying a window yourself. This flag will always
2115 * be cleared automatically after the window is displayed.
2116 */
2117 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002118
2119 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002120 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2121 *
2122 * @hide
2123 */
2124 @Retention(RetentionPolicy.SOURCE)
Jeff Sharkeyce8db992017-12-13 20:05:05 -07002125 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = {
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002126 SOFT_INPUT_STATE_UNSPECIFIED,
2127 SOFT_INPUT_STATE_UNCHANGED,
2128 SOFT_INPUT_STATE_HIDDEN,
2129 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
2130 SOFT_INPUT_STATE_VISIBLE,
2131 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
2132 SOFT_INPUT_ADJUST_UNSPECIFIED,
2133 SOFT_INPUT_ADJUST_RESIZE,
2134 SOFT_INPUT_ADJUST_PAN,
2135 SOFT_INPUT_ADJUST_NOTHING,
2136 SOFT_INPUT_IS_FORWARD_NAVIGATION,
2137 })
2138 public @interface SoftInputModeFlags {}
2139
2140 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08002141 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002142 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002143 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002144 * <ul>
2145 * <li> One of the visibility states
2146 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002147 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
2148 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002149 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002150 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
2151 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08002152 * </ul>
2153 *
2154 *
2155 * <p>This flag can be controlled in your theme through the
2156 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002157 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002158 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002159 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002160
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002161 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002162 * Placement of window within the screen as per {@link Gravity}. Both
2163 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2164 * android.graphics.Rect) Gravity.apply} and
2165 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2166 * Gravity.applyDisplay} are used during window layout, with this value
2167 * given as the desired gravity. For example you can specify
2168 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
2169 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
2170 * to control the behavior of
2171 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2172 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002173 *
2174 * @see Gravity
2175 */
2176 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002177
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002178 /**
2179 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002180 * between the container and the widget. See
2181 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2182 * android.graphics.Rect) Gravity.apply} for how this is used. This
2183 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002184 */
2185 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002187 /**
2188 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002189 * between the container and the widget. See
2190 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2191 * android.graphics.Rect) Gravity.apply} for how this is used. This
2192 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002193 */
2194 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002195
2196 /**
2197 * Positive insets between the drawing surface and window content.
2198 *
2199 * @hide
2200 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07002201 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08002202
2203 /**
2204 * Whether the surface insets have been manually set. When set to
2205 * {@code false}, the view root will automatically determine the
2206 * appropriate surface insets.
2207 *
2208 * @see #surfaceInsets
2209 * @hide
2210 */
2211 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002213 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07002214 * Whether the previous surface insets should be used vs. what is currently set. When set
2215 * to {@code true}, the view root will ignore surfaces insets in this object and use what
2216 * it currently has.
2217 *
2218 * @see #surfaceInsets
2219 * @hide
2220 */
2221 public boolean preservePreviousSurfaceInsets = true;
2222
2223 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002224 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08002225 * {@link android.graphics.PixelFormat}. The choice of format
2226 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002227 */
2228 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002229
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 /**
2231 * A style resource defining the animations to use for this window.
2232 * This must be a system resource; it can not be an application resource
2233 * because the window manager does not have access to applications.
2234 */
2235 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002237 /**
2238 * An alpha value to apply to this entire window.
2239 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
2240 */
2241 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002242
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243 /**
2244 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
2245 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
2246 * dim.
2247 */
2248 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002249
2250 /**
2251 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
2252 * indicating that the brightness value is not overridden for this window
2253 * and normal brightness policy should be used.
2254 */
2255 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
2256
2257 /**
2258 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2259 * indicating that the screen or button backlight brightness should be set
2260 * to the lowest value when this window is in front.
2261 */
2262 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
2263
2264 /**
2265 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2266 * indicating that the screen or button backlight brightness should be set
2267 * to the hightest value when this window is in front.
2268 */
2269 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002271 /**
2272 * This can be used to override the user's preferred brightness of
2273 * the screen. A value of less than 0, the default, means to use the
2274 * preferred screen brightness. 0 to 1 adjusts the brightness from
2275 * dark to full bright.
2276 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002277 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002278
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002279 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002280 * This can be used to override the standard behavior of the button and
2281 * keyboard backlights. A value of less than 0, the default, means to
2282 * use the standard backlight behavior. 0 to 1 adjusts the brightness
2283 * from dark to full bright.
2284 */
2285 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
2286
2287 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07002288 * Unspecified value for {@link #rotationAnimation} indicating
2289 * a lack of preference.
2290 * @hide
2291 */
2292 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
2293
2294 /**
Robert Carr652aae42016-10-17 16:48:14 -07002295 * Value for {@link #rotationAnimation} which specifies that this
2296 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002297 */
2298 public static final int ROTATION_ANIMATION_ROTATE = 0;
2299
2300 /**
Robert Carr652aae42016-10-17 16:48:14 -07002301 * Value for {@link #rotationAnimation} which specifies that this
2302 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002303 */
2304 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
2305
2306 /**
Robert Carr652aae42016-10-17 16:48:14 -07002307 * Value for {@link #rotationAnimation} which specifies that this window
2308 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002309 */
2310 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
2311
2312 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07002313 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
2314 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07002315 * can't be applied without pausing the screen. For example, this is ideal
2316 * for Camera apps which don't want the viewfinder contents to ever rotate
2317 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
2318 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07002319 */
2320 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
2321
2322 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002323 * Define the exit and entry animations used on this window when the device is rotated.
2324 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08002325 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002326 * by other windows. All other situations default to the
2327 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002328 *
Craig Mautner3c174372013-02-21 17:54:37 -08002329 * @see #ROTATION_ANIMATION_ROTATE
2330 * @see #ROTATION_ANIMATION_CROSSFADE
2331 * @see #ROTATION_ANIMATION_JUMPCUT
2332 */
2333 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
2334
2335 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 * Identifier for this window. This will usually be filled in for
2337 * you.
2338 */
2339 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002341 /**
2342 * Name of the package owning this window.
2343 */
2344 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002346 /**
2347 * Specific orientation value for a window.
2348 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002349 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
2350 * If not set, a default value of
2351 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002352 * will be used.
2353 */
2354 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08002355
2356 /**
Michael Wright3f145a22014-07-22 19:46:03 -07002357 * The preferred refresh rate for the window.
2358 *
2359 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002360 * is on. The selected refresh rate will be applied to the display's default mode.
2361 *
2362 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07002363 *
2364 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002365 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07002366 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002367 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07002368 public float preferredRefreshRate;
2369
2370 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002371 * Id of the preferred display mode for the window.
2372 * <p>
2373 * This must be one of the supported modes obtained for the display(s) the window is on.
2374 * A value of {@code 0} means no preference.
2375 *
2376 * @see Display#getSupportedModes()
2377 * @see Display.Mode#getModeId()
2378 */
2379 public int preferredDisplayModeId;
2380
2381 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002382 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08002383 *
2384 * @see View#STATUS_BAR_VISIBLE
2385 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08002386 */
2387 public int systemUiVisibility;
2388
2389 /**
Joe Onorato14782f72011-01-25 19:53:17 -08002390 * @hide
2391 * The ui visibility as requested by the views in this hierarchy.
2392 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
2393 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002394 @UnsupportedAppUsage
Joe Onorato14782f72011-01-25 19:53:17 -08002395 public int subtreeSystemUiVisibility;
2396
2397 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002398 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002399 *
Joe Onorato664644d2011-01-23 17:53:23 -08002400 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
2401 *
2402 * @hide
2403 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002404 @UnsupportedAppUsage
Joe Onorato664644d2011-01-23 17:53:23 -08002405 public boolean hasSystemUiListeners;
2406
Adrian Roosfa02da62018-01-15 16:01:18 +01002407
2408 /** @hide */
2409 @Retention(RetentionPolicy.SOURCE)
2410 @IntDef(
2411 flag = true,
2412 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
Adrian Roos87526af2018-03-27 16:36:25 +02002413 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
Adrian Roosfa02da62018-01-15 16:01:18 +01002414 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER})
2415 @interface LayoutInDisplayCutoutMode {}
2416
2417 /**
2418 * Controls how the window is laid out if there is a {@link DisplayCutout}.
2419 *
2420 * <p>
2421 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}.
2422 *
2423 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
Adrian Roos87526af2018-03-27 16:36:25 +02002424 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Adrian Roosfa02da62018-01-15 16:01:18 +01002425 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
2426 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002427 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2428 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002429 */
2430 @LayoutInDisplayCutoutMode
2431 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
2432
2433 /**
2434 * The window is allowed to extend into the {@link DisplayCutout} area, only if the
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002435 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is
Adrian Roosfa02da62018-01-15 16:01:18 +01002436 * laid out such that it does not overlap with the {@link DisplayCutout} area.
2437 *
2438 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002439 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or
2440 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait
2441 * if the cutout is at the top edge. Similarly for
2442 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen.
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002443 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the
Adrian Roosfa02da62018-01-15 16:01:18 +01002444 * cutout area.
2445 *
2446 * <p>
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002447 * The usual precautions for not overlapping with the status and navigation bar are
2448 * sufficient for ensuring that no important content overlaps with the DisplayCutout.
Adrian Roosfa02da62018-01-15 16:01:18 +01002449 *
2450 * @see DisplayCutout
2451 * @see WindowInsets
Adrian Roos87526af2018-03-27 16:36:25 +02002452 * @see #layoutInDisplayCutoutMode
2453 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2454 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002455 */
2456 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;
2457
2458 /**
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002459 * @deprecated use {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES}
2460 * @hide
2461 */
2462 @Deprecated
2463 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 1;
2464
2465 /**
2466 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
2467 * edges of the screen.
2468 *
2469 * The window will never extend into a {@link DisplayCutout} area on the long edges of the
2470 * screen.
Adrian Roosfa02da62018-01-15 16:01:18 +01002471 *
2472 * <p>
2473 * The window must make sure that no important content overlaps with the
2474 * {@link DisplayCutout}.
2475 *
Adrian Roosad1da312018-03-27 19:17:50 +02002476 * <p>
2477 * In this mode, the window extends under cutouts on the short edge of the display in both
2478 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/>
2479 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png"
2480 * height="720"
2481 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in
2482 * portrait, no letterbox is applied."/>
2483 *
2484 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png"
2485 * width="720"
2486 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape,
2487 * no letterbox is applied."/>
2488 *
2489 * <p>
2490 * A cutout in the corner is considered to be on the short edge: <br/>
2491 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png"
2492 * height="720"
2493 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in
2494 * portrait, no letterbox is applied."/>
2495 *
2496 * <p>
2497 * On the other hand, should the cutout be on the long edge of the display, a letterbox will
2498 * be applied such that the window does not extend into the cutout on either long edge:
2499 * <br/>
2500 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png"
2501 * height="720"
2502 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait,
2503 * letterbox is applied."/>
2504 *
Adrian Roosfa02da62018-01-15 16:01:18 +01002505 * @see DisplayCutout
2506 * @see WindowInsets#getDisplayCutout()
Adrian Roos87526af2018-03-27 16:36:25 +02002507 * @see #layoutInDisplayCutoutMode
2508 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2509 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002510 */
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002511 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1;
Adrian Roosfa02da62018-01-15 16:01:18 +01002512
2513 /**
2514 * The window is never allowed to overlap with the DisplayCutout area.
2515 *
2516 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002517 * This should be used with windows that transiently set
2518 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION}
2519 * to avoid a relayout of the window when the respective flag is set or cleared.
Adrian Roosfa02da62018-01-15 16:01:18 +01002520 *
2521 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002522 * @see #layoutInDisplayCutoutMode
2523 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2524 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002525 */
2526 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;
2527
2528
Jeff Brown474dcb52011-06-14 20:22:50 -07002529 /**
2530 * When this window has focus, disable touch pad pointer gesture processing.
2531 * The window will receive raw position updates from the touch pad instead
2532 * of pointer movements and synthetic touch events.
2533 *
2534 * @hide
2535 */
2536 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
2537
2538 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07002539 * Does not construct an input channel for this window. The channel will therefore
2540 * be incapable of receiving input.
2541 *
2542 * @hide
2543 */
2544 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
2545
2546 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002547 * When this window has focus, does not call user activity for all input events so
2548 * the application will have to do it itself. Should only be used by
2549 * the keyguard and phone app.
2550 * <p>
2551 * Should only be used by the keyguard and phone app.
2552 * </p>
2553 *
2554 * @hide
2555 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002556 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002557 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
2558
2559 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07002560 * Control special features of the input subsystem.
2561 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002562 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07002563 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002564 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07002565 * @hide
2566 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002567 @UnsupportedAppUsage
Jeff Brown474dcb52011-06-14 20:22:50 -07002568 public int inputFeatures;
2569
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002570 /**
2571 * Sets the number of milliseconds before the user activity timeout occurs
2572 * when this window has focus. A value of -1 uses the standard timeout.
2573 * A value of 0 uses the minimum support display timeout.
2574 * <p>
2575 * This property can only be used to reduce the user specified display timeout;
2576 * it can never make the timeout longer than it normally would be.
2577 * </p><p>
2578 * Should only be used by the keyguard and phone app.
2579 * </p>
2580 *
2581 * @hide
2582 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002583 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002584 public long userActivityTimeout = -1;
2585
Phil Weaver396d5492016-03-22 17:53:50 -07002586 /**
2587 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
2588 * window.
2589 *
2590 * @hide
2591 */
Phil Weaver8583ae82018-02-13 11:01:24 -08002592 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
Phil Weaver396d5492016-03-22 17:53:50 -07002593
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002594 /**
2595 * The window title isn't kept in sync with what is displayed in the title bar, so we
2596 * separately track the currently shown title to provide to accessibility.
2597 *
2598 * @hide
2599 */
Alan Viverette39259dd2017-05-25 11:10:46 -04002600 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002601 public CharSequence accessibilityTitle;
2602
Robert Carr70f0d222016-04-10 16:33:08 -07002603 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002604 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07002605 * by the window manager. Useful for transient notifications like toasts
2606 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002607 * is hidden. Must be specified at window creation time. Note that apps
2608 * are not prepared to handle their windows being removed without their
2609 * explicit request and may try to interact with the removed window
2610 * resulting in undefined behavior and crashes. Therefore, we do hide
2611 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07002612 *
2613 * @hide
2614 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002615 @UnsupportedAppUsage
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002616 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07002617
Romain Guy48327452017-01-23 17:03:35 -08002618 /**
2619 * The color mode requested by this window. The target display may
2620 * not be able to honor the request. When the color mode is not set
2621 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
2622 * pixel format specified in {@link #format}.
2623 *
2624 * @hide
2625 */
2626 @ActivityInfo.ColorMode
Jorim Jaggi484851b2017-09-22 16:03:27 +02002627 private int mColorMode = COLOR_MODE_DEFAULT;
Romain Guy48327452017-01-23 17:03:35 -08002628
Jorim Jaggib7848b72018-12-28 14:38:21 +01002629 /**
2630 * Carries the requests about {@link WindowInsetsController.Appearance} and
2631 * {@link WindowInsetsController.Behavior} to the system windows which can produce insets.
2632 *
2633 * @hide
2634 */
2635 public final InsetsFlags insetsFlags = new InsetsFlags();
2636
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08002638 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 type = TYPE_APPLICATION;
2640 format = PixelFormat.OPAQUE;
2641 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002642
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08002644 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002645 type = _type;
2646 format = PixelFormat.OPAQUE;
2647 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002648
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002649 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08002650 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002651 type = _type;
2652 flags = _flags;
2653 format = PixelFormat.OPAQUE;
2654 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002655
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002657 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 type = _type;
2659 flags = _flags;
2660 format = _format;
2661 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002663 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2664 super(w, h);
2665 type = _type;
2666 flags = _flags;
2667 format = _format;
2668 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002670 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2671 int _flags, int _format) {
2672 super(w, h);
2673 x = xpos;
2674 y = ypos;
2675 type = _type;
2676 flags = _flags;
2677 format = _format;
2678 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002679
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002680 public final void setTitle(CharSequence title) {
2681 if (null == title)
2682 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002683
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002684 mTitle = TextUtils.stringOrSpannedString(title);
2685 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002686
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002688 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002690
Wale Ogunwale246c2092016-04-07 14:12:44 -07002691 /**
2692 * Sets the surface insets based on the elevation (visual z position) of the input view.
2693 * @hide
2694 */
2695 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
2696 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07002697 // Partial workaround for b/28318973. Every inset change causes a freeform window
2698 // to jump a little for a few frames. If we never allow surface insets to decrease,
2699 // they will stabilize quickly (often from the very beginning, as most windows start
2700 // as focused).
2701 // TODO(b/22668382) to fix this properly.
2702 if (surfaceInset == 0) {
2703 // OK to have 0 (this is the case for non-freeform windows).
2704 surfaceInsets.set(0, 0, 0, 0);
2705 } else {
2706 surfaceInsets.set(
2707 Math.max(surfaceInset, surfaceInsets.left),
2708 Math.max(surfaceInset, surfaceInsets.top),
2709 Math.max(surfaceInset, surfaceInsets.right),
2710 Math.max(surfaceInset, surfaceInsets.bottom));
2711 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002712 hasManualSurfaceInsets = manual;
2713 preservePreviousSurfaceInsets = preservePrevious;
2714 }
2715
Romain Guy48327452017-01-23 17:03:35 -08002716 /**
2717 * <p>Set the color mode of the window. Setting the color mode might
2718 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
2719 *
2720 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2721 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
2722 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
2723 *
2724 * @see #getColorMode()
2725 */
2726 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
2727 mColorMode = colorMode;
2728 }
2729
2730 /**
2731 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2732 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
2733 *
2734 * @see #setColorMode(int)
2735 */
2736 @ActivityInfo.ColorMode
2737 public int getColorMode() {
2738 return mColorMode;
2739 }
2740
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002741 /** @hide */
2742 @SystemApi
2743 public final void setUserActivityTimeout(long timeout) {
2744 userActivityTimeout = timeout;
2745 }
2746
2747 /** @hide */
2748 @SystemApi
2749 public final long getUserActivityTimeout() {
2750 return userActivityTimeout;
2751 }
2752
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002753 public int describeContents() {
2754 return 0;
2755 }
2756
2757 public void writeToParcel(Parcel out, int parcelableFlags) {
2758 out.writeInt(width);
2759 out.writeInt(height);
2760 out.writeInt(x);
2761 out.writeInt(y);
2762 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002763 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002764 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 out.writeInt(softInputMode);
Adrian Roosfa02da62018-01-15 16:01:18 +01002766 out.writeInt(layoutInDisplayCutoutMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002767 out.writeInt(gravity);
2768 out.writeFloat(horizontalMargin);
2769 out.writeFloat(verticalMargin);
2770 out.writeInt(format);
2771 out.writeInt(windowAnimations);
2772 out.writeFloat(alpha);
2773 out.writeFloat(dimAmount);
2774 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002775 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08002776 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002777 out.writeStrongBinder(token);
2778 out.writeString(packageName);
2779 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
2780 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07002781 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002782 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08002783 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08002784 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08002785 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07002786 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002787 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07002788 out.writeInt(surfaceInsets.left);
2789 out.writeInt(surfaceInsets.top);
2790 out.writeInt(surfaceInsets.right);
2791 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08002792 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07002793 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002794 out.writeInt(needsMenuKey);
Phil Weaver8583ae82018-02-13 11:01:24 -08002795 out.writeLong(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002796 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07002797 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002798 out.writeLong(hideTimeoutMilliseconds);
Jorim Jaggib7848b72018-12-28 14:38:21 +01002799 out.writeInt(insetsFlags.appearance);
2800 out.writeInt(insetsFlags.behavior);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002801 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002802
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07002803 public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002804 = new Parcelable.Creator<LayoutParams>() {
2805 public LayoutParams createFromParcel(Parcel in) {
2806 return new LayoutParams(in);
2807 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002808
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002809 public LayoutParams[] newArray(int size) {
2810 return new LayoutParams[size];
2811 }
2812 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002813
2814
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002815 public LayoutParams(Parcel in) {
2816 width = in.readInt();
2817 height = in.readInt();
2818 x = in.readInt();
2819 y = in.readInt();
2820 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002822 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 softInputMode = in.readInt();
Adrian Roosfa02da62018-01-15 16:01:18 +01002824 layoutInDisplayCutoutMode = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002825 gravity = in.readInt();
2826 horizontalMargin = in.readFloat();
2827 verticalMargin = in.readFloat();
2828 format = in.readInt();
2829 windowAnimations = in.readInt();
2830 alpha = in.readFloat();
2831 dimAmount = in.readFloat();
2832 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002833 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08002834 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002835 token = in.readStrongBinder();
2836 packageName = in.readString();
2837 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
2838 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07002839 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002840 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002841 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08002842 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002843 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07002844 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002845 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07002846 surfaceInsets.left = in.readInt();
2847 surfaceInsets.top = in.readInt();
2848 surfaceInsets.right = in.readInt();
2849 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08002850 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07002851 preservePreviousSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002852 needsMenuKey = in.readInt();
Phil Weaver8583ae82018-02-13 11:01:24 -08002853 accessibilityIdOfAnchor = in.readLong();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002854 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07002855 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002856 hideTimeoutMilliseconds = in.readLong();
Jorim Jaggib7848b72018-12-28 14:38:21 +01002857 insetsFlags.appearance = in.readInt();
2858 insetsFlags.behavior = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002859 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002860
Romain Guy72998072009-06-22 11:09:20 -07002861 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 public static final int LAYOUT_CHANGED = 1<<0;
2863 public static final int TYPE_CHANGED = 1<<1;
2864 public static final int FLAGS_CHANGED = 1<<2;
2865 public static final int FORMAT_CHANGED = 1<<3;
2866 public static final int ANIMATION_CHANGED = 1<<4;
2867 public static final int DIM_AMOUNT_CHANGED = 1<<5;
2868 public static final int TITLE_CHANGED = 1<<6;
2869 public static final int ALPHA_CHANGED = 1<<7;
2870 public static final int MEMORY_TYPE_CHANGED = 1<<8;
2871 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
2872 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
2873 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08002874 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002875 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002876 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08002877 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002878 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08002879 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002880 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07002881 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002882 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002883 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002884 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07002885 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002886 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002887 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04002888 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
2889 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07002890 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002891 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07002892 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
2893 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002894 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
2895 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002896 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
2897 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07002898 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
2899 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04002900 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002901 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
2902 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07002903 public static final int COLOR_MODE_CHANGED = 1 << 26;
2904 /** {@hide} */
Jorim Jaggib7848b72018-12-28 14:38:21 +01002905 public static final int INSET_FLAGS_CHANGED = 1 << 27;
Romain Guyf21c9b02011-09-06 16:56:54 -07002906
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002907 // internal buffer to backup/restore parameters under compatibility mode.
2908 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002909
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 public final int copyFrom(LayoutParams o) {
2911 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002913 if (width != o.width) {
2914 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07002915 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002916 }
2917 if (height != o.height) {
2918 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07002919 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002920 }
2921 if (x != o.x) {
2922 x = o.x;
2923 changes |= LAYOUT_CHANGED;
2924 }
2925 if (y != o.y) {
2926 y = o.y;
2927 changes |= LAYOUT_CHANGED;
2928 }
2929 if (horizontalWeight != o.horizontalWeight) {
2930 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002931 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002932 }
2933 if (verticalWeight != o.verticalWeight) {
2934 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002935 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002936 }
2937 if (horizontalMargin != o.horizontalMargin) {
2938 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002939 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002940 }
2941 if (verticalMargin != o.verticalMargin) {
2942 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002943 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002944 }
2945 if (type != o.type) {
2946 type = o.type;
2947 changes |= TYPE_CHANGED;
2948 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002949 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04002950 final int diff = flags ^ o.flags;
2951 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
2952 changes |= TRANSLUCENT_FLAGS_CHANGED;
2953 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07002955 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002957 if (privateFlags != o.privateFlags) {
2958 privateFlags = o.privateFlags;
2959 changes |= PRIVATE_FLAGS_CHANGED;
2960 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 if (softInputMode != o.softInputMode) {
2962 softInputMode = o.softInputMode;
2963 changes |= SOFT_INPUT_MODE_CHANGED;
2964 }
Adrian Roosfa02da62018-01-15 16:01:18 +01002965 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) {
2966 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode;
2967 changes |= LAYOUT_CHANGED;
2968 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 if (gravity != o.gravity) {
2970 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07002971 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002972 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 if (format != o.format) {
2974 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07002975 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002976 }
2977 if (windowAnimations != o.windowAnimations) {
2978 windowAnimations = o.windowAnimations;
2979 changes |= ANIMATION_CHANGED;
2980 }
2981 if (token == null) {
2982 // NOTE: token only copied if the recipient doesn't
2983 // already have one.
2984 token = o.token;
2985 }
2986 if (packageName == null) {
2987 // NOTE: packageName only copied if the recipient doesn't
2988 // already have one.
2989 packageName = o.packageName;
2990 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08002991 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002992 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002993 mTitle = o.mTitle;
2994 changes |= TITLE_CHANGED;
2995 }
2996 if (alpha != o.alpha) {
2997 alpha = o.alpha;
2998 changes |= ALPHA_CHANGED;
2999 }
3000 if (dimAmount != o.dimAmount) {
3001 dimAmount = o.dimAmount;
3002 changes |= DIM_AMOUNT_CHANGED;
3003 }
3004 if (screenBrightness != o.screenBrightness) {
3005 screenBrightness = o.screenBrightness;
3006 changes |= SCREEN_BRIGHTNESS_CHANGED;
3007 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003008 if (buttonBrightness != o.buttonBrightness) {
3009 buttonBrightness = o.buttonBrightness;
3010 changes |= BUTTON_BRIGHTNESS_CHANGED;
3011 }
Craig Mautner3c174372013-02-21 17:54:37 -08003012 if (rotationAnimation != o.rotationAnimation) {
3013 rotationAnimation = o.rotationAnimation;
3014 changes |= ROTATION_ANIMATION_CHANGED;
3015 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003016
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 if (screenOrientation != o.screenOrientation) {
3018 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07003019 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 }
Romain Guy529b60a2010-08-03 18:05:47 -07003021
Michael Wright3f145a22014-07-22 19:46:03 -07003022 if (preferredRefreshRate != o.preferredRefreshRate) {
3023 preferredRefreshRate = o.preferredRefreshRate;
3024 changes |= PREFERRED_REFRESH_RATE_CHANGED;
3025 }
3026
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003027 if (preferredDisplayModeId != o.preferredDisplayModeId) {
3028 preferredDisplayModeId = o.preferredDisplayModeId;
3029 changes |= PREFERRED_DISPLAY_MODE_ID;
3030 }
3031
Joe Onorato14782f72011-01-25 19:53:17 -08003032 if (systemUiVisibility != o.systemUiVisibility
3033 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08003034 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08003035 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08003036 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
3037 }
3038
3039 if (hasSystemUiListeners != o.hasSystemUiListeners) {
3040 hasSystemUiListeners = o.hasSystemUiListeners;
3041 changes |= SYSTEM_UI_LISTENER_CHANGED;
3042 }
3043
Jeff Brown474dcb52011-06-14 20:22:50 -07003044 if (inputFeatures != o.inputFeatures) {
3045 inputFeatures = o.inputFeatures;
3046 changes |= INPUT_FEATURES_CHANGED;
3047 }
3048
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003049 if (userActivityTimeout != o.userActivityTimeout) {
3050 userActivityTimeout = o.userActivityTimeout;
3051 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
3052 }
3053
Alan Viverette49a22e82014-07-12 20:01:27 -07003054 if (!surfaceInsets.equals(o.surfaceInsets)) {
3055 surfaceInsets.set(o.surfaceInsets);
3056 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003057 }
3058
Alan Viverette5435a302015-01-29 10:25:34 -08003059 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
3060 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
3061 changes |= SURFACE_INSETS_CHANGED;
3062 }
3063
Wale Ogunwale246c2092016-04-07 14:12:44 -07003064 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
3065 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
3066 changes |= SURFACE_INSETS_CHANGED;
3067 }
3068
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003069 if (needsMenuKey != o.needsMenuKey) {
3070 needsMenuKey = o.needsMenuKey;
3071 changes |= NEEDS_MENU_KEY_CHANGED;
3072 }
3073
Phil Weaver396d5492016-03-22 17:53:50 -07003074 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
3075 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
3076 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
3077 }
3078
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003079 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
3080 && o.accessibilityTitle != null) {
3081 // NOTE: accessibilityTitle only copied if the originator set one.
3082 accessibilityTitle = o.accessibilityTitle;
3083 changes |= ACCESSIBILITY_TITLE_CHANGED;
3084 }
3085
Romain Guy26a2b972017-04-17 09:39:51 -07003086 if (mColorMode != o.mColorMode) {
3087 mColorMode = o.mColorMode;
3088 changes |= COLOR_MODE_CHANGED;
3089 }
3090
Robert Carr70f0d222016-04-10 16:33:08 -07003091 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003092 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07003093
Jorim Jaggib7848b72018-12-28 14:38:21 +01003094 if (insetsFlags.appearance != o.insetsFlags.appearance) {
3095 insetsFlags.appearance = o.insetsFlags.appearance;
3096 changes |= INSET_FLAGS_CHANGED;
3097 }
3098
3099 if (insetsFlags.behavior != o.insetsFlags.behavior) {
3100 insetsFlags.behavior = o.insetsFlags.behavior;
3101 changes |= INSET_FLAGS_CHANGED;
3102 }
3103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003104 return changes;
3105 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003107 @Override
3108 public String debug(String output) {
3109 output += "Contents of " + this + ":";
3110 Log.d("Debug", output);
3111 output = super.debug("");
3112 Log.d("Debug", output);
3113 Log.d("Debug", "");
3114 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
3115 return "";
3116 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003117
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003118 @Override
3119 public String toString() {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003120 return toString("");
3121 }
3122
3123 /**
3124 * @hide
3125 */
Felipe Lemeda9ea342018-03-22 15:19:51 -07003126 public void dumpDimensions(StringBuilder sb) {
3127 sb.append('(');
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 sb.append(x);
3129 sb.append(',');
3130 sb.append(y);
3131 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08003132 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
3133 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003134 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08003135 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
3136 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003137 sb.append(")");
Felipe Lemeda9ea342018-03-22 15:19:51 -07003138 }
3139
3140 /**
3141 * @hide
3142 */
3143 public String toString(String prefix) {
3144 StringBuilder sb = new StringBuilder(256);
3145 sb.append('{');
3146 dumpDimensions(sb);
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003147 if (horizontalMargin != 0) {
3148 sb.append(" hm=");
3149 sb.append(horizontalMargin);
3150 }
3151 if (verticalMargin != 0) {
3152 sb.append(" vm=");
3153 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003154 }
3155 if (gravity != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003156 sb.append(" gr=");
3157 sb.append(Gravity.toString(gravity));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003158 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003159 if (softInputMode != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003160 sb.append(" sim={");
3161 sb.append(softInputModeToString(softInputMode));
3162 sb.append('}');
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003163 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003164 if (layoutInDisplayCutoutMode != 0) {
3165 sb.append(" layoutInDisplayCutoutMode=");
3166 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode));
3167 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 sb.append(" ty=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003169 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003170 if (format != PixelFormat.OPAQUE) {
3171 sb.append(" fmt=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003172 sb.append(PixelFormat.formatToString(format));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003173 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003174 if (windowAnimations != 0) {
3175 sb.append(" wanim=0x");
3176 sb.append(Integer.toHexString(windowAnimations));
3177 }
3178 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
3179 sb.append(" or=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003180 sb.append(ActivityInfo.screenOrientationToString(screenOrientation));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003181 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003182 if (alpha != 1.0f) {
3183 sb.append(" alpha=");
3184 sb.append(alpha);
3185 }
3186 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3187 sb.append(" sbrt=");
3188 sb.append(screenBrightness);
3189 }
3190 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3191 sb.append(" bbrt=");
3192 sb.append(buttonBrightness);
3193 }
Craig Mautner3c174372013-02-21 17:54:37 -08003194 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
3195 sb.append(" rotAnim=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003196 sb.append(rotationAnimationToString(rotationAnimation));
Craig Mautner3c174372013-02-21 17:54:37 -08003197 }
Michael Wright3f145a22014-07-22 19:46:03 -07003198 if (preferredRefreshRate != 0) {
3199 sb.append(" preferredRefreshRate=");
3200 sb.append(preferredRefreshRate);
3201 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003202 if (preferredDisplayModeId != 0) {
3203 sb.append(" preferredDisplayMode=");
3204 sb.append(preferredDisplayModeId);
3205 }
Joe Onorato664644d2011-01-23 17:53:23 -08003206 if (hasSystemUiListeners) {
3207 sb.append(" sysuil=");
3208 sb.append(hasSystemUiListeners);
3209 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003210 if (inputFeatures != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003211 sb.append(" if=").append(inputFeatureToString(inputFeatures));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003212 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003213 if (userActivityTimeout >= 0) {
3214 sb.append(" userActivityTimeout=").append(userActivityTimeout);
3215 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07003216 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07003217 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
3218 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07003219 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08003220 if (hasManualSurfaceInsets) {
3221 sb.append(" (manual)");
3222 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003223 if (!preservePreviousSurfaceInsets) {
3224 sb.append(" (!preservePreviousSurfaceInsets)");
3225 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07003226 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003227 if (needsMenuKey == NEEDS_MENU_SET_TRUE) {
3228 sb.append(" needsMenuKey");
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003229 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003230 if (mColorMode != COLOR_MODE_DEFAULT) {
3231 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode));
3232 }
3233 sb.append(System.lineSeparator());
3234 sb.append(prefix).append(" fl=").append(
3235 ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
3236 if (privateFlags != 0) {
3237 sb.append(System.lineSeparator());
3238 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString(
3239 LayoutParams.class, "privateFlags", privateFlags));
3240 }
3241 if (systemUiVisibility != 0) {
3242 sb.append(System.lineSeparator());
3243 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString(
3244 View.class, "mSystemUiVisibility", systemUiVisibility));
3245 }
3246 if (subtreeSystemUiVisibility != 0) {
3247 sb.append(System.lineSeparator());
3248 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString(
3249 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility));
3250 }
Jorim Jaggib7848b72018-12-28 14:38:21 +01003251 if (insetsFlags.appearance != 0) {
3252 sb.append(System.lineSeparator());
3253 sb.append(prefix).append(" apr=").append(ViewDebug.flagsToString(
3254 InsetsFlags.class, "appearance", insetsFlags.appearance));
3255 }
3256 if (insetsFlags.behavior != 0) {
3257 sb.append(System.lineSeparator());
3258 sb.append(prefix).append(" bhv=").append(ViewDebug.flagsToString(
3259 InsetsFlags.class, "behavior", insetsFlags.behavior));
3260 }
3261
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 sb.append('}');
3263 return sb.toString();
3264 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003265
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003266 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07003267 * @hide
3268 */
Jeffrey Huangcb782852019-12-05 11:28:11 -08003269 public void dumpDebug(ProtoOutputStream proto, long fieldId) {
Steven Timotiusaf03df62017-07-18 16:56:43 -07003270 final long token = proto.start(fieldId);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003271 proto.write(TYPE, type);
3272 proto.write(X, x);
3273 proto.write(Y, y);
3274 proto.write(WIDTH, width);
3275 proto.write(HEIGHT, height);
3276 proto.write(HORIZONTAL_MARGIN, horizontalMargin);
3277 proto.write(VERTICAL_MARGIN, verticalMargin);
3278 proto.write(GRAVITY, gravity);
3279 proto.write(SOFT_INPUT_MODE, softInputMode);
3280 proto.write(FORMAT, format);
3281 proto.write(WINDOW_ANIMATIONS, windowAnimations);
3282 proto.write(ALPHA, alpha);
3283 proto.write(SCREEN_BRIGHTNESS, screenBrightness);
3284 proto.write(BUTTON_BRIGHTNESS, buttonBrightness);
3285 proto.write(ROTATION_ANIMATION, rotationAnimation);
3286 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate);
3287 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId);
3288 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners);
3289 proto.write(INPUT_FEATURE_FLAGS, inputFeatures);
3290 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout);
3291 proto.write(NEEDS_MENU_KEY, needsMenuKey);
3292 proto.write(COLOR_MODE, mColorMode);
3293 proto.write(FLAGS, flags);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003294 proto.write(PRIVATE_FLAGS, privateFlags);
3295 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility);
3296 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility);
Jorim Jaggib7848b72018-12-28 14:38:21 +01003297 proto.write(APPEARANCE, insetsFlags.appearance);
3298 proto.write(BEHAVIOR, insetsFlags.behavior);
Steven Timotiusaf03df62017-07-18 16:56:43 -07003299 proto.end(token);
3300 }
3301
3302 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003303 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003304 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003305 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003306 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003307 x = (int) (x * scale + 0.5f);
3308 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003309 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003310 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003311 }
3312 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003313 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003314 }
3315 }
3316
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003317 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003318 * Backup the layout parameters used in compatibility mode.
3319 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003320 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003321 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003322 void backup() {
3323 int[] backup = mCompatibilityParamsBackup;
3324 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003325 // we backup 4 elements, x, y, width, height
3326 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003327 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003328 backup[0] = x;
3329 backup[1] = y;
3330 backup[2] = width;
3331 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003332 }
3333
3334 /**
3335 * Restore the layout params' coordinates, size and gravity
3336 * @see LayoutParams#backup()
3337 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003338 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003339 void restore() {
3340 int[] backup = mCompatibilityParamsBackup;
3341 if (backup != null) {
3342 x = backup[0];
3343 y = backup[1];
3344 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003345 height = backup[3];
3346 }
3347 }
3348
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003349 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07003350
3351 /** @hide */
3352 @Override
3353 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
3354 super.encodeProperties(encoder);
3355
3356 encoder.addProperty("x", x);
3357 encoder.addProperty("y", y);
3358 encoder.addProperty("horizontalWeight", horizontalWeight);
3359 encoder.addProperty("verticalWeight", verticalWeight);
3360 encoder.addProperty("type", type);
3361 encoder.addProperty("flags", flags);
3362 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02003363
3364 /**
3365 * @hide
3366 * @return True if the layout parameters will cause the window to cover the full screen;
3367 * false otherwise.
3368 */
3369 public boolean isFullscreen() {
3370 return x == 0 && y == 0
3371 && width == WindowManager.LayoutParams.MATCH_PARENT
3372 && height == WindowManager.LayoutParams.MATCH_PARENT;
3373 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003374
Adrian Roosfa02da62018-01-15 16:01:18 +01003375 private static String layoutInDisplayCutoutModeToString(
3376 @LayoutInDisplayCutoutMode int mode) {
3377 switch (mode) {
3378 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT:
3379 return "default";
3380 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS:
3381 return "always";
3382 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER:
3383 return "never";
3384 default:
3385 return "unknown(" + mode + ")";
3386 }
3387 }
3388
Jorim Jaggi484851b2017-09-22 16:03:27 +02003389 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) {
3390 final StringBuilder result = new StringBuilder();
3391 final int state = softInputMode & SOFT_INPUT_MASK_STATE;
3392 if (state != 0) {
3393 result.append("state=");
3394 switch (state) {
3395 case SOFT_INPUT_STATE_UNCHANGED:
3396 result.append("unchanged");
3397 break;
3398 case SOFT_INPUT_STATE_HIDDEN:
3399 result.append("hidden");
3400 break;
3401 case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
3402 result.append("always_hidden");
3403 break;
3404 case SOFT_INPUT_STATE_VISIBLE:
3405 result.append("visible");
3406 break;
3407 case SOFT_INPUT_STATE_ALWAYS_VISIBLE:
3408 result.append("always_visible");
3409 break;
3410 default:
3411 result.append(state);
3412 break;
3413 }
3414 result.append(' ');
3415 }
3416 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST;
3417 if (adjust != 0) {
3418 result.append("adjust=");
3419 switch (adjust) {
3420 case SOFT_INPUT_ADJUST_RESIZE:
3421 result.append("resize");
3422 break;
3423 case SOFT_INPUT_ADJUST_PAN:
3424 result.append("pan");
3425 break;
3426 case SOFT_INPUT_ADJUST_NOTHING:
3427 result.append("nothing");
3428 break;
3429 default:
3430 result.append(adjust);
3431 break;
3432 }
3433 result.append(' ');
3434 }
3435 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
3436 result.append("forwardNavigation").append(' ');
3437 }
3438 result.deleteCharAt(result.length() - 1);
3439 return result.toString();
3440 }
3441
3442 private static String rotationAnimationToString(int rotationAnimation) {
3443 switch (rotationAnimation) {
3444 case ROTATION_ANIMATION_UNSPECIFIED:
3445 return "UNSPECIFIED";
3446 case ROTATION_ANIMATION_ROTATE:
3447 return "ROTATE";
3448 case ROTATION_ANIMATION_CROSSFADE:
3449 return "CROSSFADE";
3450 case ROTATION_ANIMATION_JUMPCUT:
3451 return "JUMPCUT";
3452 case ROTATION_ANIMATION_SEAMLESS:
3453 return "SEAMLESS";
3454 default:
3455 return Integer.toString(rotationAnimation);
3456 }
3457 }
3458
3459 private static String inputFeatureToString(int inputFeature) {
3460 switch (inputFeature) {
3461 case INPUT_FEATURE_DISABLE_POINTER_GESTURES:
3462 return "DISABLE_POINTER_GESTURES";
3463 case INPUT_FEATURE_NO_INPUT_CHANNEL:
3464 return "NO_INPUT_CHANNEL";
3465 case INPUT_FEATURE_DISABLE_USER_ACTIVITY:
3466 return "DISABLE_USER_ACTIVITY";
3467 default:
3468 return Integer.toString(inputFeature);
3469 }
3470 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003471 }
3472}