blob: d40f8325c3204528f3910a3737fe986f7799a285 [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 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 * End of types of system windows.
1110 */
1111 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001112
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001113 /**
Albert Chaulke4338f82017-04-19 15:54:08 -04001114 * @hide
1115 * Used internally when there is no suitable type available.
1116 */
1117 public static final int INVALID_WINDOW_TYPE = -1;
1118
1119 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001120 * Return true if the window type is an alert window.
1121 *
1122 * @param type The window type.
1123 * @return If the window type is an alert window.
1124 * @hide
1125 */
1126 public static boolean isSystemAlertWindowType(int type) {
1127 switch (type) {
1128 case TYPE_PHONE:
1129 case TYPE_PRIORITY_PHONE:
1130 case TYPE_SYSTEM_ALERT:
1131 case TYPE_SYSTEM_ERROR:
1132 case TYPE_SYSTEM_OVERLAY:
1133 case TYPE_APPLICATION_OVERLAY:
1134 return true;
1135 }
1136 return false;
1137 }
1138
Mathias Agopiand2112302010-12-07 19:38:17 -08001139 /** @deprecated this is ignored, this value is set automatically when needed. */
1140 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001141 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -08001142 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001143 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -08001145 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001146 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -08001148 /** @deprecated this is ignored, this value is set automatically when needed. */
1149 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001150 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001153 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001155 @Deprecated
1156 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001157
Mike Lockwoodef731622010-01-27 17:51:34 -05001158 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001159 * the lock screen to activate while the screen is on.
1160 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -08001161 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -05001162 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
1163
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001164 /** Window flag: everything behind this window will be dimmed.
1165 * Use {@link #dimAmount} to control the amount of dim. */
1166 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001167
1168 /** Window flag: blur everything behind this window.
1169 * @deprecated Blurring is no longer supported. */
1170 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 /** Window flag: this window won't ever get key input focus, so the
1174 * user can not send key or other button events to it. Those will
1175 * instead go to whatever focusable window is behind it. This flag
1176 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
1177 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001178 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001179 * <p>Setting this flag also implies that the window will not need to
1180 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001181 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 * independently of any active input method (typically this means it
1183 * gets Z-ordered on top of the input method, so it can use the full
Andrew Chant17c896e2019-12-05 22:39:02 +00001184 * screen for its content and cover the input method if needed. You
1185 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001187
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 /** Window flag: this window can never receive touch events. */
1189 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001190
John Spurlock33291d82013-03-13 14:45:14 -04001191 /** Window flag: even when this window is focusable (its
1192 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 * outside of the window to be sent to the windows behind it. Otherwise
1194 * it will consume all pointer events itself, regardless of whether they
1195 * are inside of the window. */
1196 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001197
John Spurlock33291d82013-03-13 14:45:14 -04001198 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001199 * screen is pressed, you will receive this first touch event. Usually
1200 * the first touch event is consumed by the system since the user can
1201 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -07001202 *
1203 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001205 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001207
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 /** Window flag: as long as this window is visible to the user, keep
1209 * the device's screen turned on and bright. */
1210 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001211
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001212 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -04001213 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 * window must correctly position its contents to take the screen
1215 * decoration into account. This flag is normally set for you
Adrian Roosfa02da62018-01-15 16:01:18 +01001216 * by Window as described in {@link Window#setFlags}.
1217 *
1218 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed
1219 * such that it avoids the {@link DisplayCutout} area if necessary according to the
1220 * {@link #layoutInDisplayCutoutMode}.
1221 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001223
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 /** Window flag: allow window to extend outside of the screen. */
1225 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001226
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001227 /**
John Spurlock33291d82013-03-13 14:45:14 -04001228 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 * this window is displayed. This allows the window to use the entire
1230 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -07001231 * an app window with this flag set is on the top layer. A fullscreen window
1232 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
1233 * {@link #softInputMode} field; the window will stay fullscreen
1234 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001235 *
1236 * <p>This flag can be controlled in your theme through the
1237 * {@link android.R.attr#windowFullscreen} attribute; this attribute
1238 * is automatically set for you in the standard fullscreen themes
1239 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
1240 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
1241 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
1242 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
1243 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
1244 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
1245 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
1246 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001248
John Spurlock33291d82013-03-13 14:45:14 -04001249 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
1250 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -07001254 * the screen.
1255 * @deprecated This flag is no longer used. */
1256 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001258
John Spurlock33291d82013-03-13 14:45:14 -04001259 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -07001260 * it from appearing in screenshots or from being viewed on non-secure
1261 * displays.
1262 *
1263 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
1264 * secure surfaces and secure displays.
1265 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001267
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001268 /** Window flag: a special mode where the layout parameters are used
1269 * to perform scaling of the surface when it is composited to the
1270 * screen. */
1271 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 /** Window flag: intended for windows that will often be used when the user is
1274 * holding the screen against their face, it will aggressively filter the event
1275 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001276 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001277 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001278 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 * until the finger is released. */
1280 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001281
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 /** Window flag: a special option only for use in combination with
1283 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
1284 * screen your window may appear on top of or behind screen decorations
1285 * such as the status bar. By also including this flag, the window
1286 * manager will report the inset rectangle needed to ensure your
1287 * content is not covered by screen decorations. This flag is normally
1288 * set for you by Window as described in {@link Window#setFlags}.*/
1289 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001290
Andrew Chant17c896e2019-12-05 22:39:02 +00001291 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
1292 * respect to how this window interacts with the current method. That
1293 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
1294 * window will behave as if it needs to interact with the input method
1295 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
1296 * not set and this flag is set, then the window will behave as if it
1297 * doesn't need to interact with the input method and can be placed
1298 * to use more space and cover the input method.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001299 */
1300 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001301
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
1303 * can set this flag to receive a single special MotionEvent with
1304 * the action
1305 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
1306 * touches that occur outside of your window. Note that you will not
1307 * receive the full down/move/up gesture, only the location of the
1308 * first down as an ACTION_OUTSIDE.
1309 */
1310 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001311
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001312 /** Window flag: special flag to let windows be shown when the screen
1313 * is locked. This will let application windows take precedence over
1314 * key guard or any other lock screens. Can be used with
1315 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001316 * directly before showing the key guard window. Can be used with
1317 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
1318 * non-secure keyguards. This flag only applies to the top-most
1319 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -07001320 * @deprecated Use {@link android.R.attr#showWhenLocked} or
1321 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
1322 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001323 */
chaviw59b98852017-06-13 12:05:44 -07001324 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001325 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
1326
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001327 /** Window flag: ask that the system wallpaper be shown behind
1328 * your window. The window surface must be translucent to be able
1329 * to actually see the wallpaper behind it; this flag just ensures
1330 * that the wallpaper surface will be there if this window actually
1331 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001332 *
1333 * <p>This flag can be controlled in your theme through the
1334 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
1335 * is automatically set for you in the standard wallpaper themes
1336 * such as {@link android.R.style#Theme_Wallpaper},
1337 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
1338 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
1339 * {@link android.R.style#Theme_Holo_Wallpaper},
1340 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
1341 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
1342 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001343 */
1344 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001345
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001346 /** Window flag: when set as a window is being added or made
1347 * visible, once the window has been shown then the system will
1348 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -07001349 * up the device) to turn the screen on.
1350 * @deprecated Use {@link android.R.attr#turnScreenOn} or
1351 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
1352 * unintentional double life-cycle event.
1353 */
1354 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001355 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001356
Jeff Sharkey67f9d502017-08-05 13:49:13 -06001357 /**
1358 * Window flag: when set the window will cause the keyguard to be
1359 * dismissed, only if it is not a secure lock keyguard. Because such a
1360 * keyguard is not needed for security, it will never re-appear if the
1361 * user navigates to another window (in contrast to
1362 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1363 * secure and non-secure keyguards but ensure they reappear when the
1364 * user moves to another UI that doesn't hide them). If the keyguard is
1365 * currently active and is secure (requires an unlock credential) than
1366 * the user will still need to confirm it before seeing this window,
1367 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1368 *
1369 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1370 * {@link KeyguardManager#requestDismissKeyguard} instead.
1371 * Since keyguard was dismissed all the time as long as an
1372 * activity with this flag on its window was focused,
1373 * keyguard couldn't guard against unintentional touches on
1374 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001375 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001376 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001377 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001378
Jeff Brown01ce2e92010-09-26 22:20:12 -07001379 /** Window flag: when set the window will accept for touch events
1380 * outside of its bounds to be sent to other windows that also
1381 * support split touch. When this flag is not set, the first pointer
1382 * that goes down determines the window to which all subsequent touches
1383 * go until all pointers go up. When this flag is set, each pointer
1384 * (not necessarily the first) that goes down determines the window
1385 * to which all subsequent touches of that pointer will go until that
1386 * pointer goes up thereby enabling touches with multiple pointers
1387 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001388 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001389 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001390
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001391 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001392 * <p>Indicates whether this window should be hardware accelerated.
1393 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001394 *
Romain Guy72f0a272011-01-09 16:01:46 -08001395 * <p>This flag can be controlled programmatically <em>only</em> to enable
1396 * hardware acceleration. To enable hardware acceleration for a given
1397 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001398 *
Romain Guy72f0a272011-01-09 16:01:46 -08001399 * <pre>
1400 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1401 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1402 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1403 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001404 *
Romain Guy72f0a272011-01-09 16:01:46 -08001405 * <p>It is important to remember that this flag <strong>must</strong>
1406 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001407 *
Romain Guy72f0a272011-01-09 16:01:46 -08001408 * <p>This flag cannot be used to disable hardware acceleration after it
1409 * was enabled in your manifest using
1410 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1411 * and programmatically disable hardware acceleration (for automated testing
1412 * for instance), make sure it is turned off in your manifest and enable it
1413 * on your activity or dialog when you need it instead, using the method
1414 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001415 *
Romain Guy72f0a272011-01-09 16:01:46 -08001416 * <p>This flag is automatically set by the system if the
1417 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1418 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001419 */
1420 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001421
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001422 /**
1423 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001424 * overscan area, if there is one. The window should still correctly
1425 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001426 *
1427 * <p>This flag can be controlled in your theme through the
1428 * {@link android.R.attr#windowOverscan} attribute; this attribute
1429 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001430 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001431 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1432 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1433 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1434 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1435 *
1436 * <p>When this flag is enabled for a window, its normal content may be obscured
1437 * to some degree by the overscan region of the display. To ensure key parts of
1438 * that content are visible to the user, you can use
1439 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1440 * to set the point in the view hierarchy where the appropriate offsets should
1441 * be applied. (This can be done either by directly calling this function, using
1442 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1443 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1444 * View.fitSystemWindows(Rect)} method).</p>
1445 *
1446 * <p>This mechanism for positioning content elements is identical to its equivalent
1447 * use with layout and {@link View#setSystemUiVisibility(int)
1448 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1449 * position its UI elements with this overscan flag is set:</p>
1450 *
1451 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Jorim Jaggif081f062019-10-24 16:24:54 +02001452 *
1453 * @deprecated Overscan areas aren't set by any Android product anymore.
Dianne Hackbornc652de82013-02-15 16:32:56 -08001454 */
Jorim Jaggif081f062019-10-24 16:24:54 +02001455 @Deprecated
Dianne Hackbornc652de82013-02-15 16:32:56 -08001456 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1457
John Spurlockbd957402013-10-03 11:38:39 -04001458 /**
1459 * Window flag: request a translucent status bar with minimal system-provided
1460 * background protection.
1461 *
1462 * <p>This flag can be controlled in your theme through the
1463 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1464 * is automatically set for you in the standard translucent decor themes
1465 * such as
1466 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1467 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1468 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1469 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1470 *
1471 * <p>When this flag is enabled for a window, it automatically sets
1472 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1473 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001474 *
1475 * <p>Note: For devices that support
1476 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag may be ignored.
John Spurlockbd957402013-10-03 11:38:39 -04001477 */
1478 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1479
1480 /**
1481 * Window flag: request a translucent navigation bar with minimal system-provided
1482 * background protection.
1483 *
1484 * <p>This flag can be controlled in your theme through the
1485 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1486 * is automatically set for you in the standard translucent decor themes
1487 * such as
1488 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1489 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1490 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1491 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1492 *
1493 * <p>When this flag is enabled for a window, it automatically sets
1494 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1495 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001496 *
1497 * <p>Note: For devices that support
1498 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag can be disabled
1499 * by the car manufacturers.
John Spurlockbd957402013-10-03 11:38:39 -04001500 */
1501 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1502
Adam Lesinski6a591f52013-10-01 18:11:17 -07001503 /**
1504 * Flag for a window in local focus mode.
1505 * Window in local focus mode can control focus independent of window manager using
1506 * {@link Window#setLocalFocus(boolean, boolean)}.
1507 * Usually window in this mode will not get touch/key events from window manager, but will
1508 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1509 */
1510 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1511
Jeff Brown98db5fa2011-06-08 15:37:10 -07001512 /** Window flag: Enable touches to slide out of a window into neighboring
1513 * windows in mid-gesture instead of being captured for the duration of
1514 * the gesture.
1515 *
1516 * This flag changes the behavior of touch focus for this window only.
1517 * Touches can slide out of the window but they cannot necessarily slide
1518 * back in (unless the other window with touch focus permits it).
1519 *
1520 * {@hide}
1521 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001522 @UnsupportedAppUsage
Adam Lesinski6a591f52013-10-01 18:11:17 -07001523 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001524
Daniel Sandlere02d8082010-10-08 15:13:22 -04001525 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001526 * Window flag: When requesting layout with an attached window, the attached window may
1527 * overlap with the screen decorations of the parent window such as the navigation bar. By
1528 * including this flag, the window manager will layout the attached window within the decor
1529 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001530 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001531 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001533 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001534 * Flag indicating that this Window is responsible for drawing the background for the
1535 * system bars. If set, the system bars are drawn with a transparent background and the
1536 * corresponding areas in this window are filled with the colors specified in
1537 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1538 */
1539 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1540
1541 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001542 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001543 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001544 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1545 * @see #FLAG_DIM_BEHIND
1546 * @see #FLAG_NOT_FOCUSABLE
1547 * @see #FLAG_NOT_TOUCHABLE
1548 * @see #FLAG_NOT_TOUCH_MODAL
1549 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1550 * @see #FLAG_KEEP_SCREEN_ON
1551 * @see #FLAG_LAYOUT_IN_SCREEN
1552 * @see #FLAG_LAYOUT_NO_LIMITS
1553 * @see #FLAG_FULLSCREEN
1554 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001555 * @see #FLAG_SECURE
1556 * @see #FLAG_SCALED
1557 * @see #FLAG_IGNORE_CHEEK_PRESSES
1558 * @see #FLAG_LAYOUT_INSET_DECOR
1559 * @see #FLAG_ALT_FOCUSABLE_IM
1560 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1561 * @see #FLAG_SHOW_WHEN_LOCKED
1562 * @see #FLAG_SHOW_WALLPAPER
1563 * @see #FLAG_TURN_SCREEN_ON
1564 * @see #FLAG_DISMISS_KEYGUARD
1565 * @see #FLAG_SPLIT_TOUCH
1566 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001567 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001568 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001569 */
1570 @ViewDebug.ExportedProperty(flagMapping = {
1571 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001572 name = "ALLOW_LOCK_WHILE_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001573 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001574 name = "DIM_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001575 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001576 name = "BLUR_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001577 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001578 name = "NOT_FOCUSABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001579 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001580 name = "NOT_TOUCHABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001581 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001582 name = "NOT_TOUCH_MODAL"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001583 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001584 name = "TOUCHABLE_WHEN_WAKING"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001585 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001586 name = "KEEP_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001587 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001588 name = "LAYOUT_IN_SCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001589 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001590 name = "LAYOUT_NO_LIMITS"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001591 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001592 name = "FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001593 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001594 name = "FORCE_NOT_FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001595 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001596 name = "DITHER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001597 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001598 name = "SECURE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001599 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001600 name = "SCALED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001601 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001602 name = "IGNORE_CHEEK_PRESSES"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001603 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001604 name = "LAYOUT_INSET_DECOR"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001605 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001606 name = "ALT_FOCUSABLE_IM"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001607 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001608 name = "WATCH_OUTSIDE_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001609 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001610 name = "SHOW_WHEN_LOCKED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001611 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001612 name = "SHOW_WALLPAPER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001613 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001614 name = "TURN_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001615 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001616 name = "DISMISS_KEYGUARD"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001617 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001618 name = "SPLIT_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001619 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001620 name = "HARDWARE_ACCELERATED"),
1621 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN,
1622 name = "LOCAL_FOCUS_MODE"),
John Spurlockbd957402013-10-03 11:38:39 -04001623 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001624 name = "TRANSLUCENT_STATUS"),
John Spurlockbd957402013-10-03 11:38:39 -04001625 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001626 name = "TRANSLUCENT_NAVIGATION"),
1627 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
1628 name = "LOCAL_FOCUS_MODE"),
1629 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY,
1630 name = "FLAG_SLIPPERY"),
1631 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR,
1632 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"),
Adrian Roos217ccd22014-05-09 14:29:04 +02001633 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001634 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001635 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001636 public int flags;
1637
1638 /**
John Reck61375a82014-09-18 19:27:48 +00001639 * If the window has requested hardware acceleration, but this is not
1640 * allowed in the process it is in, then still render it as if it is
1641 * hardware accelerated. This is used for the starting preview windows
1642 * in the system process, which don't need to have the overhead of
1643 * hardware acceleration (they are just a static rendering), but should
1644 * be rendered as such to match the actual window of the app even if it
1645 * is hardware accelerated.
1646 * Even if the window isn't hardware accelerated, still do its rendering
1647 * as if it was.
1648 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1649 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001650 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001651 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1652 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001653 *
John Reck61375a82014-09-18 19:27:48 +00001654 * @hide
1655 */
1656 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1657
1658 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001659 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001660 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001661 * If certain parts of the UI that really do want to use hardware
1662 * acceleration, this flag can be set to force it. This is basically
1663 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001664 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001665 * @hide
1666 */
1667 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1668
1669 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001670 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001671 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001672 * them (they do not affect the wallpaper scrolling operation) by calling
1673 * {@link
1674 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1675 *
1676 * @hide
1677 */
1678 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1679
Craig Mautner88400d32012-09-30 12:35:45 -07001680 /** In a multiuser system if this flag is set and the owner is a system process then this
1681 * window will appear on all user screens. This overrides the default behavior of window
1682 * types that normally only appear on the owning user's screen. Refer to each window type
1683 * to determine its default behavior.
1684 *
1685 * {@hide} */
Roshan Piusa3f89c62019-10-11 08:50:53 -07001686 @SystemApi
1687 @RequiresPermission(permission.INTERNAL_SYSTEM_WINDOW)
1688 public static final int SYSTEM_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
Craig Mautner88400d32012-09-30 12:35:45 -07001689
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001690 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001691 * Never animate position changes of the window.
1692 *
Robert Carrb48380a2017-04-04 14:56:37 -07001693 * {@hide}
1694 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00001695 @UnsupportedAppUsage
Robert Carrb48380a2017-04-04 14:56:37 -07001696 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001697 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1698
Adam Lesinski6a591f52013-10-01 18:11:17 -07001699 /** Window flag: special flag to limit the size of the window to be
1700 * original size ([320x480] x density). Used to create window for applications
1701 * running under compatibility mode.
1702 *
1703 * {@hide} */
1704 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1705
1706 /** Window flag: a special option intended for system dialogs. When
1707 * this flag is set, the window will demand focus unconditionally when
1708 * it is created.
1709 * {@hide} */
1710 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1711
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001712 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001713 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1714 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1715 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1716 * {@hide}
1717 */
1718 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1719
1720 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001721 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1722 *
1723 * {@hide}
1724 */
1725 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1726
1727 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001728 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1729 * this flag is set it will be shown again and the bar will have a transparent background.
1730 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1731 *
1732 * {@hide}
1733 */
1734 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1735
1736 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001737 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001738 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001739 * because they are being managed externally through repositionChild.
1740 *
1741 * {@hide}
1742 */
1743 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1744
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001745 /**
1746 * Flag that will make window ignore app visibility and instead depend purely on the decor
1747 * view visibility for determining window visibility. This is used by recents to keep
1748 * drawing after it launches an app.
1749 * @hide
1750 */
1751 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1752
Robert Carra1eb4392015-12-10 12:43:51 -08001753 /**
1754 * Flag to indicate that this window is not expected to be replaced across
1755 * configuration change triggered activity relaunches. In general the WindowManager
1756 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1757 * until the replacement is ready to show in order to prevent visual glitch. However
1758 * some windows, such as PopupWindows expect to be cleared across configuration change,
1759 * and thus should hint to the WindowManager that it should not wait for a replacement.
1760 * @hide
1761 */
1762 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001763
1764 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001765 * Flag to indicate that this child window should always be laid-out in the parent
1766 * frame regardless of the current windowing mode configuration.
1767 * @hide
1768 */
1769 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1770
1771 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001772 * Flag to indicate that this window is always drawing the status bar background, no matter
1773 * what the other flags are.
1774 * @hide
1775 */
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001776 public static final int PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS = 0x00020000;
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001777
1778 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001779 * Flag to indicate that this window needs Sustained Performance Mode if
1780 * the device supports it.
1781 * @hide
1782 */
John Reck60e885f2016-04-21 15:40:45 -07001783 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001784
1785 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001786 * Flag to indicate that any window added by an application process that is of type
1787 * {@link #TYPE_TOAST} or that requires
1788 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1789 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001790 * @hide
1791 */
Philip P. Moltmannd66dd992018-09-17 11:26:04 -07001792 @SystemApi
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001793 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001794 public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001795
1796 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001797 * Indicates that this window is the rounded corners overlay present on some
1798 * devices this means that it will be excluded from: screenshots,
1799 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001800 * @hide
1801 */
Robert Carr132c9f52017-07-31 17:02:30 -07001802 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001803
1804 /**
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001805 * Flag to indicate that this window should be considered a screen decoration similar to the
1806 * nav bar and status bar. This will cause this window to affect the window insets reported
1807 * to other windows when it is visible.
1808 * @hide
1809 */
1810 @RequiresPermission(permission.STATUS_BAR_SERVICE)
1811 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
1812
1813 /**
Tiger Huanga90dea42018-08-03 17:20:17 +08001814 * Flag to indicate that the status bar window is in a state such that it forces showing
1815 * the navigation bar unless the navigation bar window is explicitly set to
1816 * {@link View#GONE}.
1817 * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}.
Tiger Huang34046012018-06-29 15:26:52 +08001818 * @hide
1819 */
Tiger Huanga90dea42018-08-03 17:20:17 +08001820 public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
Tiger Huang34046012018-06-29 15:26:52 +08001821
1822 /**
Peiyong Lin75045382019-03-04 19:22:33 -08001823 * Flag to indicate that the window is color space agnostic, and the color can be
1824 * interpreted to any color space.
1825 * @hide
1826 */
1827 public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000;
1828
1829 /**
Robert Carr48ec4e02019-07-16 14:28:47 -07001830 * Flag to request creation of a BLAST (Buffer as LayerState) Layer.
1831 * If not specified the client will receive a BufferQueue layer.
1832 * @hide
1833 */
1834 public static final int PRIVATE_FLAG_USE_BLAST = 0x02000000;
1835
1836 /**
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001837 * An internal annotation for flags that can be specified to {@link #softInputMode}.
1838 *
1839 * @hide
1840 */
1841 @SystemApi
1842 @Retention(RetentionPolicy.SOURCE)
1843 @IntDef(flag = true, prefix = { "SYSTEM_FLAG_" }, value = {
1844 SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Roshan Piusa3f89c62019-10-11 08:50:53 -07001845 SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001846 })
1847 public @interface SystemFlags {}
1848
1849 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001850 * Control flags that are private to the platform.
1851 * @hide
1852 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00001853 @UnsupportedAppUsage
Jorim Jaggi484851b2017-09-22 16:03:27 +02001854 @ViewDebug.ExportedProperty(flagMapping = {
1855 @ViewDebug.FlagToString(
1856 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1857 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1858 name = "FAKE_HARDWARE_ACCELERATED"),
1859 @ViewDebug.FlagToString(
1860 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1861 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1862 name = "FORCE_HARDWARE_ACCELERATED"),
1863 @ViewDebug.FlagToString(
1864 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1865 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1866 name = "WANTS_OFFSET_NOTIFICATIONS"),
1867 @ViewDebug.FlagToString(
Roshan Piusa3f89c62019-10-11 08:50:53 -07001868 mask = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
1869 equals = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001870 name = "SHOW_FOR_ALL_USERS"),
1871 @ViewDebug.FlagToString(
1872 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1873 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1874 name = "NO_MOVE_ANIMATION"),
1875 @ViewDebug.FlagToString(
1876 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1877 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1878 name = "COMPATIBLE_WINDOW"),
1879 @ViewDebug.FlagToString(
1880 mask = PRIVATE_FLAG_SYSTEM_ERROR,
1881 equals = PRIVATE_FLAG_SYSTEM_ERROR,
1882 name = "SYSTEM_ERROR"),
1883 @ViewDebug.FlagToString(
Jorim Jaggi484851b2017-09-22 16:03:27 +02001884 mask = PRIVATE_FLAG_KEYGUARD,
1885 equals = PRIVATE_FLAG_KEYGUARD,
1886 name = "KEYGUARD"),
1887 @ViewDebug.FlagToString(
1888 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1889 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1890 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"),
1891 @ViewDebug.FlagToString(
1892 mask = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1893 equals = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1894 name = "FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"),
1895 @ViewDebug.FlagToString(
1896 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1897 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1898 name = "PRESERVE_GEOMETRY"),
1899 @ViewDebug.FlagToString(
1900 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1901 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1902 name = "FORCE_DECOR_VIEW_VISIBILITY"),
1903 @ViewDebug.FlagToString(
1904 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1905 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1906 name = "WILL_NOT_REPLACE_ON_RELAUNCH"),
1907 @ViewDebug.FlagToString(
1908 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1909 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1910 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
1911 @ViewDebug.FlagToString(
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001912 mask = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
1913 equals = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001914 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
1915 @ViewDebug.FlagToString(
1916 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1917 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1918 name = "SUSTAINED_PERFORMANCE_MODE"),
1919 @ViewDebug.FlagToString(
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001920 mask = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1921 equals = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001922 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"),
1923 @ViewDebug.FlagToString(
1924 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1925 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1926 name = "IS_ROUNDED_CORNERS_OVERLAY"),
1927 @ViewDebug.FlagToString(
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001928 mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
1929 equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
Tiger Huang34046012018-06-29 15:26:52 +08001930 name = "IS_SCREEN_DECOR"),
1931 @ViewDebug.FlagToString(
Tiger Huanga90dea42018-08-03 17:20:17 +08001932 mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
1933 equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
Peiyong Lin75045382019-03-04 19:22:33 -08001934 name = "STATUS_FORCE_SHOW_NAVIGATION"),
1935 @ViewDebug.FlagToString(
1936 mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1937 equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1938 name = "COLOR_SPACE_AGNOSTIC")
Jorim Jaggi484851b2017-09-22 16:03:27 +02001939 })
Robert Carrb48380a2017-04-04 14:56:37 -07001940 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001941 public int privateFlags;
1942
1943 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001944 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1945 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1946 * key. For this case, we should look at windows behind it to determine the appropriate
1947 * value.
1948 *
1949 * @hide
1950 */
1951 public static final int NEEDS_MENU_UNSET = 0;
1952
1953 /**
1954 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1955 * menu key.
1956 *
1957 * @hide
1958 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001959 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001960 public static final int NEEDS_MENU_SET_TRUE = 1;
1961
1962 /**
1963 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1964 * needs a menu key.
1965 *
1966 * @hide
1967 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001968 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001969 public static final int NEEDS_MENU_SET_FALSE = 2;
1970
1971 /**
1972 * State variable for a window belonging to an activity that responds to
1973 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1974 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1975 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1976 *
1977 * (Note that Action Bars, when available, are the preferred way to offer additional
1978 * functions otherwise accessed via an options menu.)
1979 *
1980 * {@hide}
1981 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001982 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001983 public int needsMenuKey = NEEDS_MENU_UNSET;
1984
1985 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001986 * Given a particular set of window manager flags, determine whether
1987 * such a window may be a target for an input method when it has
1988 * focus. In particular, this checks the
1989 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1990 * flags and returns true if the combination of the two corresponds
1991 * to a window that needs to be behind the input method so that the
1992 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001993 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001994 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001995 *
Andrew Chant17c896e2019-12-05 22:39:02 +00001996 * @return Returns true if such a window should be behind/interact
1997 * with an input method, false if not.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001998 */
1999 public static boolean mayUseInputMethod(int flags) {
Andrew Chant17c896e2019-12-05 22:39:02 +00002000 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
2001 case 0:
2002 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
2003 return true;
2004 }
2005 return false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002006 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002007
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002008 /**
2009 * Mask for {@link #softInputMode} of the bits that determine the
2010 * desired visibility state of the soft input area for this window.
2011 */
2012 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002013
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002014 /**
Yohei Yukawaa7547852018-03-27 15:47:45 -07002015 * Visibility state for {@link #softInputMode}: no state has been specified. The system may
2016 * show or hide the software keyboard for better user experience when the window gains
2017 * focus.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002018 */
2019 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002020
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002021 /**
2022 * Visibility state for {@link #softInputMode}: please don't change the state of
2023 * the soft input area.
2024 */
2025 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002026
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002027 /**
2028 * Visibility state for {@link #softInputMode}: please hide any soft input
2029 * area when normally appropriate (when the user is navigating
2030 * forward to your window).
2031 */
2032 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
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 always hide any
2036 * soft input area when this window receives focus.
2037 */
2038 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002039
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002040 /**
2041 * Visibility state for {@link #softInputMode}: please show the soft
2042 * input area when normally appropriate (when the user is navigating
2043 * forward to your window).
Yohei Yukawacf68d522017-12-12 09:33:26 -08002044 *
2045 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2046 * is ignored unless there is a focused view that returns {@code true} from
2047 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002048 */
2049 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002051 /**
2052 * Visibility state for {@link #softInputMode}: please always make the
2053 * soft input area visible when this window receives input focus.
Yohei Yukawacf68d522017-12-12 09:33:26 -08002054 *
2055 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2056 * is ignored unless there is a focused view that returns {@code true} from
2057 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002058 */
2059 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002060
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002061 /**
2062 * Mask for {@link #softInputMode} of the bits that determine the
2063 * way that the window should be adjusted to accommodate the soft
2064 * input window.
2065 */
2066 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002068 /** Adjustment option for {@link #softInputMode}: nothing specified.
2069 * The system will try to pick one or
2070 * the other depending on the contents of the window.
2071 */
2072 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002074 /** Adjustment option for {@link #softInputMode}: set to allow the
2075 * window to be resized when an input
2076 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07002077 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002078 * {@link #SOFT_INPUT_ADJUST_PAN}; if
2079 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07002080 * the other depending on the contents of the window. If the window's
2081 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
2082 * value for {@link #softInputMode} will be ignored; the window will
2083 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002084 */
2085 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002087 /** Adjustment option for {@link #softInputMode}: set to have a window
2088 * pan when an input method is
2089 * shown, so it doesn't need to deal with resizing but just panned
2090 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07002091 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002092 * neither of these are set, then the system will try to pick one or
2093 * the other depending on the contents of the window.
2094 */
2095 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002096
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002097 /** Adjustment option for {@link #softInputMode}: set to have a window
2098 * not adjust for a shown input method. The window will not be resized,
2099 * and it will not be panned to make its focus visible.
2100 */
2101 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
2102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002103 /**
2104 * Bit for {@link #softInputMode}: set when the user has navigated
2105 * forward to the window. This is normally set automatically for
2106 * you by the system, though you may want to set it in certain cases
2107 * when you are displaying a window yourself. This flag will always
2108 * be cleared automatically after the window is displayed.
2109 */
2110 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002111
2112 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002113 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2114 *
2115 * @hide
2116 */
2117 @Retention(RetentionPolicy.SOURCE)
Jeff Sharkeyce8db992017-12-13 20:05:05 -07002118 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = {
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002119 SOFT_INPUT_STATE_UNSPECIFIED,
2120 SOFT_INPUT_STATE_UNCHANGED,
2121 SOFT_INPUT_STATE_HIDDEN,
2122 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
2123 SOFT_INPUT_STATE_VISIBLE,
2124 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
2125 SOFT_INPUT_ADJUST_UNSPECIFIED,
2126 SOFT_INPUT_ADJUST_RESIZE,
2127 SOFT_INPUT_ADJUST_PAN,
2128 SOFT_INPUT_ADJUST_NOTHING,
2129 SOFT_INPUT_IS_FORWARD_NAVIGATION,
2130 })
2131 public @interface SoftInputModeFlags {}
2132
2133 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08002134 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002135 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002136 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002137 * <ul>
2138 * <li> One of the visibility states
2139 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002140 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
2141 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002142 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002143 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
2144 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08002145 * </ul>
2146 *
2147 *
2148 * <p>This flag can be controlled in your theme through the
2149 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002151 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002153
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002154 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002155 * Placement of window within the screen as per {@link Gravity}. Both
2156 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2157 * android.graphics.Rect) Gravity.apply} and
2158 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2159 * Gravity.applyDisplay} are used during window layout, with this value
2160 * given as the desired gravity. For example you can specify
2161 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
2162 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
2163 * to control the behavior of
2164 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2165 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002166 *
2167 * @see Gravity
2168 */
2169 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002171 /**
2172 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002173 * between the container and the widget. See
2174 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2175 * android.graphics.Rect) Gravity.apply} for how this is used. This
2176 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002177 */
2178 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002180 /**
2181 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002182 * between the container and the widget. See
2183 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2184 * android.graphics.Rect) Gravity.apply} for how this is used. This
2185 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002186 */
2187 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002188
2189 /**
2190 * Positive insets between the drawing surface and window content.
2191 *
2192 * @hide
2193 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07002194 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08002195
2196 /**
2197 * Whether the surface insets have been manually set. When set to
2198 * {@code false}, the view root will automatically determine the
2199 * appropriate surface insets.
2200 *
2201 * @see #surfaceInsets
2202 * @hide
2203 */
2204 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002206 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07002207 * Whether the previous surface insets should be used vs. what is currently set. When set
2208 * to {@code true}, the view root will ignore surfaces insets in this object and use what
2209 * it currently has.
2210 *
2211 * @see #surfaceInsets
2212 * @hide
2213 */
2214 public boolean preservePreviousSurfaceInsets = true;
2215
2216 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002217 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08002218 * {@link android.graphics.PixelFormat}. The choice of format
2219 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002220 */
2221 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002223 /**
2224 * A style resource defining the animations to use for this window.
2225 * This must be a system resource; it can not be an application resource
2226 * because the window manager does not have access to applications.
2227 */
2228 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002229
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 /**
2231 * An alpha value to apply to this entire window.
2232 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
2233 */
2234 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002236 /**
2237 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
2238 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
2239 * dim.
2240 */
2241 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002242
2243 /**
2244 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
2245 * indicating that the brightness value is not overridden for this window
2246 * and normal brightness policy should be used.
2247 */
2248 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
2249
2250 /**
2251 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2252 * indicating that the screen or button backlight brightness should be set
2253 * to the lowest value when this window is in front.
2254 */
2255 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.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 hightest value when this window is in front.
2261 */
2262 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002263
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002264 /**
2265 * This can be used to override the user's preferred brightness of
2266 * the screen. A value of less than 0, the default, means to use the
2267 * preferred screen brightness. 0 to 1 adjusts the brightness from
2268 * dark to full bright.
2269 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002270 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002271
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002272 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002273 * This can be used to override the standard behavior of the button and
2274 * keyboard backlights. A value of less than 0, the default, means to
2275 * use the standard backlight behavior. 0 to 1 adjusts the brightness
2276 * from dark to full bright.
2277 */
2278 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
2279
2280 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07002281 * Unspecified value for {@link #rotationAnimation} indicating
2282 * a lack of preference.
2283 * @hide
2284 */
2285 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
2286
2287 /**
Robert Carr652aae42016-10-17 16:48:14 -07002288 * Value for {@link #rotationAnimation} which specifies that this
2289 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002290 */
2291 public static final int ROTATION_ANIMATION_ROTATE = 0;
2292
2293 /**
Robert Carr652aae42016-10-17 16:48:14 -07002294 * Value for {@link #rotationAnimation} which specifies that this
2295 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002296 */
2297 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
2298
2299 /**
Robert Carr652aae42016-10-17 16:48:14 -07002300 * Value for {@link #rotationAnimation} which specifies that this window
2301 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002302 */
2303 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
2304
2305 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07002306 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
2307 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07002308 * can't be applied without pausing the screen. For example, this is ideal
2309 * for Camera apps which don't want the viewfinder contents to ever rotate
2310 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
2311 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07002312 */
2313 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
2314
2315 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002316 * Define the exit and entry animations used on this window when the device is rotated.
2317 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08002318 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002319 * by other windows. All other situations default to the
2320 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002321 *
Craig Mautner3c174372013-02-21 17:54:37 -08002322 * @see #ROTATION_ANIMATION_ROTATE
2323 * @see #ROTATION_ANIMATION_CROSSFADE
2324 * @see #ROTATION_ANIMATION_JUMPCUT
2325 */
2326 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
2327
2328 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002329 * Identifier for this window. This will usually be filled in for
2330 * you.
2331 */
2332 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002334 /**
2335 * Name of the package owning this window.
2336 */
2337 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 /**
2340 * Specific orientation value for a window.
2341 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002342 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
2343 * If not set, a default value of
2344 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 * will be used.
2346 */
2347 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08002348
2349 /**
Michael Wright3f145a22014-07-22 19:46:03 -07002350 * The preferred refresh rate for the window.
2351 *
2352 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002353 * is on. The selected refresh rate will be applied to the display's default mode.
2354 *
2355 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07002356 *
2357 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002358 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07002359 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002360 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07002361 public float preferredRefreshRate;
2362
2363 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002364 * Id of the preferred display mode for the window.
2365 * <p>
2366 * This must be one of the supported modes obtained for the display(s) the window is on.
2367 * A value of {@code 0} means no preference.
2368 *
2369 * @see Display#getSupportedModes()
2370 * @see Display.Mode#getModeId()
2371 */
2372 public int preferredDisplayModeId;
2373
2374 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002375 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08002376 *
2377 * @see View#STATUS_BAR_VISIBLE
2378 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08002379 */
2380 public int systemUiVisibility;
2381
2382 /**
Joe Onorato14782f72011-01-25 19:53:17 -08002383 * @hide
2384 * The ui visibility as requested by the views in this hierarchy.
2385 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
2386 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002387 @UnsupportedAppUsage
Joe Onorato14782f72011-01-25 19:53:17 -08002388 public int subtreeSystemUiVisibility;
2389
2390 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002391 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002392 *
Joe Onorato664644d2011-01-23 17:53:23 -08002393 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
2394 *
2395 * @hide
2396 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002397 @UnsupportedAppUsage
Joe Onorato664644d2011-01-23 17:53:23 -08002398 public boolean hasSystemUiListeners;
2399
Adrian Roosfa02da62018-01-15 16:01:18 +01002400
2401 /** @hide */
2402 @Retention(RetentionPolicy.SOURCE)
2403 @IntDef(
2404 flag = true,
2405 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
Adrian Roos87526af2018-03-27 16:36:25 +02002406 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
Adrian Roosfa02da62018-01-15 16:01:18 +01002407 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER})
2408 @interface LayoutInDisplayCutoutMode {}
2409
2410 /**
2411 * Controls how the window is laid out if there is a {@link DisplayCutout}.
2412 *
2413 * <p>
2414 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}.
2415 *
2416 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
Adrian Roos87526af2018-03-27 16:36:25 +02002417 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Adrian Roosfa02da62018-01-15 16:01:18 +01002418 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
2419 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002420 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2421 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002422 */
2423 @LayoutInDisplayCutoutMode
2424 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
2425
2426 /**
2427 * The window is allowed to extend into the {@link DisplayCutout} area, only if the
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002428 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is
Adrian Roosfa02da62018-01-15 16:01:18 +01002429 * laid out such that it does not overlap with the {@link DisplayCutout} area.
2430 *
2431 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002432 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or
2433 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait
2434 * if the cutout is at the top edge. Similarly for
2435 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen.
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002436 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the
Adrian Roosfa02da62018-01-15 16:01:18 +01002437 * cutout area.
2438 *
2439 * <p>
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002440 * The usual precautions for not overlapping with the status and navigation bar are
2441 * sufficient for ensuring that no important content overlaps with the DisplayCutout.
Adrian Roosfa02da62018-01-15 16:01:18 +01002442 *
2443 * @see DisplayCutout
2444 * @see WindowInsets
Adrian Roos87526af2018-03-27 16:36:25 +02002445 * @see #layoutInDisplayCutoutMode
2446 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2447 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002448 */
2449 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;
2450
2451 /**
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002452 * @deprecated use {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES}
2453 * @hide
2454 */
2455 @Deprecated
2456 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 1;
2457
2458 /**
2459 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
2460 * edges of the screen.
2461 *
2462 * The window will never extend into a {@link DisplayCutout} area on the long edges of the
2463 * screen.
Adrian Roosfa02da62018-01-15 16:01:18 +01002464 *
2465 * <p>
2466 * The window must make sure that no important content overlaps with the
2467 * {@link DisplayCutout}.
2468 *
Adrian Roosad1da312018-03-27 19:17:50 +02002469 * <p>
2470 * In this mode, the window extends under cutouts on the short edge of the display in both
2471 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/>
2472 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png"
2473 * height="720"
2474 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in
2475 * portrait, no letterbox is applied."/>
2476 *
2477 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png"
2478 * width="720"
2479 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape,
2480 * no letterbox is applied."/>
2481 *
2482 * <p>
2483 * A cutout in the corner is considered to be on the short edge: <br/>
2484 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png"
2485 * height="720"
2486 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in
2487 * portrait, no letterbox is applied."/>
2488 *
2489 * <p>
2490 * On the other hand, should the cutout be on the long edge of the display, a letterbox will
2491 * be applied such that the window does not extend into the cutout on either long edge:
2492 * <br/>
2493 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png"
2494 * height="720"
2495 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait,
2496 * letterbox is applied."/>
2497 *
Adrian Roosfa02da62018-01-15 16:01:18 +01002498 * @see DisplayCutout
2499 * @see WindowInsets#getDisplayCutout()
Adrian Roos87526af2018-03-27 16:36:25 +02002500 * @see #layoutInDisplayCutoutMode
2501 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2502 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002503 */
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002504 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1;
Adrian Roosfa02da62018-01-15 16:01:18 +01002505
2506 /**
2507 * The window is never allowed to overlap with the DisplayCutout area.
2508 *
2509 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002510 * This should be used with windows that transiently set
2511 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION}
2512 * to avoid a relayout of the window when the respective flag is set or cleared.
Adrian Roosfa02da62018-01-15 16:01:18 +01002513 *
2514 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002515 * @see #layoutInDisplayCutoutMode
2516 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2517 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002518 */
2519 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;
2520
2521
Jeff Brown474dcb52011-06-14 20:22:50 -07002522 /**
2523 * When this window has focus, disable touch pad pointer gesture processing.
2524 * The window will receive raw position updates from the touch pad instead
2525 * of pointer movements and synthetic touch events.
2526 *
2527 * @hide
2528 */
2529 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
2530
2531 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07002532 * Does not construct an input channel for this window. The channel will therefore
2533 * be incapable of receiving input.
2534 *
2535 * @hide
2536 */
2537 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
2538
2539 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002540 * When this window has focus, does not call user activity for all input events so
2541 * the application will have to do it itself. Should only be used by
2542 * the keyguard and phone app.
2543 * <p>
2544 * Should only be used by the keyguard and phone app.
2545 * </p>
2546 *
2547 * @hide
2548 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002549 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002550 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
2551
2552 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07002553 * Control special features of the input subsystem.
2554 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002555 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07002556 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002557 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07002558 * @hide
2559 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002560 @UnsupportedAppUsage
Jeff Brown474dcb52011-06-14 20:22:50 -07002561 public int inputFeatures;
2562
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002563 /**
2564 * Sets the number of milliseconds before the user activity timeout occurs
2565 * when this window has focus. A value of -1 uses the standard timeout.
2566 * A value of 0 uses the minimum support display timeout.
2567 * <p>
2568 * This property can only be used to reduce the user specified display timeout;
2569 * it can never make the timeout longer than it normally would be.
2570 * </p><p>
2571 * Should only be used by the keyguard and phone app.
2572 * </p>
2573 *
2574 * @hide
2575 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002576 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002577 public long userActivityTimeout = -1;
2578
Phil Weaver396d5492016-03-22 17:53:50 -07002579 /**
2580 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
2581 * window.
2582 *
2583 * @hide
2584 */
Phil Weaver8583ae82018-02-13 11:01:24 -08002585 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
Phil Weaver396d5492016-03-22 17:53:50 -07002586
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002587 /**
2588 * The window title isn't kept in sync with what is displayed in the title bar, so we
2589 * separately track the currently shown title to provide to accessibility.
2590 *
2591 * @hide
2592 */
Alan Viverette39259dd2017-05-25 11:10:46 -04002593 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002594 public CharSequence accessibilityTitle;
2595
Robert Carr70f0d222016-04-10 16:33:08 -07002596 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002597 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07002598 * by the window manager. Useful for transient notifications like toasts
2599 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002600 * is hidden. Must be specified at window creation time. Note that apps
2601 * are not prepared to handle their windows being removed without their
2602 * explicit request and may try to interact with the removed window
2603 * resulting in undefined behavior and crashes. Therefore, we do hide
2604 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07002605 *
2606 * @hide
2607 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002608 @UnsupportedAppUsage
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002609 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07002610
Romain Guy48327452017-01-23 17:03:35 -08002611 /**
2612 * The color mode requested by this window. The target display may
2613 * not be able to honor the request. When the color mode is not set
2614 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
2615 * pixel format specified in {@link #format}.
2616 *
2617 * @hide
2618 */
2619 @ActivityInfo.ColorMode
Jorim Jaggi484851b2017-09-22 16:03:27 +02002620 private int mColorMode = COLOR_MODE_DEFAULT;
Romain Guy48327452017-01-23 17:03:35 -08002621
Jorim Jaggib7848b72018-12-28 14:38:21 +01002622 /**
2623 * Carries the requests about {@link WindowInsetsController.Appearance} and
2624 * {@link WindowInsetsController.Behavior} to the system windows which can produce insets.
2625 *
2626 * @hide
2627 */
2628 public final InsetsFlags insetsFlags = new InsetsFlags();
2629
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002630 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08002631 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002632 type = TYPE_APPLICATION;
2633 format = PixelFormat.OPAQUE;
2634 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002635
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002636 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08002637 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002638 type = _type;
2639 format = PixelFormat.OPAQUE;
2640 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002642 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08002643 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002644 type = _type;
2645 flags = _flags;
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, int _format) {
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 = _format;
2654 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002655
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2657 super(w, h);
2658 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 xpos, int ypos, int _type,
2664 int _flags, int _format) {
2665 super(w, h);
2666 x = xpos;
2667 y = ypos;
2668 type = _type;
2669 flags = _flags;
2670 format = _format;
2671 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002672
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002673 public final void setTitle(CharSequence title) {
2674 if (null == title)
2675 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002676
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002677 mTitle = TextUtils.stringOrSpannedString(title);
2678 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002679
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002680 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002681 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002682 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002683
Wale Ogunwale246c2092016-04-07 14:12:44 -07002684 /**
2685 * Sets the surface insets based on the elevation (visual z position) of the input view.
2686 * @hide
2687 */
2688 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
2689 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07002690 // Partial workaround for b/28318973. Every inset change causes a freeform window
2691 // to jump a little for a few frames. If we never allow surface insets to decrease,
2692 // they will stabilize quickly (often from the very beginning, as most windows start
2693 // as focused).
2694 // TODO(b/22668382) to fix this properly.
2695 if (surfaceInset == 0) {
2696 // OK to have 0 (this is the case for non-freeform windows).
2697 surfaceInsets.set(0, 0, 0, 0);
2698 } else {
2699 surfaceInsets.set(
2700 Math.max(surfaceInset, surfaceInsets.left),
2701 Math.max(surfaceInset, surfaceInsets.top),
2702 Math.max(surfaceInset, surfaceInsets.right),
2703 Math.max(surfaceInset, surfaceInsets.bottom));
2704 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002705 hasManualSurfaceInsets = manual;
2706 preservePreviousSurfaceInsets = preservePrevious;
2707 }
2708
Romain Guy48327452017-01-23 17:03:35 -08002709 /**
2710 * <p>Set the color mode of the window. Setting the color mode might
2711 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
2712 *
2713 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2714 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
2715 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
2716 *
2717 * @see #getColorMode()
2718 */
2719 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
2720 mColorMode = colorMode;
2721 }
2722
2723 /**
2724 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2725 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
2726 *
2727 * @see #setColorMode(int)
2728 */
2729 @ActivityInfo.ColorMode
2730 public int getColorMode() {
2731 return mColorMode;
2732 }
2733
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002734 /** @hide */
2735 @SystemApi
2736 public final void setUserActivityTimeout(long timeout) {
2737 userActivityTimeout = timeout;
2738 }
2739
2740 /** @hide */
2741 @SystemApi
2742 public final long getUserActivityTimeout() {
2743 return userActivityTimeout;
2744 }
2745
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 public int describeContents() {
2747 return 0;
2748 }
2749
2750 public void writeToParcel(Parcel out, int parcelableFlags) {
2751 out.writeInt(width);
2752 out.writeInt(height);
2753 out.writeInt(x);
2754 out.writeInt(y);
2755 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002756 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002757 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002758 out.writeInt(softInputMode);
Adrian Roosfa02da62018-01-15 16:01:18 +01002759 out.writeInt(layoutInDisplayCutoutMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002760 out.writeInt(gravity);
2761 out.writeFloat(horizontalMargin);
2762 out.writeFloat(verticalMargin);
2763 out.writeInt(format);
2764 out.writeInt(windowAnimations);
2765 out.writeFloat(alpha);
2766 out.writeFloat(dimAmount);
2767 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002768 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08002769 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 out.writeStrongBinder(token);
2771 out.writeString(packageName);
2772 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
2773 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07002774 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002775 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08002776 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08002777 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08002778 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07002779 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002780 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07002781 out.writeInt(surfaceInsets.left);
2782 out.writeInt(surfaceInsets.top);
2783 out.writeInt(surfaceInsets.right);
2784 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08002785 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07002786 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002787 out.writeInt(needsMenuKey);
Phil Weaver8583ae82018-02-13 11:01:24 -08002788 out.writeLong(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002789 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07002790 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002791 out.writeLong(hideTimeoutMilliseconds);
Jorim Jaggib7848b72018-12-28 14:38:21 +01002792 out.writeInt(insetsFlags.appearance);
2793 out.writeInt(insetsFlags.behavior);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002794 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002795
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07002796 public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002797 = new Parcelable.Creator<LayoutParams>() {
2798 public LayoutParams createFromParcel(Parcel in) {
2799 return new LayoutParams(in);
2800 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002801
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 public LayoutParams[] newArray(int size) {
2803 return new LayoutParams[size];
2804 }
2805 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002806
2807
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 public LayoutParams(Parcel in) {
2809 width = in.readInt();
2810 height = in.readInt();
2811 x = in.readInt();
2812 y = in.readInt();
2813 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002814 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002815 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 softInputMode = in.readInt();
Adrian Roosfa02da62018-01-15 16:01:18 +01002817 layoutInDisplayCutoutMode = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 gravity = in.readInt();
2819 horizontalMargin = in.readFloat();
2820 verticalMargin = in.readFloat();
2821 format = in.readInt();
2822 windowAnimations = in.readInt();
2823 alpha = in.readFloat();
2824 dimAmount = in.readFloat();
2825 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002826 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08002827 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 token = in.readStrongBinder();
2829 packageName = in.readString();
2830 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
2831 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07002832 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002833 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002834 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08002835 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002836 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07002837 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002838 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07002839 surfaceInsets.left = in.readInt();
2840 surfaceInsets.top = in.readInt();
2841 surfaceInsets.right = in.readInt();
2842 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08002843 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07002844 preservePreviousSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002845 needsMenuKey = in.readInt();
Phil Weaver8583ae82018-02-13 11:01:24 -08002846 accessibilityIdOfAnchor = in.readLong();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002847 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07002848 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002849 hideTimeoutMilliseconds = in.readLong();
Jorim Jaggib7848b72018-12-28 14:38:21 +01002850 insetsFlags.appearance = in.readInt();
2851 insetsFlags.behavior = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002852 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002853
Romain Guy72998072009-06-22 11:09:20 -07002854 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 public static final int LAYOUT_CHANGED = 1<<0;
2856 public static final int TYPE_CHANGED = 1<<1;
2857 public static final int FLAGS_CHANGED = 1<<2;
2858 public static final int FORMAT_CHANGED = 1<<3;
2859 public static final int ANIMATION_CHANGED = 1<<4;
2860 public static final int DIM_AMOUNT_CHANGED = 1<<5;
2861 public static final int TITLE_CHANGED = 1<<6;
2862 public static final int ALPHA_CHANGED = 1<<7;
2863 public static final int MEMORY_TYPE_CHANGED = 1<<8;
2864 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
2865 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
2866 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08002867 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002868 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002869 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08002870 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002871 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08002872 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002873 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07002874 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002875 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002876 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002877 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07002878 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002879 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002880 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04002881 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
2882 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07002883 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002884 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07002885 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
2886 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002887 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
2888 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002889 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
2890 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07002891 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
2892 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04002893 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002894 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
2895 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07002896 public static final int COLOR_MODE_CHANGED = 1 << 26;
2897 /** {@hide} */
Jorim Jaggib7848b72018-12-28 14:38:21 +01002898 public static final int INSET_FLAGS_CHANGED = 1 << 27;
Romain Guyf21c9b02011-09-06 16:56:54 -07002899
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002900 // internal buffer to backup/restore parameters under compatibility mode.
2901 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002902
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002903 public final int copyFrom(LayoutParams o) {
2904 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002905
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002906 if (width != o.width) {
2907 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07002908 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002909 }
2910 if (height != o.height) {
2911 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07002912 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002913 }
2914 if (x != o.x) {
2915 x = o.x;
2916 changes |= LAYOUT_CHANGED;
2917 }
2918 if (y != o.y) {
2919 y = o.y;
2920 changes |= LAYOUT_CHANGED;
2921 }
2922 if (horizontalWeight != o.horizontalWeight) {
2923 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002924 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002925 }
2926 if (verticalWeight != o.verticalWeight) {
2927 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002928 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002929 }
2930 if (horizontalMargin != o.horizontalMargin) {
2931 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002932 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 }
2934 if (verticalMargin != o.verticalMargin) {
2935 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002936 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002937 }
2938 if (type != o.type) {
2939 type = o.type;
2940 changes |= TYPE_CHANGED;
2941 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002942 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04002943 final int diff = flags ^ o.flags;
2944 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
2945 changes |= TRANSLUCENT_FLAGS_CHANGED;
2946 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002947 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07002948 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002949 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002950 if (privateFlags != o.privateFlags) {
2951 privateFlags = o.privateFlags;
2952 changes |= PRIVATE_FLAGS_CHANGED;
2953 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 if (softInputMode != o.softInputMode) {
2955 softInputMode = o.softInputMode;
2956 changes |= SOFT_INPUT_MODE_CHANGED;
2957 }
Adrian Roosfa02da62018-01-15 16:01:18 +01002958 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) {
2959 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode;
2960 changes |= LAYOUT_CHANGED;
2961 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002962 if (gravity != o.gravity) {
2963 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07002964 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002965 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 if (format != o.format) {
2967 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07002968 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 }
2970 if (windowAnimations != o.windowAnimations) {
2971 windowAnimations = o.windowAnimations;
2972 changes |= ANIMATION_CHANGED;
2973 }
2974 if (token == null) {
2975 // NOTE: token only copied if the recipient doesn't
2976 // already have one.
2977 token = o.token;
2978 }
2979 if (packageName == null) {
2980 // NOTE: packageName only copied if the recipient doesn't
2981 // already have one.
2982 packageName = o.packageName;
2983 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08002984 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002985 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 mTitle = o.mTitle;
2987 changes |= TITLE_CHANGED;
2988 }
2989 if (alpha != o.alpha) {
2990 alpha = o.alpha;
2991 changes |= ALPHA_CHANGED;
2992 }
2993 if (dimAmount != o.dimAmount) {
2994 dimAmount = o.dimAmount;
2995 changes |= DIM_AMOUNT_CHANGED;
2996 }
2997 if (screenBrightness != o.screenBrightness) {
2998 screenBrightness = o.screenBrightness;
2999 changes |= SCREEN_BRIGHTNESS_CHANGED;
3000 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003001 if (buttonBrightness != o.buttonBrightness) {
3002 buttonBrightness = o.buttonBrightness;
3003 changes |= BUTTON_BRIGHTNESS_CHANGED;
3004 }
Craig Mautner3c174372013-02-21 17:54:37 -08003005 if (rotationAnimation != o.rotationAnimation) {
3006 rotationAnimation = o.rotationAnimation;
3007 changes |= ROTATION_ANIMATION_CHANGED;
3008 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003009
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003010 if (screenOrientation != o.screenOrientation) {
3011 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07003012 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003013 }
Romain Guy529b60a2010-08-03 18:05:47 -07003014
Michael Wright3f145a22014-07-22 19:46:03 -07003015 if (preferredRefreshRate != o.preferredRefreshRate) {
3016 preferredRefreshRate = o.preferredRefreshRate;
3017 changes |= PREFERRED_REFRESH_RATE_CHANGED;
3018 }
3019
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003020 if (preferredDisplayModeId != o.preferredDisplayModeId) {
3021 preferredDisplayModeId = o.preferredDisplayModeId;
3022 changes |= PREFERRED_DISPLAY_MODE_ID;
3023 }
3024
Joe Onorato14782f72011-01-25 19:53:17 -08003025 if (systemUiVisibility != o.systemUiVisibility
3026 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08003027 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08003028 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08003029 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
3030 }
3031
3032 if (hasSystemUiListeners != o.hasSystemUiListeners) {
3033 hasSystemUiListeners = o.hasSystemUiListeners;
3034 changes |= SYSTEM_UI_LISTENER_CHANGED;
3035 }
3036
Jeff Brown474dcb52011-06-14 20:22:50 -07003037 if (inputFeatures != o.inputFeatures) {
3038 inputFeatures = o.inputFeatures;
3039 changes |= INPUT_FEATURES_CHANGED;
3040 }
3041
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003042 if (userActivityTimeout != o.userActivityTimeout) {
3043 userActivityTimeout = o.userActivityTimeout;
3044 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
3045 }
3046
Alan Viverette49a22e82014-07-12 20:01:27 -07003047 if (!surfaceInsets.equals(o.surfaceInsets)) {
3048 surfaceInsets.set(o.surfaceInsets);
3049 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003050 }
3051
Alan Viverette5435a302015-01-29 10:25:34 -08003052 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
3053 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
3054 changes |= SURFACE_INSETS_CHANGED;
3055 }
3056
Wale Ogunwale246c2092016-04-07 14:12:44 -07003057 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
3058 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
3059 changes |= SURFACE_INSETS_CHANGED;
3060 }
3061
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003062 if (needsMenuKey != o.needsMenuKey) {
3063 needsMenuKey = o.needsMenuKey;
3064 changes |= NEEDS_MENU_KEY_CHANGED;
3065 }
3066
Phil Weaver396d5492016-03-22 17:53:50 -07003067 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
3068 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
3069 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
3070 }
3071
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003072 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
3073 && o.accessibilityTitle != null) {
3074 // NOTE: accessibilityTitle only copied if the originator set one.
3075 accessibilityTitle = o.accessibilityTitle;
3076 changes |= ACCESSIBILITY_TITLE_CHANGED;
3077 }
3078
Romain Guy26a2b972017-04-17 09:39:51 -07003079 if (mColorMode != o.mColorMode) {
3080 mColorMode = o.mColorMode;
3081 changes |= COLOR_MODE_CHANGED;
3082 }
3083
Robert Carr70f0d222016-04-10 16:33:08 -07003084 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003085 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07003086
Jorim Jaggib7848b72018-12-28 14:38:21 +01003087 if (insetsFlags.appearance != o.insetsFlags.appearance) {
3088 insetsFlags.appearance = o.insetsFlags.appearance;
3089 changes |= INSET_FLAGS_CHANGED;
3090 }
3091
3092 if (insetsFlags.behavior != o.insetsFlags.behavior) {
3093 insetsFlags.behavior = o.insetsFlags.behavior;
3094 changes |= INSET_FLAGS_CHANGED;
3095 }
3096
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003097 return changes;
3098 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003100 @Override
3101 public String debug(String output) {
3102 output += "Contents of " + this + ":";
3103 Log.d("Debug", output);
3104 output = super.debug("");
3105 Log.d("Debug", output);
3106 Log.d("Debug", "");
3107 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
3108 return "";
3109 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003111 @Override
3112 public String toString() {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003113 return toString("");
3114 }
3115
3116 /**
3117 * @hide
3118 */
Felipe Lemeda9ea342018-03-22 15:19:51 -07003119 public void dumpDimensions(StringBuilder sb) {
3120 sb.append('(');
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003121 sb.append(x);
3122 sb.append(',');
3123 sb.append(y);
3124 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08003125 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
3126 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003127 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08003128 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
3129 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003130 sb.append(")");
Felipe Lemeda9ea342018-03-22 15:19:51 -07003131 }
3132
3133 /**
3134 * @hide
3135 */
3136 public String toString(String prefix) {
3137 StringBuilder sb = new StringBuilder(256);
3138 sb.append('{');
3139 dumpDimensions(sb);
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003140 if (horizontalMargin != 0) {
3141 sb.append(" hm=");
3142 sb.append(horizontalMargin);
3143 }
3144 if (verticalMargin != 0) {
3145 sb.append(" vm=");
3146 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003147 }
3148 if (gravity != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003149 sb.append(" gr=");
3150 sb.append(Gravity.toString(gravity));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003152 if (softInputMode != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003153 sb.append(" sim={");
3154 sb.append(softInputModeToString(softInputMode));
3155 sb.append('}');
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003156 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003157 if (layoutInDisplayCutoutMode != 0) {
3158 sb.append(" layoutInDisplayCutoutMode=");
3159 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode));
3160 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003161 sb.append(" ty=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003162 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003163 if (format != PixelFormat.OPAQUE) {
3164 sb.append(" fmt=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003165 sb.append(PixelFormat.formatToString(format));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003166 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003167 if (windowAnimations != 0) {
3168 sb.append(" wanim=0x");
3169 sb.append(Integer.toHexString(windowAnimations));
3170 }
3171 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
3172 sb.append(" or=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003173 sb.append(ActivityInfo.screenOrientationToString(screenOrientation));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003174 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003175 if (alpha != 1.0f) {
3176 sb.append(" alpha=");
3177 sb.append(alpha);
3178 }
3179 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3180 sb.append(" sbrt=");
3181 sb.append(screenBrightness);
3182 }
3183 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3184 sb.append(" bbrt=");
3185 sb.append(buttonBrightness);
3186 }
Craig Mautner3c174372013-02-21 17:54:37 -08003187 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
3188 sb.append(" rotAnim=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003189 sb.append(rotationAnimationToString(rotationAnimation));
Craig Mautner3c174372013-02-21 17:54:37 -08003190 }
Michael Wright3f145a22014-07-22 19:46:03 -07003191 if (preferredRefreshRate != 0) {
3192 sb.append(" preferredRefreshRate=");
3193 sb.append(preferredRefreshRate);
3194 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003195 if (preferredDisplayModeId != 0) {
3196 sb.append(" preferredDisplayMode=");
3197 sb.append(preferredDisplayModeId);
3198 }
Joe Onorato664644d2011-01-23 17:53:23 -08003199 if (hasSystemUiListeners) {
3200 sb.append(" sysuil=");
3201 sb.append(hasSystemUiListeners);
3202 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003203 if (inputFeatures != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003204 sb.append(" if=").append(inputFeatureToString(inputFeatures));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003205 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003206 if (userActivityTimeout >= 0) {
3207 sb.append(" userActivityTimeout=").append(userActivityTimeout);
3208 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07003209 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07003210 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
3211 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07003212 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08003213 if (hasManualSurfaceInsets) {
3214 sb.append(" (manual)");
3215 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003216 if (!preservePreviousSurfaceInsets) {
3217 sb.append(" (!preservePreviousSurfaceInsets)");
3218 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07003219 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003220 if (needsMenuKey == NEEDS_MENU_SET_TRUE) {
3221 sb.append(" needsMenuKey");
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003222 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003223 if (mColorMode != COLOR_MODE_DEFAULT) {
3224 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode));
3225 }
3226 sb.append(System.lineSeparator());
3227 sb.append(prefix).append(" fl=").append(
3228 ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
3229 if (privateFlags != 0) {
3230 sb.append(System.lineSeparator());
3231 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString(
3232 LayoutParams.class, "privateFlags", privateFlags));
3233 }
3234 if (systemUiVisibility != 0) {
3235 sb.append(System.lineSeparator());
3236 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString(
3237 View.class, "mSystemUiVisibility", systemUiVisibility));
3238 }
3239 if (subtreeSystemUiVisibility != 0) {
3240 sb.append(System.lineSeparator());
3241 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString(
3242 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility));
3243 }
Jorim Jaggib7848b72018-12-28 14:38:21 +01003244 if (insetsFlags.appearance != 0) {
3245 sb.append(System.lineSeparator());
3246 sb.append(prefix).append(" apr=").append(ViewDebug.flagsToString(
3247 InsetsFlags.class, "appearance", insetsFlags.appearance));
3248 }
3249 if (insetsFlags.behavior != 0) {
3250 sb.append(System.lineSeparator());
3251 sb.append(prefix).append(" bhv=").append(ViewDebug.flagsToString(
3252 InsetsFlags.class, "behavior", insetsFlags.behavior));
3253 }
3254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 sb.append('}');
3256 return sb.toString();
3257 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003258
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003259 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07003260 * @hide
3261 */
Jeffrey Huangcb782852019-12-05 11:28:11 -08003262 public void dumpDebug(ProtoOutputStream proto, long fieldId) {
Steven Timotiusaf03df62017-07-18 16:56:43 -07003263 final long token = proto.start(fieldId);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003264 proto.write(TYPE, type);
3265 proto.write(X, x);
3266 proto.write(Y, y);
3267 proto.write(WIDTH, width);
3268 proto.write(HEIGHT, height);
3269 proto.write(HORIZONTAL_MARGIN, horizontalMargin);
3270 proto.write(VERTICAL_MARGIN, verticalMargin);
3271 proto.write(GRAVITY, gravity);
3272 proto.write(SOFT_INPUT_MODE, softInputMode);
3273 proto.write(FORMAT, format);
3274 proto.write(WINDOW_ANIMATIONS, windowAnimations);
3275 proto.write(ALPHA, alpha);
3276 proto.write(SCREEN_BRIGHTNESS, screenBrightness);
3277 proto.write(BUTTON_BRIGHTNESS, buttonBrightness);
3278 proto.write(ROTATION_ANIMATION, rotationAnimation);
3279 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate);
3280 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId);
3281 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners);
3282 proto.write(INPUT_FEATURE_FLAGS, inputFeatures);
3283 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout);
3284 proto.write(NEEDS_MENU_KEY, needsMenuKey);
3285 proto.write(COLOR_MODE, mColorMode);
3286 proto.write(FLAGS, flags);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003287 proto.write(PRIVATE_FLAGS, privateFlags);
3288 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility);
3289 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility);
Jorim Jaggib7848b72018-12-28 14:38:21 +01003290 proto.write(APPEARANCE, insetsFlags.appearance);
3291 proto.write(BEHAVIOR, insetsFlags.behavior);
Steven Timotiusaf03df62017-07-18 16:56:43 -07003292 proto.end(token);
3293 }
3294
3295 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003296 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003297 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003298 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003299 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003300 x = (int) (x * scale + 0.5f);
3301 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003302 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003303 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003304 }
3305 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003306 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003307 }
3308 }
3309
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003310 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003311 * Backup the layout parameters used in compatibility mode.
3312 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003313 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003314 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003315 void backup() {
3316 int[] backup = mCompatibilityParamsBackup;
3317 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003318 // we backup 4 elements, x, y, width, height
3319 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003320 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003321 backup[0] = x;
3322 backup[1] = y;
3323 backup[2] = width;
3324 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003325 }
3326
3327 /**
3328 * Restore the layout params' coordinates, size and gravity
3329 * @see LayoutParams#backup()
3330 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003331 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003332 void restore() {
3333 int[] backup = mCompatibilityParamsBackup;
3334 if (backup != null) {
3335 x = backup[0];
3336 y = backup[1];
3337 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003338 height = backup[3];
3339 }
3340 }
3341
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003342 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07003343
3344 /** @hide */
3345 @Override
3346 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
3347 super.encodeProperties(encoder);
3348
3349 encoder.addProperty("x", x);
3350 encoder.addProperty("y", y);
3351 encoder.addProperty("horizontalWeight", horizontalWeight);
3352 encoder.addProperty("verticalWeight", verticalWeight);
3353 encoder.addProperty("type", type);
3354 encoder.addProperty("flags", flags);
3355 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02003356
3357 /**
3358 * @hide
3359 * @return True if the layout parameters will cause the window to cover the full screen;
3360 * false otherwise.
3361 */
3362 public boolean isFullscreen() {
3363 return x == 0 && y == 0
3364 && width == WindowManager.LayoutParams.MATCH_PARENT
3365 && height == WindowManager.LayoutParams.MATCH_PARENT;
3366 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003367
Adrian Roosfa02da62018-01-15 16:01:18 +01003368 private static String layoutInDisplayCutoutModeToString(
3369 @LayoutInDisplayCutoutMode int mode) {
3370 switch (mode) {
3371 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT:
3372 return "default";
3373 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS:
3374 return "always";
3375 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER:
3376 return "never";
3377 default:
3378 return "unknown(" + mode + ")";
3379 }
3380 }
3381
Jorim Jaggi484851b2017-09-22 16:03:27 +02003382 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) {
3383 final StringBuilder result = new StringBuilder();
3384 final int state = softInputMode & SOFT_INPUT_MASK_STATE;
3385 if (state != 0) {
3386 result.append("state=");
3387 switch (state) {
3388 case SOFT_INPUT_STATE_UNCHANGED:
3389 result.append("unchanged");
3390 break;
3391 case SOFT_INPUT_STATE_HIDDEN:
3392 result.append("hidden");
3393 break;
3394 case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
3395 result.append("always_hidden");
3396 break;
3397 case SOFT_INPUT_STATE_VISIBLE:
3398 result.append("visible");
3399 break;
3400 case SOFT_INPUT_STATE_ALWAYS_VISIBLE:
3401 result.append("always_visible");
3402 break;
3403 default:
3404 result.append(state);
3405 break;
3406 }
3407 result.append(' ');
3408 }
3409 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST;
3410 if (adjust != 0) {
3411 result.append("adjust=");
3412 switch (adjust) {
3413 case SOFT_INPUT_ADJUST_RESIZE:
3414 result.append("resize");
3415 break;
3416 case SOFT_INPUT_ADJUST_PAN:
3417 result.append("pan");
3418 break;
3419 case SOFT_INPUT_ADJUST_NOTHING:
3420 result.append("nothing");
3421 break;
3422 default:
3423 result.append(adjust);
3424 break;
3425 }
3426 result.append(' ');
3427 }
3428 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
3429 result.append("forwardNavigation").append(' ');
3430 }
3431 result.deleteCharAt(result.length() - 1);
3432 return result.toString();
3433 }
3434
3435 private static String rotationAnimationToString(int rotationAnimation) {
3436 switch (rotationAnimation) {
3437 case ROTATION_ANIMATION_UNSPECIFIED:
3438 return "UNSPECIFIED";
3439 case ROTATION_ANIMATION_ROTATE:
3440 return "ROTATE";
3441 case ROTATION_ANIMATION_CROSSFADE:
3442 return "CROSSFADE";
3443 case ROTATION_ANIMATION_JUMPCUT:
3444 return "JUMPCUT";
3445 case ROTATION_ANIMATION_SEAMLESS:
3446 return "SEAMLESS";
3447 default:
3448 return Integer.toString(rotationAnimation);
3449 }
3450 }
3451
3452 private static String inputFeatureToString(int inputFeature) {
3453 switch (inputFeature) {
3454 case INPUT_FEATURE_DISABLE_POINTER_GESTURES:
3455 return "DISABLE_POINTER_GESTURES";
3456 case INPUT_FEATURE_NO_INPUT_CHANNEL:
3457 return "NO_INPUT_CHANNEL";
3458 case INPUT_FEATURE_DISABLE_USER_ACTIVITY:
3459 return "DISABLE_USER_ACTIVITY";
3460 default:
3461 return Integer.toString(inputFeature);
3462 }
3463 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003464 }
3465}