blob: 77ce5c1b1ddc95598791042265b66c92c3fbcd81 [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;
Tiger Huang4a7835f2019-11-06 00:07:56 +080020import static android.view.WindowInsets.Side.BOTTOM;
21import static android.view.WindowInsets.Side.LEFT;
22import static android.view.WindowInsets.Side.RIGHT;
23import static android.view.WindowInsets.Side.TOP;
24import static android.view.WindowInsets.Type.CAPTION_BAR;
25import static android.view.WindowInsets.Type.IME;
26import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES;
27import static android.view.WindowInsets.Type.NAVIGATION_BARS;
28import static android.view.WindowInsets.Type.STATUS_BARS;
29import static android.view.WindowInsets.Type.SYSTEM_GESTURES;
30import static android.view.WindowInsets.Type.TAPPABLE_ELEMENT;
31import static android.view.WindowInsets.Type.WINDOW_DECOR;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080032import static android.view.WindowLayoutParamsProto.ALPHA;
Jorim Jaggib7848b72018-12-28 14:38:21 +010033import static android.view.WindowLayoutParamsProto.APPEARANCE;
34import static android.view.WindowLayoutParamsProto.BEHAVIOR;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080035import static android.view.WindowLayoutParamsProto.BUTTON_BRIGHTNESS;
36import static android.view.WindowLayoutParamsProto.COLOR_MODE;
Tiger Huang4a7835f2019-11-06 00:07:56 +080037import static android.view.WindowLayoutParamsProto.FIT_IGNORE_VISIBILITY;
38import static android.view.WindowLayoutParamsProto.FIT_INSETS_SIDES;
39import static android.view.WindowLayoutParamsProto.FIT_INSETS_TYPES;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080040import static android.view.WindowLayoutParamsProto.FLAGS;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080041import static android.view.WindowLayoutParamsProto.FORMAT;
42import static android.view.WindowLayoutParamsProto.GRAVITY;
43import static android.view.WindowLayoutParamsProto.HAS_SYSTEM_UI_LISTENERS;
44import static android.view.WindowLayoutParamsProto.HEIGHT;
45import static android.view.WindowLayoutParamsProto.HORIZONTAL_MARGIN;
46import static android.view.WindowLayoutParamsProto.INPUT_FEATURE_FLAGS;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080047import static android.view.WindowLayoutParamsProto.PREFERRED_REFRESH_RATE;
48import static android.view.WindowLayoutParamsProto.PRIVATE_FLAGS;
49import static android.view.WindowLayoutParamsProto.ROTATION_ANIMATION;
50import static android.view.WindowLayoutParamsProto.SCREEN_BRIGHTNESS;
51import static android.view.WindowLayoutParamsProto.SOFT_INPUT_MODE;
52import static android.view.WindowLayoutParamsProto.SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS;
53import static android.view.WindowLayoutParamsProto.SYSTEM_UI_VISIBILITY_FLAGS;
54import static android.view.WindowLayoutParamsProto.TYPE;
55import static android.view.WindowLayoutParamsProto.USER_ACTIVITY_TIMEOUT;
56import static android.view.WindowLayoutParamsProto.VERTICAL_MARGIN;
57import static android.view.WindowLayoutParamsProto.WIDTH;
58import static android.view.WindowLayoutParamsProto.WINDOW_ANIMATIONS;
59import static android.view.WindowLayoutParamsProto.X;
60import static android.view.WindowLayoutParamsProto.Y;
Jorim Jaggi484851b2017-09-22 16:03:27 +020061
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020062import android.Manifest.permission;
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080063import android.annotation.IntDef;
Siva Velusamy0d857b92015-04-22 10:23:56 -070064import android.annotation.NonNull;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040065import android.annotation.RequiresPermission;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080066import android.annotation.SystemApi;
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060067import android.annotation.SystemService;
Robert Carrb48380a2017-04-04 14:56:37 -070068import android.annotation.TestApi;
Jorim Jaggi241ae102016-11-02 21:57:33 -070069import android.app.KeyguardManager;
Jeff Browna492c3a2012-08-23 19:48:44 -070070import android.app.Presentation;
Artur Satayevad9254c2019-12-10 17:47:54 +000071import android.compat.annotation.UnsupportedAppUsage;
Jeff Browna492c3a2012-08-23 19:48:44 -070072import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073import android.content.pm.ActivityInfo;
74import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070075import android.graphics.Rect;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040076import android.graphics.Region;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077import android.os.IBinder;
78import android.os.Parcel;
79import android.os.Parcelable;
80import android.text.TextUtils;
81import android.util.Log;
Steven Timotiusaf03df62017-07-18 16:56:43 -070082import android.util.proto.ProtoOutputStream;
Jorim Jaggi1f08f642020-01-29 13:11:46 +010083import android.view.View.OnApplyWindowInsetsListener;
Tiger Huang4a7835f2019-11-06 00:07:56 +080084import android.view.WindowInsets.Side;
85import android.view.WindowInsets.Side.InsetsSide;
86import android.view.WindowInsets.Type;
87import android.view.WindowInsets.Type.InsetsType;
Phil Weaver8583ae82018-02-13 11:01:24 -080088import android.view.accessibility.AccessibilityNodeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080090import java.lang.annotation.Retention;
91import java.lang.annotation.RetentionPolicy;
Yuncheol Heo13a6eb62020-03-04 23:50:37 -080092import java.util.Arrays;
Clara Bayarri75e09792015-07-29 16:20:40 +010093import java.util.List;
Wale Ogunwale1f240c92016-02-22 18:04:58 -080094import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095
96/**
97 * The interface that apps use to talk to the window manager.
Jeff Browna492c3a2012-08-23 19:48:44 -070098 * </p><p>
99 * Each window manager instance is bound to a particular {@link Display}.
100 * To obtain a {@link WindowManager} for a different display, use
101 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
102 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
103 * to get the WindowManager.
104 * </p><p>
105 * The simplest way to show a window on another display is to create a
106 * {@link Presentation}. The presentation will automatically obtain a
107 * {@link WindowManager} and {@link Context} for that display.
108 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 */
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -0600110@SystemService(Context.WINDOW_SERVICE)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111public interface WindowManager extends ViewManager {
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100112
113 /** @hide */
114 int DOCKED_INVALID = -1;
115 /** @hide */
116 int DOCKED_LEFT = 1;
117 /** @hide */
118 int DOCKED_TOP = 2;
119 /** @hide */
120 int DOCKED_RIGHT = 3;
121 /** @hide */
122 int DOCKED_BOTTOM = 4;
123
Winson41275482016-10-10 15:17:45 -0700124 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000125 String INPUT_CONSUMER_PIP = "pip_input_consumer";
Winson41275482016-10-10 15:17:45 -0700126 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000127 String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer";
Winson41275482016-10-10 15:17:45 -0700128 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000129 String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer";
130 /** @hide */
131 String INPUT_CONSUMER_RECENTS_ANIMATION = "recents_animation_input_consumer";
Winson41275482016-10-10 15:17:45 -0700132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100134 * Not set up for a transition.
135 * @hide
136 */
137 int TRANSIT_UNSET = -1;
138
139 /**
140 * No animation for transition.
141 * @hide
142 */
143 int TRANSIT_NONE = 0;
144
145 /**
146 * A window in a new activity is being opened on top of an existing one in the same task.
147 * @hide
148 */
149 int TRANSIT_ACTIVITY_OPEN = 6;
150
151 /**
152 * The window in the top-most activity is being closed to reveal the previous activity in the
153 * same task.
154 * @hide
155 */
156 int TRANSIT_ACTIVITY_CLOSE = 7;
157
158 /**
159 * A window in a new task is being opened on top of an existing one in another activity's task.
160 * @hide
161 */
162 int TRANSIT_TASK_OPEN = 8;
163
164 /**
165 * A window in the top-most activity is being closed to reveal the previous activity in a
166 * different task.
167 * @hide
168 */
169 int TRANSIT_TASK_CLOSE = 9;
170
171 /**
172 * A window in an existing task is being displayed on top of an existing one in another
173 * activity's task.
174 * @hide
175 */
176 int TRANSIT_TASK_TO_FRONT = 10;
177
178 /**
179 * A window in an existing task is being put below all other tasks.
180 * @hide
181 */
182 int TRANSIT_TASK_TO_BACK = 11;
183
184 /**
185 * A window in a new activity that doesn't have a wallpaper is being opened on top of one that
186 * does, effectively closing the wallpaper.
187 * @hide
188 */
189 int TRANSIT_WALLPAPER_CLOSE = 12;
190
191 /**
192 * A window in a new activity that does have a wallpaper is being opened on one that didn't,
193 * effectively opening the wallpaper.
194 * @hide
195 */
196 int TRANSIT_WALLPAPER_OPEN = 13;
197
198 /**
199 * A window in a new activity is being opened on top of an existing one, and both are on top
200 * of the wallpaper.
201 * @hide
202 */
203 int TRANSIT_WALLPAPER_INTRA_OPEN = 14;
204
205 /**
206 * The window in the top-most activity is being closed to reveal the previous activity, and
207 * both are on top of the wallpaper.
208 * @hide
209 */
210 int TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
211
212 /**
213 * A window in a new task is being opened behind an existing one in another activity's task.
214 * The new window will show briefly and then be gone.
215 * @hide
216 */
217 int TRANSIT_TASK_OPEN_BEHIND = 16;
218
219 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100220 * An activity is being relaunched (e.g. due to configuration change).
221 * @hide
222 */
223 int TRANSIT_ACTIVITY_RELAUNCH = 18;
224
225 /**
226 * A task is being docked from recents.
227 * @hide
228 */
229 int TRANSIT_DOCK_TASK_FROM_RECENTS = 19;
230
231 /**
232 * Keyguard is going away.
233 * @hide
234 */
235 int TRANSIT_KEYGUARD_GOING_AWAY = 20;
236
237 /**
238 * Keyguard is going away with showing an activity behind that requests wallpaper.
239 * @hide
240 */
241 int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
242
243 /**
244 * Keyguard is being occluded.
245 * @hide
246 */
247 int TRANSIT_KEYGUARD_OCCLUDE = 22;
248
249 /**
250 * Keyguard is being unoccluded.
251 * @hide
252 */
253 int TRANSIT_KEYGUARD_UNOCCLUDE = 23;
254
255 /**
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200256 * A translucent activity is being opened.
257 * @hide
258 */
259 int TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24;
260
261 /**
262 * A translucent activity is being closed.
263 * @hide
264 */
265 int TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25;
266
267 /**
Adrian Roos93577212018-04-10 14:12:10 -0700268 * A crashing activity is being closed.
269 * @hide
270 */
271 int TRANSIT_CRASHING_ACTIVITY_CLOSE = 26;
272
273 /**
Evan Rosky2289ba12018-11-19 18:28:18 -0800274 * A task is changing windowing modes
275 * @hide
276 */
277 int TRANSIT_TASK_CHANGE_WINDOWING_MODE = 27;
278
279 /**
Issei Suzukicac2a502019-04-16 16:52:50 +0200280 * A display which can only contain one task is being shown because the first activity is
281 * started or it's being turned on.
282 * @hide
283 */
284 int TRANSIT_SHOW_SINGLE_TASK_DISPLAY = 28;
285
286 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100287 * @hide
288 */
289 @IntDef(prefix = { "TRANSIT_" }, value = {
290 TRANSIT_UNSET,
291 TRANSIT_NONE,
292 TRANSIT_ACTIVITY_OPEN,
293 TRANSIT_ACTIVITY_CLOSE,
294 TRANSIT_TASK_OPEN,
295 TRANSIT_TASK_CLOSE,
296 TRANSIT_TASK_TO_FRONT,
297 TRANSIT_TASK_TO_BACK,
298 TRANSIT_WALLPAPER_CLOSE,
299 TRANSIT_WALLPAPER_OPEN,
300 TRANSIT_WALLPAPER_INTRA_OPEN,
301 TRANSIT_WALLPAPER_INTRA_CLOSE,
302 TRANSIT_TASK_OPEN_BEHIND,
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100303 TRANSIT_ACTIVITY_RELAUNCH,
304 TRANSIT_DOCK_TASK_FROM_RECENTS,
305 TRANSIT_KEYGUARD_GOING_AWAY,
306 TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
307 TRANSIT_KEYGUARD_OCCLUDE,
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200308 TRANSIT_KEYGUARD_UNOCCLUDE,
309 TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
Jorim Jaggi9c52ebb2018-06-01 14:45:24 +0200310 TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
Evan Rosky2289ba12018-11-19 18:28:18 -0800311 TRANSIT_CRASHING_ACTIVITY_CLOSE,
Issei Suzukicac2a502019-04-16 16:52:50 +0200312 TRANSIT_TASK_CHANGE_WINDOWING_MODE,
313 TRANSIT_SHOW_SINGLE_TASK_DISPLAY
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100314 })
315 @Retention(RetentionPolicy.SOURCE)
316 @interface TransitionType {}
317
318 /**
319 * Transition flag: Keyguard is going away, but keeping the notification shade open
320 * @hide
321 */
322 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE = 0x1;
323
324 /**
325 * Transition flag: Keyguard is going away, but doesn't want an animation for it
326 * @hide
327 */
328 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION = 0x2;
329
330 /**
331 * Transition flag: Keyguard is going away while it was showing the system wallpaper.
332 * @hide
333 */
334 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER = 0x4;
335
336 /**
Issei Suzuki5609ccb2019-06-13 15:04:08 +0200337 * Transition flag: Keyguard is going away with subtle animation.
338 * @hide
339 */
340 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION = 0x8;
341
342 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100343 * @hide
344 */
345 @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = {
346 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE,
347 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION,
348 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER,
349 })
350 @Retention(RetentionPolicy.SOURCE)
351 @interface TransitionFlags {}
352
353 /**
Chilun8753ad32018-10-09 15:56:45 +0800354 * Remove content mode: Indicates remove content mode is currently not defined.
355 * @hide
356 */
357 int REMOVE_CONTENT_MODE_UNDEFINED = 0;
358
359 /**
360 * Remove content mode: Indicates that when display is removed, all its activities will be moved
361 * to the primary display and the topmost activity should become focused.
362 * @hide
363 */
364 int REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY = 1;
365
366 /**
367 * Remove content mode: Indicates that when display is removed, all its stacks and tasks will be
368 * removed, all activities will be destroyed according to the usual lifecycle.
369 * @hide
370 */
371 int REMOVE_CONTENT_MODE_DESTROY = 2;
372
373 /**
374 * @hide
375 */
376 @IntDef(prefix = { "REMOVE_CONTENT_MODE_" }, value = {
377 REMOVE_CONTENT_MODE_UNDEFINED,
378 REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY,
379 REMOVE_CONTENT_MODE_DESTROY,
380 })
381 @interface RemoveContentMode {}
382
383 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100385 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 * is invalid.
387 */
388 public static class BadTokenException extends RuntimeException {
389 public BadTokenException() {
390 }
391
392 public BadTokenException(String name) {
393 super(name);
394 }
395 }
396
397 /**
Craig Mautner6018aee2012-10-23 14:27:49 -0700398 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
399 * be found. See {@link android.app.Presentation} for more information on secondary displays.
400 */
401 public static class InvalidDisplayException extends RuntimeException {
402 public InvalidDisplayException() {
403 }
404
405 public InvalidDisplayException(String name) {
406 super(name);
407 }
408 }
409
410 /**
Jeff Browna492c3a2012-08-23 19:48:44 -0700411 * Returns the {@link Display} upon which this {@link WindowManager} instance
412 * will create new windows.
413 * <p>
414 * Despite the name of this method, the display that is returned is not
415 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
416 * The returned display could instead be a secondary display that this
417 * window manager instance is managing. Think of it as the display that
418 * this {@link WindowManager} instance uses by default.
419 * </p><p>
420 * To create windows on a different display, you need to obtain a
421 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
422 * class documentation for more information.)
423 * </p>
424 *
425 * @return The display that this window manager is managing.
Andrii Kulian4a316972020-01-21 21:41:38 -0800426 * @deprecated Use {@link Context#getDisplay()} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 */
Andrii Kulian4a316972020-01-21 21:41:38 -0800428 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700430
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 /**
432 * Special variation of {@link #removeView} that immediately invokes
433 * the given view hierarchy's {@link View#onDetachedFromWindow()
434 * View.onDetachedFromWindow()} methods before returning. This is not
435 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700436 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 * @param view The view to be removed.
438 */
439 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700440
Clara Bayarri75e09792015-07-29 16:20:40 +0100441 /**
Charles Chenf65e0222020-01-17 11:51:34 +0800442 * Returns the {@link WindowMetrics} according to the current system state.
443 * <p>
444 * The metrics describe the size of the area the window would occupy with
445 * {@link LayoutParams#MATCH_PARENT MATCH_PARENT} width and height, and the {@link WindowInsets}
446 * such a window would have.
447 * <p>
448 * The value of this is based on the <b>current</b> windowing state of the system.
449 *
450 * For example, for activities in multi-window mode, the metrics returned are based on the
451 * current bounds that the user has selected for the {@link android.app.Activity Activity}'s
452 * task.
453 *
454 * @see #getMaximumWindowMetrics()
455 * @see WindowMetrics
456 */
457 default @NonNull WindowMetrics getCurrentWindowMetrics() {
458 throw new UnsupportedOperationException();
459 }
460
461 /**
Andrii Kulian02c0e4d2020-01-27 22:17:31 -0800462 * Returns the largest {@link WindowMetrics} an app may expect in the current system state.
Charles Chenf65e0222020-01-17 11:51:34 +0800463 * <p>
464 * The metrics describe the size of the largest potential area the window might occupy with
465 * {@link LayoutParams#MATCH_PARENT MATCH_PARENT} width and height, and the {@link WindowInsets}
466 * such a window would have.
467 * <p>
468 * The value of this is based on the largest <b>potential</b> windowing state of the system.
469 *
470 * For example, for activities in multi-window mode, the metrics returned are based on the
471 * what the bounds would be if the user expanded the {@link android.app.Activity Activity}'s
472 * task to cover the entire screen.
473 *
474 * Note that this might still be smaller than the size of the physical display if certain areas
475 * of the display are not available to windows created in this {@link Context}.
476 *
477 * @see #getMaximumWindowMetrics()
478 * @see WindowMetrics
479 */
480 default @NonNull WindowMetrics getMaximumWindowMetrics() {
481 throw new UnsupportedOperationException();
482 }
483
484 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100485 * Used to asynchronously request Keyboard Shortcuts from the focused window.
486 *
487 * @hide
488 */
489 public interface KeyboardShortcutsReceiver {
490 /**
491 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
492 *
493 * @param result The keyboard shortcuts to be displayed.
494 */
495 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
496 }
497
498 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800499 * Message for taking fullscreen screenshot
500 * @hide
501 */
Zak Cohenebd3b8b2020-01-17 11:16:00 -0800502 int TAKE_SCREENSHOT_FULLSCREEN = 1;
Muyuan Li6ca619f2016-03-08 13:30:42 -0800503
504 /**
505 * Message for taking screenshot of selected region.
506 * @hide
507 */
Zak Cohenebd3b8b2020-01-17 11:16:00 -0800508 int TAKE_SCREENSHOT_SELECTED_REGION = 2;
509
510 /**
511 * Message for handling a screenshot flow with an image provided by the caller.
512 * @hide
513 */
514 int TAKE_SCREENSHOT_PROVIDED_IMAGE = 3;
515
516 /**
517 * Parcel key for the screen shot bitmap sent with messages of type
518 * {@link #TAKE_SCREENSHOT_PROVIDED_IMAGE}, type {@link android.graphics.Bitmap}
519 * @hide
520 */
521 String PARCEL_KEY_SCREENSHOT_BITMAP = "screenshot_screen_bitmap";
522
523 /**
524 * Parcel key for the screen bounds of the image sent with messages of type
525 * [@link {@link #TAKE_SCREENSHOT_PROVIDED_IMAGE}], type {@link Rect} in screen coordinates.
526 * @hide
527 */
528 String PARCEL_KEY_SCREENSHOT_BOUNDS = "screenshot_screen_bounds";
529
530 /**
531 * Parcel key for the task id of the task that the screen shot was taken of, sent with messages
532 * of type [@link {@link #TAKE_SCREENSHOT_PROVIDED_IMAGE}], type int.
533 * @hide
534 */
535 String PARCEL_KEY_SCREENSHOT_TASK_ID = "screenshot_task_id";
536
537 /**
538 * Parcel key for the visible insets of the image sent with messages of type
539 * [@link {@link #TAKE_SCREENSHOT_PROVIDED_IMAGE}], type {@link android.graphics.Insets} in
540 * screen coordinates.
541 * @hide
542 */
543 String PARCEL_KEY_SCREENSHOT_INSETS = "screenshot_insets";
Muyuan Li6ca619f2016-03-08 13:30:42 -0800544
545 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100546 * @hide
547 */
548 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
549
550 /**
551 * Request for keyboard shortcuts to be retrieved asynchronously.
552 *
553 * @param receiver The callback to be triggered when the result is ready.
554 *
555 * @hide
556 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000557 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100558
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400559 /**
560 * Return the touch region for the current IME window, or an empty region if there is none.
561 *
562 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
563 * region or there was an error.
564 *
565 * @hide
566 */
567 @SystemApi
568 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
569 public Region getCurrentImeTouchRegion();
570
Chilun8753ad32018-10-09 15:56:45 +0800571 /**
572 * Sets that the display should show its content when non-secure keyguard is shown.
573 *
574 * @param displayId Display ID.
575 * @param shouldShow Indicates that the display should show its content when non-secure keyguard
576 * is shown.
577 * @see KeyguardManager#isDeviceSecure()
578 * @see KeyguardManager#isDeviceLocked()
579 * @hide
580 */
581 @TestApi
582 default void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
583 }
584
585 /**
586 * Sets that the display should show system decors.
587 * <p>
588 * System decors include status bar, navigation bar, launcher.
589 * </p>
590 *
591 * @param displayId The id of the display.
592 * @param shouldShow Indicates that the display should show system decors.
Andrii Kuliandd989612019-02-21 12:13:28 -0800593 * @see #shouldShowSystemDecors(int)
Chilun8753ad32018-10-09 15:56:45 +0800594 * @hide
595 */
596 @TestApi
597 default void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
598 }
599
600 /**
Andrii Kuliandd989612019-02-21 12:13:28 -0800601 * Checks if the display supports showing system decors.
602 * <p>
603 * System decors include status bar, navigation bar, launcher.
604 * </p>
605 *
606 * @param displayId The id of the display.
607 * @see #setShouldShowSystemDecors(int, boolean)
608 * @hide
609 */
610 @TestApi
611 default boolean shouldShowSystemDecors(int displayId) {
612 return false;
613 }
614
615 /**
Chilun8753ad32018-10-09 15:56:45 +0800616 * Sets that the display should show IME.
617 *
618 * @param displayId Display ID.
619 * @param shouldShow Indicates that the display should show IME.
Chilun8753ad32018-10-09 15:56:45 +0800620 * @hide
621 */
622 @TestApi
623 default void setShouldShowIme(int displayId, boolean shouldShow) {
624 }
625
lumark9a72d222019-03-30 18:31:45 +0800626 /**
627 * Indicates that the display should show IME.
628 *
629 * @param displayId The id of the display.
630 * @return {@code true} if the display should show IME when an input field becomes
631 * focused on it.
632 * @hide
633 */
634 @TestApi
635 default boolean shouldShowIme(int displayId) {
636 return false;
637 }
638
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800639 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 /**
641 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700642 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
643 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800644 */
Romain Guy529b60a2010-08-03 18:05:47 -0700645 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700647
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 /**
649 * Y position for this window. With the default gravity it is ignored.
650 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
651 * an offset from the given edge.
652 */
Romain Guy529b60a2010-08-03 18:05:47 -0700653 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800654 public int y;
655
656 /**
657 * Indicates how much of the extra space will be allocated horizontally
658 * to the view associated with these LayoutParams. Specify 0 if the view
659 * should not be stretched. Otherwise the extra pixels will be pro-rated
660 * among all views whose weight is greater than 0.
661 */
Romain Guy529b60a2010-08-03 18:05:47 -0700662 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 public float horizontalWeight;
664
665 /**
666 * Indicates how much of the extra space will be allocated vertically
667 * to the view associated with these LayoutParams. Specify 0 if the view
668 * should not be stretched. Otherwise the extra pixels will be pro-rated
669 * among all views whose weight is greater than 0.
670 */
Romain Guy529b60a2010-08-03 18:05:47 -0700671 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 /**
675 * The general type of window. There are three main classes of
676 * window types:
677 * <ul>
678 * <li> <strong>Application windows</strong> (ranging from
679 * {@link #FIRST_APPLICATION_WINDOW} to
680 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
681 * windows. For these types of windows, the {@link #token} must be
682 * set to the token of the activity they are a part of (this will
683 * normally be done for you if {@link #token} is null).
684 * <li> <strong>Sub-windows</strong> (ranging from
685 * {@link #FIRST_SUB_WINDOW} to
686 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
687 * window. For these types of windows, the {@link #token} must be
688 * the token of the window it is attached to.
689 * <li> <strong>System windows</strong> (ranging from
690 * {@link #FIRST_SYSTEM_WINDOW} to
691 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
692 * use by the system for specific purposes. They should not normally
693 * be used by applications, and a special permission is required
694 * to use them.
695 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700696 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 * @see #TYPE_BASE_APPLICATION
698 * @see #TYPE_APPLICATION
699 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700700 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 * @see #TYPE_APPLICATION_PANEL
702 * @see #TYPE_APPLICATION_MEDIA
703 * @see #TYPE_APPLICATION_SUB_PANEL
704 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
705 * @see #TYPE_STATUS_BAR
706 * @see #TYPE_SEARCH_BAR
707 * @see #TYPE_PHONE
708 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 * @see #TYPE_TOAST
710 * @see #TYPE_SYSTEM_OVERLAY
711 * @see #TYPE_PRIORITY_PHONE
712 * @see #TYPE_STATUS_BAR_PANEL
713 * @see #TYPE_SYSTEM_DIALOG
714 * @see #TYPE_KEYGUARD_DIALOG
715 * @see #TYPE_SYSTEM_ERROR
716 * @see #TYPE_INPUT_METHOD
717 * @see #TYPE_INPUT_METHOD_DIALOG
718 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700719 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700720 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200721 to = "BASE_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700722 @ViewDebug.IntToString(from = TYPE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200723 to = "APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700724 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200725 to = "APPLICATION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700726 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200727 to = "DRAWN_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700728 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200729 to = "APPLICATION_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700730 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200731 to = "APPLICATION_MEDIA"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700732 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200733 to = "APPLICATION_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700734 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200735 to = "APPLICATION_ABOVE_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700736 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200737 to = "APPLICATION_ATTACHED_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700738 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200739 to = "APPLICATION_MEDIA_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700740 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200741 to = "STATUS_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700742 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200743 to = "SEARCH_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700744 @ViewDebug.IntToString(from = TYPE_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200745 to = "PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700746 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200747 to = "SYSTEM_ALERT"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700748 @ViewDebug.IntToString(from = TYPE_TOAST,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200749 to = "TOAST"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700750 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200751 to = "SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700752 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200753 to = "PRIORITY_PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700754 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200755 to = "SYSTEM_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700756 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200757 to = "KEYGUARD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700758 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200759 to = "SYSTEM_ERROR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700760 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200761 to = "INPUT_METHOD"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700762 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200763 to = "INPUT_METHOD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700764 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200765 to = "WALLPAPER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700766 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200767 to = "STATUS_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700768 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200769 to = "SECURE_SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700770 @ViewDebug.IntToString(from = TYPE_DRAG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200771 to = "DRAG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700772 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200773 to = "STATUS_BAR_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700774 @ViewDebug.IntToString(from = TYPE_POINTER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200775 to = "POINTER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700776 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200777 to = "NAVIGATION_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700778 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200779 to = "VOLUME_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700780 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200781 to = "BOOT_PROGRESS"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700782 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200783 to = "INPUT_CONSUMER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700784 @ViewDebug.IntToString(from = TYPE_DREAM,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200785 to = "DREAM"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700786 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200787 to = "NAVIGATION_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700788 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200789 to = "DISPLAY_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700790 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200791 to = "MAGNIFICATION_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700792 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200793 to = "PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700794 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200795 to = "PRIVATE_PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700796 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200797 to = "VOICE_INTERACTION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700798 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200799 to = "VOICE_INTERACTION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700800 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200801 to = "DOCK_DIVIDER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700802 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200803 to = "QS_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700804 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200805 to = "SCREENSHOT"),
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800806 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200807 to = "APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700808 })
Adrian Roos9c17e532020-03-11 16:00:50 +0100809 @WindowType
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700811
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800812 /**
813 * Start of window types that represent normal application windows.
814 */
815 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700816
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800817 /**
818 * Window type: an application window that serves as the "base" window
819 * of the overall application; all other application windows will
820 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700821 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 */
823 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700824
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 /**
826 * Window type: a normal application window. The {@link #token} must be
827 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700828 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 */
830 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700831
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800832 /**
833 * Window type: special application window that is displayed while the
834 * application is starting. Not for use by applications themselves;
835 * this is used by the system to display something until the
836 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700837 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800838 */
839 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700840
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700842 * Window type: a variation on TYPE_APPLICATION that ensures the window
843 * manager will wait for this window to be drawn before the app is shown.
844 * In multiuser systems shows only on the owning user's window.
845 */
846 public static final int TYPE_DRAWN_APPLICATION = 4;
847
848 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 * End of types of application windows.
850 */
851 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700852
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800853 /**
854 * Start of types of sub-windows. The {@link #token} of these windows
855 * must be set to the window they are attached to. These types of
856 * windows are kept next to their attached window in Z-order, and their
857 * coordinate space is relative to their attached window.
858 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700859 public static final int FIRST_SUB_WINDOW = 1000;
860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800861 /**
862 * Window type: a panel on top of an application window. These windows
863 * appear on top of their attached window.
864 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700865 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 /**
John Spurlock33291d82013-03-13 14:45:14 -0400868 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 * are displayed behind their attached window.
870 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700871 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 /**
874 * Window type: a sub-panel on top of an application window. These
875 * windows are displayed on top their attached window and any
876 * {@link #TYPE_APPLICATION_PANEL} panels.
877 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700878 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800879
880 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
881 * of the window happens as that of a top-level window, <em>not</em>
882 * as a child of its container.
883 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700884 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700887 * Window type: window for showing overlays on top of media windows.
888 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
889 * application window. They should be translucent to be useful. This
890 * is a big ugly hack so:
891 * @hide
892 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100893 @UnsupportedAppUsage
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700894 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
895
896 /**
897 * Window type: a above sub-panel on top of an application window and it's
898 * sub-panel windows. These windows are displayed on top of their attached window
899 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700900 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700901 */
902 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
903
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700904 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 * End of types of sub-windows.
906 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700907 public static final int LAST_SUB_WINDOW = 1999;
908
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800909 /**
910 * Start of system-specific window types. These are not normally
911 * created by applications.
912 */
913 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700914
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800915 /**
916 * Window type: the status bar. There can be only one status bar
917 * window; it is placed at the top of the screen, and all other
918 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700919 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800920 */
921 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700922
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800923 /**
924 * Window type: the search bar. There can be only one search bar
925 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700926 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927 */
928 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700929
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800930 /**
931 * Window type: phone. These are non-application windows providing
932 * user interaction with the phone (in particular incoming calls).
933 * These windows are normally placed above all applications, but behind
934 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700935 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800936 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800937 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800938 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700940
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800941 /**
942 * Window type: system window, such as low power alert. These windows
943 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700944 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800945 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800946 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800947 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800948 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100949
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 /**
951 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700952 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200953 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800954 */
955 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100956
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 /**
958 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700959 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800960 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800961 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800962 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800963 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700964
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800965 /**
966 * Window type: system overlay windows, which need to be displayed
967 * on top of everything else. These windows must not take input
968 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700969 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800970 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800971 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800972 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700974
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 /**
976 * Window type: priority phone UI, which needs to be displayed even if
977 * the keyguard is active. These windows must not take input
978 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700979 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800980 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800982 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800983 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700984
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 /**
986 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700987 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800989 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700990
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800991 /**
992 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700993 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 */
995 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700996
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800997 /**
998 * Window type: internal system error windows, appear on top of
999 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -07001000 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001001 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001003 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001004 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001005
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001006 /**
1007 * Window type: internal input methods windows, which appear above
1008 * the normal UI. Application windows may be resized or panned to keep
1009 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -07001010 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 */
1012 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
1013
1014 /**
1015 * Window type: internal input methods dialog windows, which appear above
1016 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -07001017 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001018 */
1019 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
1020
1021 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001022 * Window type: wallpaper window, placed behind any window that wants
1023 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -07001024 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001025 */
1026 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
1027
1028 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -08001029 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -07001030 * In multiuser systems shows on all users' windows.
Heemin Seog2cf45dd2020-02-24 15:43:29 -08001031 *
1032 * @deprecated This became API by accident and was never intended to be used for
1033 * applications.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -08001034 */
Heemin Seog2cf45dd2020-02-24 15:43:29 -08001035 @Deprecated
Dianne Hackbornbadc47e2009-11-08 17:37:07 -08001036 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -07001037
1038 /**
1039 * Window type: secure system overlay windows, which need to be displayed
1040 * on top of everything else. These windows must not take input
1041 * focus, or they will interfere with the keyguard.
1042 *
1043 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
1044 * system itself is allowed to create these overlays. Applications cannot
1045 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -07001046 *
1047 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -07001048 * @hide
1049 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001050 @UnsupportedAppUsage
Jeff Brown3b2b3542010-10-15 00:54:27 -07001051 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
1052
Dianne Hackbornbadc47e2009-11-08 17:37:07 -08001053 /**
Christopher Tatea53146c2010-09-07 11:57:52 -07001054 * Window type: the drag-and-drop pseudowindow. There is only one
1055 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -07001056 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -07001057 * @hide
1058 */
Jeff Brown3b2b3542010-10-15 00:54:27 -07001059 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -07001060
1061 /**
Robert Carr8360a782017-11-22 12:47:58 -08001062 * Window type: panel that slides out from over the status bar
1063 * In multiuser systems shows on all users' windows. These windows
1064 * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL}
1065 * windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -08001066 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -08001067 */
1068 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
1069
Jeff Brown83c09682010-12-23 17:50:18 -08001070 /**
1071 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -07001072 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -08001073 * @hide
1074 */
1075 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -08001076
1077 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -04001078 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -07001079 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -04001080 * @hide
1081 */
1082 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
1083
1084 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -07001085 * Window type: The volume level overlay/dialog shown when the user
1086 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -07001087 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -07001088 * @hide
1089 */
1090 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
1091
1092 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -07001093 * Window type: The boot progress dialog, goes on top of everything
1094 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -07001095 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -07001096 * @hide
1097 */
1098 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
1099
1100 /**
Selim Cinekf83e8242015-05-19 18:08:14 -07001101 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -07001102 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -07001103 * @hide
1104 */
Selim Cinekf83e8242015-05-19 18:08:14 -07001105 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -07001106
1107 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -05001108 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -07001109 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -05001110 * @hide
1111 */
1112 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
1113
1114 /**
Jim Millere898ac52012-04-06 17:10:57 -07001115 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -07001116 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -07001117 * @hide
1118 */
1119 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
1120
1121 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -07001122 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -07001123 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -07001124 * @hide
1125 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001126 @UnsupportedAppUsage
Jeff Brownbd6e1502012-08-28 03:27:37 -07001127 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
1128
1129 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001130 * Window type: Magnification overlay window. Used to highlight the magnified
1131 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -07001132 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001133 * @hide
1134 */
1135 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
1136
1137 /**
keunyounga446bf02013-06-21 19:07:57 -07001138 * Window type: Window for Presentation on top of private
1139 * virtual display.
1140 */
1141 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
1142
1143 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -07001144 * Window type: Windows in the voice interaction layer.
1145 * @hide
1146 */
1147 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
1148
1149 /**
Phil Weaver40ded282016-01-25 15:49:02 -08001150 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -07001151 * android.accessibilityservice.AccessibilityService} for interception of
1152 * user interactions without changing the windows an accessibility service
1153 * can introspect. In particular, an accessibility service can introspect
1154 * only windows that a sighted user can interact with which is they can touch
1155 * these windows or can type into these windows. For example, if there
1156 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -08001157 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -07001158 * they are covered by a touchable window.
1159 */
1160 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
1161
1162 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -07001163 * Window type: Starting window for voice interaction layer.
1164 * @hide
1165 */
1166 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
1167
1168 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -07001169 * Window for displaying a handle used for resizing docked stacks. This window is owned
1170 * by the system process.
1171 * @hide
1172 */
1173 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
1174
1175 /**
Jason Monk8f7f3182015-11-18 16:35:14 -05001176 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
1177 * by Quick Settings Tiles.
1178 * @hide
1179 */
1180 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
1181
1182 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -08001183 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is
Muyuan Li36ca72c2016-08-06 20:24:06 -07001184 * reserved for screenshot region selection. These windows must not take input focus.
Muyuan Li6ca619f2016-03-08 13:30:42 -08001185 * @hide
1186 */
1187 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
1188
1189 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -07001190 * Window type: Window for Presentation on an external display.
1191 * @see android.app.Presentation
1192 * @hide
1193 */
1194 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
1195
1196 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001197 * Window type: Application overlay windows are displayed above all activity windows
1198 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
1199 * but below critical system windows like the status bar or IME.
1200 * <p>
1201 * The system may change the position, size, or visibility of these windows at anytime
1202 * to reduce visual clutter to the user and also manage resources.
1203 * <p>
1204 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
1205 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -08001206 * The system will adjust the importance of processes with this window type to reduce the
1207 * chance of the low-memory-killer killing them.
1208 * <p>
1209 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001210 */
1211 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
1212
1213 /**
chaviw8065f442019-11-18 13:20:58 -08001214 * Window type: Window for adding accessibility window magnification above other windows.
1215 * This will place the window in the overlay windows.
1216 * @hide
1217 */
1218 public static final int TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 39;
1219
1220 /**
wilsonshihe8321942019-10-18 18:39:46 +08001221 * Window type: the notification shade and keyguard. There can be only one status bar
1222 * window; it is placed at the top of the screen, and all other
1223 * windows are shifted down so they are below it.
1224 * In multiuser systems shows on all users' windows.
1225 * @hide
1226 */
1227 public static final int TYPE_NOTIFICATION_SHADE = FIRST_SYSTEM_WINDOW + 40;
1228
1229 /**
Heemin Seog2cf45dd2020-02-24 15:43:29 -08001230 * Window type: used to show the status bar in non conventional parts of the screen (i.e.
1231 * the left or the bottom of the screen).
1232 * In multiuser systems shows on all users' windows.
1233 * @hide
1234 */
1235 public static final int TYPE_STATUS_BAR_ADDITIONAL = FIRST_SYSTEM_WINDOW + 41;
1236
1237 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 * End of types of system windows.
1239 */
1240 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001242 /**
Albert Chaulke4338f82017-04-19 15:54:08 -04001243 * @hide
1244 * Used internally when there is no suitable type available.
1245 */
1246 public static final int INVALID_WINDOW_TYPE = -1;
1247
1248 /**
Adrian Roos9c17e532020-03-11 16:00:50 +01001249 * @hide
1250 */
1251 @IntDef(prefix = "TYPE_", value = {
1252 TYPE_ACCESSIBILITY_OVERLAY,
1253 TYPE_APPLICATION,
1254 TYPE_APPLICATION_ATTACHED_DIALOG,
1255 TYPE_APPLICATION_MEDIA,
1256 TYPE_APPLICATION_OVERLAY,
1257 TYPE_APPLICATION_PANEL,
1258 TYPE_APPLICATION_STARTING,
1259 TYPE_APPLICATION_SUB_PANEL,
1260 TYPE_BASE_APPLICATION,
1261 TYPE_DRAWN_APPLICATION,
1262 TYPE_INPUT_METHOD,
1263 TYPE_INPUT_METHOD_DIALOG,
1264 TYPE_KEYGUARD,
1265 TYPE_KEYGUARD_DIALOG,
1266 TYPE_PHONE,
1267 TYPE_PRIORITY_PHONE,
1268 TYPE_PRIVATE_PRESENTATION,
1269 TYPE_SEARCH_BAR,
1270 TYPE_STATUS_BAR,
1271 TYPE_STATUS_BAR_PANEL,
1272 TYPE_SYSTEM_ALERT,
1273 TYPE_SYSTEM_DIALOG,
1274 TYPE_SYSTEM_ERROR,
1275 TYPE_SYSTEM_OVERLAY,
1276 TYPE_TOAST,
1277 TYPE_WALLPAPER,
1278 })
1279 @Retention(RetentionPolicy.SOURCE)
1280 public @interface WindowType {}
1281
1282 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001283 * Return true if the window type is an alert window.
1284 *
1285 * @param type The window type.
1286 * @return If the window type is an alert window.
1287 * @hide
1288 */
Adrian Roos9c17e532020-03-11 16:00:50 +01001289 public static boolean isSystemAlertWindowType(@WindowType int type) {
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001290 switch (type) {
1291 case TYPE_PHONE:
1292 case TYPE_PRIORITY_PHONE:
1293 case TYPE_SYSTEM_ALERT:
1294 case TYPE_SYSTEM_ERROR:
1295 case TYPE_SYSTEM_OVERLAY:
1296 case TYPE_APPLICATION_OVERLAY:
1297 return true;
1298 }
1299 return false;
1300 }
1301
Mathias Agopiand2112302010-12-07 19:38:17 -08001302 /** @deprecated this is ignored, this value is set automatically when needed. */
1303 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -08001305 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001306 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -08001308 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001309 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -08001311 /** @deprecated this is ignored, this value is set automatically when needed. */
1312 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001314
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001315 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001316 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001317 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001318 @Deprecated
1319 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001320
Mike Lockwoodef731622010-01-27 17:51:34 -05001321 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001322 * the lock screen to activate while the screen is on.
1323 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -08001324 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -05001325 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
1326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 /** Window flag: everything behind this window will be dimmed.
1328 * Use {@link #dimAmount} to control the amount of dim. */
1329 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001330
1331 /** Window flag: blur everything behind this window.
1332 * @deprecated Blurring is no longer supported. */
1333 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001334 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001335
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 /** Window flag: this window won't ever get key input focus, so the
1337 * user can not send key or other button events to it. Those will
1338 * instead go to whatever focusable window is behind it. This flag
1339 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
1340 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001341 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001342 * <p>Setting this flag also implies that the window will not need to
1343 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001344 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001345 * independently of any active input method (typically this means it
1346 * gets Z-ordered on top of the input method, so it can use the full
Andrew Chant17c896e2019-12-05 22:39:02 +00001347 * screen for its content and cover the input method if needed. You
1348 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001349 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001350
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001351 /** Window flag: this window can never receive touch events. */
1352 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001353
John Spurlock33291d82013-03-13 14:45:14 -04001354 /** Window flag: even when this window is focusable (its
1355 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001356 * outside of the window to be sent to the windows behind it. Otherwise
1357 * it will consume all pointer events itself, regardless of whether they
1358 * are inside of the window. */
1359 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001360
John Spurlock33291d82013-03-13 14:45:14 -04001361 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 * screen is pressed, you will receive this first touch event. Usually
1363 * the first touch event is consumed by the system since the user can
1364 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -07001365 *
1366 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001368 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001369 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001371 /** Window flag: as long as this window is visible to the user, keep
1372 * the device's screen turned on and bright. */
1373 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001374
Tiger Huang52724442020-01-20 21:38:42 +08001375 /**
1376 * Window flag for attached windows: Place the window within the entire screen, ignoring
1377 * any constraints from the parent window.
Adrian Roosfa02da62018-01-15 16:01:18 +01001378 *
1379 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed
1380 * such that it avoids the {@link DisplayCutout} area if necessary according to the
1381 * {@link #layoutInDisplayCutoutMode}.
1382 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001383 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 /** Window flag: allow window to extend outside of the screen. */
1386 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001387
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001388 /**
John Spurlock33291d82013-03-13 14:45:14 -04001389 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 * this window is displayed. This allows the window to use the entire
1391 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -07001392 * an app window with this flag set is on the top layer. A fullscreen window
1393 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
1394 * {@link #softInputMode} field; the window will stay fullscreen
1395 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001396 *
1397 * <p>This flag can be controlled in your theme through the
1398 * {@link android.R.attr#windowFullscreen} attribute; this attribute
1399 * is automatically set for you in the standard fullscreen themes
1400 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
1401 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
1402 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
1403 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
1404 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
1405 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
1406 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
Tiger Huang52724442020-01-20 21:38:42 +08001407 *
1408 * @deprecated Use {@link WindowInsetsController#hide(int)} with {@link Type#statusBars()}
1409 * instead.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001410 */
Tiger Huang52724442020-01-20 21:38:42 +08001411 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001413
Tiger Huang52724442020-01-20 21:38:42 +08001414 /**
1415 * Window flag: override {@link #FLAG_FULLSCREEN} and force the
1416 * screen decorations (such as the status bar) to be shown.
1417 *
1418 * @deprecated This value became API "by accident", and shouldn't be used by 3rd party
1419 * applications.
1420 */
1421 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001424 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -07001425 * the screen.
1426 * @deprecated This flag is no longer used. */
1427 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001428 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001429
John Spurlock33291d82013-03-13 14:45:14 -04001430 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -07001431 * it from appearing in screenshots or from being viewed on non-secure
1432 * displays.
1433 *
1434 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
1435 * secure surfaces and secure displays.
1436 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001437 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001438
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001439 /** Window flag: a special mode where the layout parameters are used
1440 * to perform scaling of the surface when it is composited to the
1441 * screen. */
1442 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001443
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001444 /** Window flag: intended for windows that will often be used when the user is
1445 * holding the screen against their face, it will aggressively filter the event
1446 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001447 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001448 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001449 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001450 * until the finger is released. */
1451 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001452
Tiger Huang52724442020-01-20 21:38:42 +08001453 /**
1454 * Window flag: a special option only for use in combination with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001455 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
1456 * screen your window may appear on top of or behind screen decorations
1457 * such as the status bar. By also including this flag, the window
1458 * manager will report the inset rectangle needed to ensure your
1459 * content is not covered by screen decorations. This flag is normally
Tiger Huang52724442020-01-20 21:38:42 +08001460 * set for you by Window as described in {@link Window#setFlags}
1461 *
1462 * @deprecated Insets will always be delivered to your application.
1463 */
1464 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001465 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001466
Tarandeep Singhbcba88c2019-12-06 10:36:55 -08001467 /** Window flag: When set, input method can't interact with the focusable window
1468 * and can be placed to use more space and cover the input method.
1469 * Note: When combined with {@link #FLAG_NOT_FOCUSABLE}, this flag has no
1470 * effect since input method cannot interact with windows having {@link #FLAG_NOT_FOCUSABLE}
1471 * flag set.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001472 */
1473 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001475 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
1476 * can set this flag to receive a single special MotionEvent with
1477 * the action
1478 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
1479 * touches that occur outside of your window. Note that you will not
1480 * receive the full down/move/up gesture, only the location of the
1481 * first down as an ACTION_OUTSIDE.
1482 */
1483 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001484
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001485 /** Window flag: special flag to let windows be shown when the screen
1486 * is locked. This will let application windows take precedence over
1487 * key guard or any other lock screens. Can be used with
1488 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001489 * directly before showing the key guard window. Can be used with
1490 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
1491 * non-secure keyguards. This flag only applies to the top-most
1492 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -07001493 * @deprecated Use {@link android.R.attr#showWhenLocked} or
1494 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
1495 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001496 */
chaviw59b98852017-06-13 12:05:44 -07001497 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001498 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
1499
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001500 /** Window flag: ask that the system wallpaper be shown behind
1501 * your window. The window surface must be translucent to be able
1502 * to actually see the wallpaper behind it; this flag just ensures
1503 * that the wallpaper surface will be there if this window actually
1504 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001505 *
1506 * <p>This flag can be controlled in your theme through the
1507 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
1508 * is automatically set for you in the standard wallpaper themes
1509 * such as {@link android.R.style#Theme_Wallpaper},
1510 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
1511 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
1512 * {@link android.R.style#Theme_Holo_Wallpaper},
1513 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
1514 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
1515 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001516 */
1517 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001518
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001519 /** Window flag: when set as a window is being added or made
1520 * visible, once the window has been shown then the system will
1521 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -07001522 * up the device) to turn the screen on.
1523 * @deprecated Use {@link android.R.attr#turnScreenOn} or
1524 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
1525 * unintentional double life-cycle event.
1526 */
1527 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001528 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001529
Jeff Sharkey67f9d502017-08-05 13:49:13 -06001530 /**
1531 * Window flag: when set the window will cause the keyguard to be
1532 * dismissed, only if it is not a secure lock keyguard. Because such a
1533 * keyguard is not needed for security, it will never re-appear if the
1534 * user navigates to another window (in contrast to
1535 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1536 * secure and non-secure keyguards but ensure they reappear when the
1537 * user moves to another UI that doesn't hide them). If the keyguard is
1538 * currently active and is secure (requires an unlock credential) than
1539 * the user will still need to confirm it before seeing this window,
1540 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1541 *
1542 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1543 * {@link KeyguardManager#requestDismissKeyguard} instead.
1544 * Since keyguard was dismissed all the time as long as an
1545 * activity with this flag on its window was focused,
1546 * keyguard couldn't guard against unintentional touches on
1547 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001548 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001549 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001550 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001551
Jeff Brown01ce2e92010-09-26 22:20:12 -07001552 /** Window flag: when set the window will accept for touch events
1553 * outside of its bounds to be sent to other windows that also
1554 * support split touch. When this flag is not set, the first pointer
1555 * that goes down determines the window to which all subsequent touches
1556 * go until all pointers go up. When this flag is set, each pointer
1557 * (not necessarily the first) that goes down determines the window
1558 * to which all subsequent touches of that pointer will go until that
1559 * pointer goes up thereby enabling touches with multiple pointers
1560 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001561 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001562 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001563
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001564 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001565 * <p>Indicates whether this window should be hardware accelerated.
1566 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001567 *
Romain Guy72f0a272011-01-09 16:01:46 -08001568 * <p>This flag can be controlled programmatically <em>only</em> to enable
1569 * hardware acceleration. To enable hardware acceleration for a given
1570 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001571 *
Romain Guy72f0a272011-01-09 16:01:46 -08001572 * <pre>
1573 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1574 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1575 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1576 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001577 *
Romain Guy72f0a272011-01-09 16:01:46 -08001578 * <p>It is important to remember that this flag <strong>must</strong>
1579 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001580 *
Romain Guy72f0a272011-01-09 16:01:46 -08001581 * <p>This flag cannot be used to disable hardware acceleration after it
1582 * was enabled in your manifest using
1583 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1584 * and programmatically disable hardware acceleration (for automated testing
1585 * for instance), make sure it is turned off in your manifest and enable it
1586 * on your activity or dialog when you need it instead, using the method
1587 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001588 *
Romain Guy72f0a272011-01-09 16:01:46 -08001589 * <p>This flag is automatically set by the system if the
1590 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1591 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001592 */
1593 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001594
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001595 /**
1596 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001597 * overscan area, if there is one. The window should still correctly
1598 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001599 *
1600 * <p>This flag can be controlled in your theme through the
1601 * {@link android.R.attr#windowOverscan} attribute; this attribute
1602 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001603 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001604 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1605 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1606 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1607 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1608 *
1609 * <p>When this flag is enabled for a window, its normal content may be obscured
1610 * to some degree by the overscan region of the display. To ensure key parts of
1611 * that content are visible to the user, you can use
1612 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1613 * to set the point in the view hierarchy where the appropriate offsets should
1614 * be applied. (This can be done either by directly calling this function, using
1615 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1616 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1617 * View.fitSystemWindows(Rect)} method).</p>
1618 *
1619 * <p>This mechanism for positioning content elements is identical to its equivalent
1620 * use with layout and {@link View#setSystemUiVisibility(int)
1621 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1622 * position its UI elements with this overscan flag is set:</p>
1623 *
1624 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Jorim Jaggif081f062019-10-24 16:24:54 +02001625 *
Jorim Jaggi0fb8fb22020-03-04 17:00:22 +01001626 * @deprecated Overscan areas aren't set by any Android product anymore as of Android 11.
Dianne Hackbornc652de82013-02-15 16:32:56 -08001627 */
Jorim Jaggif081f062019-10-24 16:24:54 +02001628 @Deprecated
Dianne Hackbornc652de82013-02-15 16:32:56 -08001629 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1630
John Spurlockbd957402013-10-03 11:38:39 -04001631 /**
1632 * Window flag: request a translucent status bar with minimal system-provided
1633 * background protection.
1634 *
1635 * <p>This flag can be controlled in your theme through the
1636 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1637 * is automatically set for you in the standard translucent decor themes
1638 * such as
1639 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1640 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1641 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1642 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1643 *
1644 * <p>When this flag is enabled for a window, it automatically sets
1645 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1646 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001647 *
1648 * <p>Note: For devices that support
1649 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag may be ignored.
Tiger Huang52724442020-01-20 21:38:42 +08001650 *
1651 * @deprecated Use {@link Window#setStatusBarColor(int)} with a half-translucent color
1652 * instead.
John Spurlockbd957402013-10-03 11:38:39 -04001653 */
Tiger Huang52724442020-01-20 21:38:42 +08001654 @Deprecated
John Spurlockbd957402013-10-03 11:38:39 -04001655 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1656
1657 /**
1658 * Window flag: request a translucent navigation bar with minimal system-provided
1659 * background protection.
1660 *
1661 * <p>This flag can be controlled in your theme through the
1662 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1663 * is automatically set for you in the standard translucent decor themes
1664 * such as
1665 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1666 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1667 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1668 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1669 *
1670 * <p>When this flag is enabled for a window, it automatically sets
1671 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1672 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001673 *
1674 * <p>Note: For devices that support
1675 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag can be disabled
1676 * by the car manufacturers.
Tiger Huang52724442020-01-20 21:38:42 +08001677 *
1678 * @deprecated Use {@link Window#setNavigationBarColor(int)} with a half-translucent color
1679 * instead.
John Spurlockbd957402013-10-03 11:38:39 -04001680 */
Tiger Huang52724442020-01-20 21:38:42 +08001681 @Deprecated
John Spurlockbd957402013-10-03 11:38:39 -04001682 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1683
Adam Lesinski6a591f52013-10-01 18:11:17 -07001684 /**
1685 * Flag for a window in local focus mode.
1686 * Window in local focus mode can control focus independent of window manager using
1687 * {@link Window#setLocalFocus(boolean, boolean)}.
1688 * Usually window in this mode will not get touch/key events from window manager, but will
1689 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1690 */
1691 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1692
Jeff Brown98db5fa2011-06-08 15:37:10 -07001693 /** Window flag: Enable touches to slide out of a window into neighboring
1694 * windows in mid-gesture instead of being captured for the duration of
1695 * the gesture.
1696 *
1697 * This flag changes the behavior of touch focus for this window only.
1698 * Touches can slide out of the window but they cannot necessarily slide
1699 * back in (unless the other window with touch focus permits it).
1700 *
1701 * {@hide}
1702 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001703 @UnsupportedAppUsage
Adam Lesinski6a591f52013-10-01 18:11:17 -07001704 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001705
Daniel Sandlere02d8082010-10-08 15:13:22 -04001706 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001707 * Window flag: When requesting layout with an attached window, the attached window may
1708 * overlap with the screen decorations of the parent window such as the navigation bar. By
1709 * including this flag, the window manager will layout the attached window within the decor
1710 * frame of the parent window such that it doesn't overlap with screen decorations.
Tiger Huang52724442020-01-20 21:38:42 +08001711 *
1712 * @deprecated Use {@link #setFitInsetsTypes(int)} to determine whether the attached
1713 * window will overlap with system bars.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001714 */
Tiger Huang52724442020-01-20 21:38:42 +08001715 @Deprecated
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001716 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001718 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001719 * Flag indicating that this Window is responsible for drawing the background for the
1720 * system bars. If set, the system bars are drawn with a transparent background and the
1721 * corresponding areas in this window are filled with the colors specified in
1722 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1723 */
1724 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1725
1726 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001727 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001728 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001729 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1730 * @see #FLAG_DIM_BEHIND
1731 * @see #FLAG_NOT_FOCUSABLE
1732 * @see #FLAG_NOT_TOUCHABLE
1733 * @see #FLAG_NOT_TOUCH_MODAL
1734 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1735 * @see #FLAG_KEEP_SCREEN_ON
1736 * @see #FLAG_LAYOUT_IN_SCREEN
1737 * @see #FLAG_LAYOUT_NO_LIMITS
1738 * @see #FLAG_FULLSCREEN
1739 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001740 * @see #FLAG_SECURE
1741 * @see #FLAG_SCALED
1742 * @see #FLAG_IGNORE_CHEEK_PRESSES
1743 * @see #FLAG_LAYOUT_INSET_DECOR
1744 * @see #FLAG_ALT_FOCUSABLE_IM
1745 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1746 * @see #FLAG_SHOW_WHEN_LOCKED
1747 * @see #FLAG_SHOW_WALLPAPER
1748 * @see #FLAG_TURN_SCREEN_ON
1749 * @see #FLAG_DISMISS_KEYGUARD
1750 * @see #FLAG_SPLIT_TOUCH
1751 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001752 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001753 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001754 */
1755 @ViewDebug.ExportedProperty(flagMapping = {
1756 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001757 name = "ALLOW_LOCK_WHILE_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001758 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001759 name = "DIM_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001760 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001761 name = "BLUR_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001762 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001763 name = "NOT_FOCUSABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001764 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001765 name = "NOT_TOUCHABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001766 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001767 name = "NOT_TOUCH_MODAL"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001768 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001769 name = "TOUCHABLE_WHEN_WAKING"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001770 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001771 name = "KEEP_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001772 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001773 name = "LAYOUT_IN_SCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001774 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001775 name = "LAYOUT_NO_LIMITS"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001776 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001777 name = "FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001778 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001779 name = "FORCE_NOT_FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001780 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001781 name = "DITHER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001782 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001783 name = "SECURE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001784 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001785 name = "SCALED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001786 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001787 name = "IGNORE_CHEEK_PRESSES"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001788 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001789 name = "LAYOUT_INSET_DECOR"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001790 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001791 name = "ALT_FOCUSABLE_IM"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001792 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001793 name = "WATCH_OUTSIDE_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001794 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001795 name = "SHOW_WHEN_LOCKED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001796 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001797 name = "SHOW_WALLPAPER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001798 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001799 name = "TURN_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001800 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001801 name = "DISMISS_KEYGUARD"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001802 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001803 name = "SPLIT_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001804 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001805 name = "HARDWARE_ACCELERATED"),
1806 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN,
1807 name = "LOCAL_FOCUS_MODE"),
John Spurlockbd957402013-10-03 11:38:39 -04001808 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001809 name = "TRANSLUCENT_STATUS"),
John Spurlockbd957402013-10-03 11:38:39 -04001810 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001811 name = "TRANSLUCENT_NAVIGATION"),
1812 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
1813 name = "LOCAL_FOCUS_MODE"),
1814 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY,
1815 name = "FLAG_SLIPPERY"),
1816 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR,
1817 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"),
Adrian Roos217ccd22014-05-09 14:29:04 +02001818 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001819 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001820 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001821 public int flags;
1822
1823 /**
John Reck61375a82014-09-18 19:27:48 +00001824 * If the window has requested hardware acceleration, but this is not
1825 * allowed in the process it is in, then still render it as if it is
1826 * hardware accelerated. This is used for the starting preview windows
1827 * in the system process, which don't need to have the overhead of
1828 * hardware acceleration (they are just a static rendering), but should
1829 * be rendered as such to match the actual window of the app even if it
1830 * is hardware accelerated.
1831 * Even if the window isn't hardware accelerated, still do its rendering
1832 * as if it was.
1833 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1834 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001835 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001836 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1837 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001838 *
John Reck61375a82014-09-18 19:27:48 +00001839 * @hide
1840 */
1841 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1842
1843 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001844 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001845 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001846 * If certain parts of the UI that really do want to use hardware
1847 * acceleration, this flag can be set to force it. This is basically
1848 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001849 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001850 * @hide
1851 */
1852 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1853
1854 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001855 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001856 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001857 * them (they do not affect the wallpaper scrolling operation) by calling
1858 * {@link
1859 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1860 *
1861 * @hide
1862 */
1863 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1864
Craig Mautner88400d32012-09-30 12:35:45 -07001865 /** In a multiuser system if this flag is set and the owner is a system process then this
1866 * window will appear on all user screens. This overrides the default behavior of window
1867 * types that normally only appear on the owning user's screen. Refer to each window type
1868 * to determine its default behavior.
1869 *
1870 * {@hide} */
Roshan Piusa3f89c62019-10-11 08:50:53 -07001871 @SystemApi
1872 @RequiresPermission(permission.INTERNAL_SYSTEM_WINDOW)
1873 public static final int SYSTEM_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
Craig Mautner88400d32012-09-30 12:35:45 -07001874
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001875 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001876 * Never animate position changes of the window.
1877 *
Robert Carrb48380a2017-04-04 14:56:37 -07001878 * {@hide}
1879 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00001880 @UnsupportedAppUsage
Robert Carrb48380a2017-04-04 14:56:37 -07001881 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001882 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1883
Adam Lesinski6a591f52013-10-01 18:11:17 -07001884 /** Window flag: special flag to limit the size of the window to be
1885 * original size ([320x480] x density). Used to create window for applications
1886 * running under compatibility mode.
1887 *
1888 * {@hide} */
1889 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1890
1891 /** Window flag: a special option intended for system dialogs. When
1892 * this flag is set, the window will demand focus unconditionally when
1893 * it is created.
1894 * {@hide} */
1895 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1896
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001897 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001898 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1899 *
1900 * {@hide}
1901 */
1902 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1903
1904 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001905 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
wilsonshihe8321942019-10-18 18:39:46 +08001906 * this flag is set it will be shown again.
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001907 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1908 *
1909 * {@hide}
1910 */
wilsonshihe8321942019-10-18 18:39:46 +08001911 public static final int PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR = 0x00001000;
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001912
1913 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001914 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001915 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001916 * because they are being managed externally through repositionChild.
1917 *
1918 * {@hide}
1919 */
1920 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1921
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001922 /**
1923 * Flag that will make window ignore app visibility and instead depend purely on the decor
1924 * view visibility for determining window visibility. This is used by recents to keep
1925 * drawing after it launches an app.
1926 * @hide
1927 */
1928 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1929
Robert Carra1eb4392015-12-10 12:43:51 -08001930 /**
1931 * Flag to indicate that this window is not expected to be replaced across
1932 * configuration change triggered activity relaunches. In general the WindowManager
1933 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1934 * until the replacement is ready to show in order to prevent visual glitch. However
1935 * some windows, such as PopupWindows expect to be cleared across configuration change,
1936 * and thus should hint to the WindowManager that it should not wait for a replacement.
1937 * @hide
1938 */
1939 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001940
1941 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001942 * Flag to indicate that this child window should always be laid-out in the parent
1943 * frame regardless of the current windowing mode configuration.
1944 * @hide
1945 */
1946 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1947
1948 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001949 * Flag to indicate that this window is always drawing the status bar background, no matter
1950 * what the other flags are.
1951 * @hide
1952 */
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001953 public static final int PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS = 0x00020000;
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001954
1955 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001956 * Flag to indicate that this window needs Sustained Performance Mode if
1957 * the device supports it.
1958 * @hide
1959 */
John Reck60e885f2016-04-21 15:40:45 -07001960 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001961
1962 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001963 * Flag to indicate that any window added by an application process that is of type
1964 * {@link #TYPE_TOAST} or that requires
1965 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1966 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001967 * @hide
1968 */
Philip P. Moltmannd66dd992018-09-17 11:26:04 -07001969 @SystemApi
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001970 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001971 public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001972
1973 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001974 * Indicates that this window is the rounded corners overlay present on some
1975 * devices this means that it will be excluded from: screenshots,
1976 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001977 * @hide
1978 */
Robert Carr132c9f52017-07-31 17:02:30 -07001979 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001980
1981 /**
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001982 * Flag to indicate that this window should be considered a screen decoration similar to the
1983 * nav bar and status bar. This will cause this window to affect the window insets reported
1984 * to other windows when it is visible.
1985 * @hide
1986 */
1987 @RequiresPermission(permission.STATUS_BAR_SERVICE)
1988 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
1989
1990 /**
Tiger Huanga90dea42018-08-03 17:20:17 +08001991 * Flag to indicate that the status bar window is in a state such that it forces showing
1992 * the navigation bar unless the navigation bar window is explicitly set to
1993 * {@link View#GONE}.
1994 * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}.
Tiger Huang34046012018-06-29 15:26:52 +08001995 * @hide
1996 */
Tiger Huanga90dea42018-08-03 17:20:17 +08001997 public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
Tiger Huang34046012018-06-29 15:26:52 +08001998
1999 /**
Peiyong Lin75045382019-03-04 19:22:33 -08002000 * Flag to indicate that the window is color space agnostic, and the color can be
2001 * interpreted to any color space.
2002 * @hide
2003 */
2004 public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000;
2005
2006 /**
Robert Carr48ec4e02019-07-16 14:28:47 -07002007 * Flag to request creation of a BLAST (Buffer as LayerState) Layer.
2008 * If not specified the client will receive a BufferQueue layer.
2009 * @hide
2010 */
2011 public static final int PRIVATE_FLAG_USE_BLAST = 0x02000000;
2012
2013 /**
Tiger Huang7238a052020-01-10 20:37:01 +08002014 * Flag to indicate that the window is controlling the appearance of system bars. So we
2015 * don't need to adjust it by reading its system UI flags for compatibility.
2016 * @hide
2017 */
2018 public static final int PRIVATE_FLAG_APPEARANCE_CONTROLLED = 0x04000000;
2019
2020 /**
2021 * Flag to indicate that the window is controlling the behavior of system bars. So we don't
2022 * need to adjust it by reading its window flags or system UI flags for compatibility.
2023 * @hide
2024 */
2025 public static final int PRIVATE_FLAG_BEHAVIOR_CONTROLLED = 0x08000000;
2026
2027 /**
Tiger Huang4a7835f2019-11-06 00:07:56 +08002028 * Flag to indicate that the window is controlling how it fits window insets on its own.
2029 * So we don't need to adjust its attributes for fitting window insets.
2030 * @hide
2031 */
Tiger Huang7238a052020-01-10 20:37:01 +08002032 public static final int PRIVATE_FLAG_FIT_INSETS_CONTROLLED = 0x10000000;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002033
2034 /**
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07002035 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2036 *
2037 * @hide
2038 */
2039 @SystemApi
2040 @Retention(RetentionPolicy.SOURCE)
2041 @IntDef(flag = true, prefix = { "SYSTEM_FLAG_" }, value = {
2042 SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Roshan Piusa3f89c62019-10-11 08:50:53 -07002043 SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07002044 })
2045 public @interface SystemFlags {}
2046
2047 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002048 * Control flags that are private to the platform.
2049 * @hide
2050 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00002051 @UnsupportedAppUsage
Jorim Jaggi484851b2017-09-22 16:03:27 +02002052 @ViewDebug.ExportedProperty(flagMapping = {
2053 @ViewDebug.FlagToString(
2054 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
2055 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
2056 name = "FAKE_HARDWARE_ACCELERATED"),
2057 @ViewDebug.FlagToString(
2058 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
2059 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
2060 name = "FORCE_HARDWARE_ACCELERATED"),
2061 @ViewDebug.FlagToString(
2062 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
2063 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
2064 name = "WANTS_OFFSET_NOTIFICATIONS"),
2065 @ViewDebug.FlagToString(
Roshan Piusa3f89c62019-10-11 08:50:53 -07002066 mask = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
2067 equals = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02002068 name = "SHOW_FOR_ALL_USERS"),
2069 @ViewDebug.FlagToString(
2070 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
2071 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
2072 name = "NO_MOVE_ANIMATION"),
2073 @ViewDebug.FlagToString(
2074 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
2075 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
2076 name = "COMPATIBLE_WINDOW"),
2077 @ViewDebug.FlagToString(
2078 mask = PRIVATE_FLAG_SYSTEM_ERROR,
2079 equals = PRIVATE_FLAG_SYSTEM_ERROR,
2080 name = "SYSTEM_ERROR"),
2081 @ViewDebug.FlagToString(
Jorim Jaggi484851b2017-09-22 16:03:27 +02002082 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
2083 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
2084 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"),
2085 @ViewDebug.FlagToString(
wilsonshihe8321942019-10-18 18:39:46 +08002086 mask = PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR,
2087 equals = PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR,
2088 name = "FORCE_STATUS_BAR_VISIBLE"),
Jorim Jaggi484851b2017-09-22 16:03:27 +02002089 @ViewDebug.FlagToString(
2090 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY,
2091 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY,
2092 name = "PRESERVE_GEOMETRY"),
2093 @ViewDebug.FlagToString(
2094 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
2095 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
2096 name = "FORCE_DECOR_VIEW_VISIBILITY"),
2097 @ViewDebug.FlagToString(
2098 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
2099 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
2100 name = "WILL_NOT_REPLACE_ON_RELAUNCH"),
2101 @ViewDebug.FlagToString(
2102 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
2103 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
2104 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
2105 @ViewDebug.FlagToString(
Jorim Jaggia6aabac2019-03-11 14:23:16 -07002106 mask = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
2107 equals = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02002108 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
2109 @ViewDebug.FlagToString(
2110 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
2111 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
2112 name = "SUSTAINED_PERFORMANCE_MODE"),
2113 @ViewDebug.FlagToString(
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07002114 mask = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
2115 equals = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02002116 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"),
2117 @ViewDebug.FlagToString(
2118 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
2119 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
2120 name = "IS_ROUNDED_CORNERS_OVERLAY"),
2121 @ViewDebug.FlagToString(
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07002122 mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
2123 equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
Tiger Huang34046012018-06-29 15:26:52 +08002124 name = "IS_SCREEN_DECOR"),
2125 @ViewDebug.FlagToString(
Tiger Huanga90dea42018-08-03 17:20:17 +08002126 mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
2127 equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
Peiyong Lin75045382019-03-04 19:22:33 -08002128 name = "STATUS_FORCE_SHOW_NAVIGATION"),
2129 @ViewDebug.FlagToString(
2130 mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
2131 equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
Tiger Huang4a7835f2019-11-06 00:07:56 +08002132 name = "COLOR_SPACE_AGNOSTIC"),
2133 @ViewDebug.FlagToString(
Tiger Huang7238a052020-01-10 20:37:01 +08002134 mask = PRIVATE_FLAG_APPEARANCE_CONTROLLED,
2135 equals = PRIVATE_FLAG_APPEARANCE_CONTROLLED,
2136 name = "APPEARANCE_CONTROLLED"),
2137 @ViewDebug.FlagToString(
2138 mask = PRIVATE_FLAG_BEHAVIOR_CONTROLLED,
2139 equals = PRIVATE_FLAG_BEHAVIOR_CONTROLLED,
2140 name = "BEHAVIOR_CONTROLLED"),
2141 @ViewDebug.FlagToString(
Tiger Huang4a7835f2019-11-06 00:07:56 +08002142 mask = PRIVATE_FLAG_FIT_INSETS_CONTROLLED,
2143 equals = PRIVATE_FLAG_FIT_INSETS_CONTROLLED,
Jorim Jaggi0da8fd12020-01-10 01:23:21 +01002144 name = "FIT_INSETS_CONTROLLED")
Jorim Jaggi484851b2017-09-22 16:03:27 +02002145 })
Robert Carrb48380a2017-04-04 14:56:37 -07002146 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002147 public int privateFlags;
2148
2149 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 * Given a particular set of window manager flags, determine whether
2151 * such a window may be a target for an input method when it has
2152 * focus. In particular, this checks the
2153 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
2154 * flags and returns true if the combination of the two corresponds
2155 * to a window that needs to be behind the input method so that the
2156 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002157 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002159 *
Tarandeep Singhbcba88c2019-12-06 10:36:55 -08002160 * @return Returns {@code true} if such a window should be behind/interact
2161 * with an input method, {@code false} if not.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002162 */
2163 public static boolean mayUseInputMethod(int flags) {
Tarandeep Singhbcba88c2019-12-06 10:36:55 -08002164 return (flags & FLAG_NOT_FOCUSABLE) != FLAG_NOT_FOCUSABLE
2165 && (flags & FLAG_ALT_FOCUSABLE_IM) != FLAG_ALT_FOCUSABLE_IM;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002166 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002167
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002168 /**
2169 * Mask for {@link #softInputMode} of the bits that determine the
2170 * desired visibility state of the soft input area for this window.
2171 */
2172 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002173
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 /**
Yohei Yukawaa7547852018-03-27 15:47:45 -07002175 * Visibility state for {@link #softInputMode}: no state has been specified. The system may
2176 * show or hide the software keyboard for better user experience when the window gains
2177 * focus.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002178 */
2179 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002180
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002181 /**
2182 * Visibility state for {@link #softInputMode}: please don't change the state of
2183 * the soft input area.
2184 */
2185 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002187 /**
2188 * Visibility state for {@link #softInputMode}: please hide any soft input
2189 * area when normally appropriate (when the user is navigating
2190 * forward to your window).
2191 */
2192 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002194 /**
2195 * Visibility state for {@link #softInputMode}: please always hide any
2196 * soft input area when this window receives focus.
2197 */
2198 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002199
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002200 /**
2201 * Visibility state for {@link #softInputMode}: please show the soft
2202 * input area when normally appropriate (when the user is navigating
2203 * forward to your window).
Yohei Yukawacf68d522017-12-12 09:33:26 -08002204 *
2205 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2206 * is ignored unless there is a focused view that returns {@code true} from
2207 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002208 */
2209 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002210
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002211 /**
2212 * Visibility state for {@link #softInputMode}: please always make the
2213 * soft input area visible when this window receives input focus.
Yohei Yukawacf68d522017-12-12 09:33:26 -08002214 *
2215 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2216 * is ignored unless there is a focused view that returns {@code true} from
2217 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002218 */
2219 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002220
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002221 /**
2222 * Mask for {@link #softInputMode} of the bits that determine the
2223 * way that the window should be adjusted to accommodate the soft
2224 * input window.
2225 */
2226 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002227
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002228 /** Adjustment option for {@link #softInputMode}: nothing specified.
2229 * The system will try to pick one or
2230 * the other depending on the contents of the window.
2231 */
2232 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002234 /** Adjustment option for {@link #softInputMode}: set to allow the
2235 * window to be resized when an input
2236 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07002237 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002238 * {@link #SOFT_INPUT_ADJUST_PAN}; if
2239 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07002240 * the other depending on the contents of the window. If the window's
2241 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
2242 * value for {@link #softInputMode} will be ignored; the window will
2243 * not resize, but will stay fullscreen.
Tiger Huang52724442020-01-20 21:38:42 +08002244 *
Jorim Jaggi1f08f642020-01-29 13:11:46 +01002245 * @deprecated Call {@link Window#setDecorFitsSystemWindows(boolean)} with {@code false} and
2246 * install an {@link OnApplyWindowInsetsListener} on your root content view that fits insets
2247 * of type {@link Type#ime()}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002248 */
Tiger Huang52724442020-01-20 21:38:42 +08002249 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002250 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002251
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002252 /** Adjustment option for {@link #softInputMode}: set to have a window
2253 * pan when an input method is
2254 * shown, so it doesn't need to deal with resizing but just panned
2255 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07002256 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002257 * neither of these are set, then the system will try to pick one or
2258 * the other depending on the contents of the window.
2259 */
2260 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002261
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002262 /** Adjustment option for {@link #softInputMode}: set to have a window
2263 * not adjust for a shown input method. The window will not be resized,
2264 * and it will not be panned to make its focus visible.
2265 */
2266 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
2267
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002268 /**
2269 * Bit for {@link #softInputMode}: set when the user has navigated
2270 * forward to the window. This is normally set automatically for
2271 * you by the system, though you may want to set it in certain cases
2272 * when you are displaying a window yourself. This flag will always
2273 * be cleared automatically after the window is displayed.
2274 */
2275 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002276
2277 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002278 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2279 *
2280 * @hide
2281 */
2282 @Retention(RetentionPolicy.SOURCE)
Jeff Sharkeyce8db992017-12-13 20:05:05 -07002283 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = {
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002284 SOFT_INPUT_STATE_UNSPECIFIED,
2285 SOFT_INPUT_STATE_UNCHANGED,
2286 SOFT_INPUT_STATE_HIDDEN,
2287 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
2288 SOFT_INPUT_STATE_VISIBLE,
2289 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
2290 SOFT_INPUT_ADJUST_UNSPECIFIED,
2291 SOFT_INPUT_ADJUST_RESIZE,
2292 SOFT_INPUT_ADJUST_PAN,
2293 SOFT_INPUT_ADJUST_NOTHING,
2294 SOFT_INPUT_IS_FORWARD_NAVIGATION,
2295 })
2296 public @interface SoftInputModeFlags {}
2297
2298 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08002299 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002301 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002302 * <ul>
2303 * <li> One of the visibility states
2304 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002305 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
2306 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002308 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
2309 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08002310 * </ul>
2311 *
2312 *
2313 * <p>This flag can be controlled in your theme through the
2314 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002315 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002316 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002317 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002318
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002319 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002320 * Placement of window within the screen as per {@link Gravity}. Both
2321 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2322 * android.graphics.Rect) Gravity.apply} and
2323 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2324 * Gravity.applyDisplay} are used during window layout, with this value
2325 * given as the desired gravity. For example you can specify
2326 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
2327 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
2328 * to control the behavior of
2329 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2330 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002331 *
2332 * @see Gravity
2333 */
2334 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002335
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 /**
2337 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002338 * between the container and the widget. See
2339 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2340 * android.graphics.Rect) Gravity.apply} for how this is used. This
2341 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 */
2343 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 /**
2346 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002347 * between the container and the widget. See
2348 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2349 * android.graphics.Rect) Gravity.apply} for how this is used. This
2350 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002351 */
2352 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002353
2354 /**
2355 * Positive insets between the drawing surface and window content.
2356 *
2357 * @hide
2358 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07002359 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08002360
2361 /**
2362 * Whether the surface insets have been manually set. When set to
2363 * {@code false}, the view root will automatically determine the
2364 * appropriate surface insets.
2365 *
2366 * @see #surfaceInsets
2367 * @hide
2368 */
2369 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002371 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07002372 * Whether the previous surface insets should be used vs. what is currently set. When set
2373 * to {@code true}, the view root will ignore surfaces insets in this object and use what
2374 * it currently has.
2375 *
2376 * @see #surfaceInsets
2377 * @hide
2378 */
2379 public boolean preservePreviousSurfaceInsets = true;
2380
2381 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002382 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08002383 * {@link android.graphics.PixelFormat}. The choice of format
2384 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 */
2386 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002387
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002388 /**
2389 * A style resource defining the animations to use for this window.
2390 * This must be a system resource; it can not be an application resource
2391 * because the window manager does not have access to applications.
2392 */
2393 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002394
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002395 /**
2396 * An alpha value to apply to this entire window.
2397 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
2398 */
2399 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002400
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002401 /**
2402 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
2403 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
2404 * dim.
2405 */
2406 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002407
2408 /**
2409 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
2410 * indicating that the brightness value is not overridden for this window
2411 * and normal brightness policy should be used.
2412 */
2413 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
2414
2415 /**
2416 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2417 * indicating that the screen or button backlight brightness should be set
2418 * to the lowest value when this window is in front.
2419 */
2420 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
2421
2422 /**
2423 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2424 * indicating that the screen or button backlight brightness should be set
2425 * to the hightest value when this window is in front.
2426 */
2427 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002428
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002429 /**
2430 * This can be used to override the user's preferred brightness of
2431 * the screen. A value of less than 0, the default, means to use the
2432 * preferred screen brightness. 0 to 1 adjusts the brightness from
2433 * dark to full bright.
2434 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002435 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002436
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002437 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002438 * This can be used to override the standard behavior of the button and
2439 * keyboard backlights. A value of less than 0, the default, means to
2440 * use the standard backlight behavior. 0 to 1 adjusts the brightness
2441 * from dark to full bright.
2442 */
2443 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
2444
2445 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07002446 * Unspecified value for {@link #rotationAnimation} indicating
2447 * a lack of preference.
2448 * @hide
2449 */
2450 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
2451
2452 /**
Robert Carr652aae42016-10-17 16:48:14 -07002453 * Value for {@link #rotationAnimation} which specifies that this
2454 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002455 */
2456 public static final int ROTATION_ANIMATION_ROTATE = 0;
2457
2458 /**
Robert Carr652aae42016-10-17 16:48:14 -07002459 * Value for {@link #rotationAnimation} which specifies that this
2460 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002461 */
2462 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
2463
2464 /**
Robert Carr652aae42016-10-17 16:48:14 -07002465 * Value for {@link #rotationAnimation} which specifies that this window
2466 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002467 */
2468 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
2469
2470 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07002471 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
2472 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07002473 * can't be applied without pausing the screen. For example, this is ideal
2474 * for Camera apps which don't want the viewfinder contents to ever rotate
2475 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
2476 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07002477 */
2478 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
2479
2480 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002481 * Define the exit and entry animations used on this window when the device is rotated.
2482 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08002483 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002484 * by other windows. All other situations default to the
2485 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002486 *
Craig Mautner3c174372013-02-21 17:54:37 -08002487 * @see #ROTATION_ANIMATION_ROTATE
2488 * @see #ROTATION_ANIMATION_CROSSFADE
2489 * @see #ROTATION_ANIMATION_JUMPCUT
2490 */
2491 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
2492
2493 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002494 * Identifier for this window. This will usually be filled in for
2495 * you.
2496 */
2497 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002499 /**
2500 * Name of the package owning this window.
2501 */
2502 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002504 /**
2505 * Specific orientation value for a window.
2506 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002507 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
2508 * If not set, a default value of
2509 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002510 * will be used.
2511 */
Vadim Caenfc14c662020-01-20 16:00:31 +01002512 @ActivityInfo.ScreenOrientation
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002513 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08002514
2515 /**
Michael Wright3f145a22014-07-22 19:46:03 -07002516 * The preferred refresh rate for the window.
2517 *
2518 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002519 * is on. The selected refresh rate will be applied to the display's default mode.
2520 *
2521 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07002522 *
2523 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002524 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07002525 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002526 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07002527 public float preferredRefreshRate;
2528
2529 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002530 * Id of the preferred display mode for the window.
2531 * <p>
2532 * This must be one of the supported modes obtained for the display(s) the window is on.
2533 * A value of {@code 0} means no preference.
2534 *
2535 * @see Display#getSupportedModes()
2536 * @see Display.Mode#getModeId()
2537 */
2538 public int preferredDisplayModeId;
2539
2540 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002541 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08002542 *
2543 * @see View#STATUS_BAR_VISIBLE
2544 * @see View#STATUS_BAR_HIDDEN
Tiger Huang52724442020-01-20 21:38:42 +08002545 *
2546 * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController}
2547 * instead.
Joe Onorato664644d2011-01-23 17:53:23 -08002548 */
Tiger Huang52724442020-01-20 21:38:42 +08002549 @Deprecated
Joe Onorato664644d2011-01-23 17:53:23 -08002550 public int systemUiVisibility;
2551
2552 /**
Joe Onorato14782f72011-01-25 19:53:17 -08002553 * @hide
2554 * The ui visibility as requested by the views in this hierarchy.
2555 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
2556 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002557 @UnsupportedAppUsage
Joe Onorato14782f72011-01-25 19:53:17 -08002558 public int subtreeSystemUiVisibility;
2559
2560 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002561 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002562 *
Joe Onorato664644d2011-01-23 17:53:23 -08002563 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
2564 *
2565 * @hide
2566 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002567 @UnsupportedAppUsage
Joe Onorato664644d2011-01-23 17:53:23 -08002568 public boolean hasSystemUiListeners;
2569
Adrian Roosfa02da62018-01-15 16:01:18 +01002570
2571 /** @hide */
2572 @Retention(RetentionPolicy.SOURCE)
2573 @IntDef(
2574 flag = true,
2575 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
Adrian Roos87526af2018-03-27 16:36:25 +02002576 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
shawnlind0e23be2019-12-29 18:56:15 +08002577 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER,
2578 LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS})
Adrian Roosfa02da62018-01-15 16:01:18 +01002579 @interface LayoutInDisplayCutoutMode {}
2580
2581 /**
2582 * Controls how the window is laid out if there is a {@link DisplayCutout}.
2583 *
2584 * <p>
2585 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}.
2586 *
2587 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
Adrian Roos87526af2018-03-27 16:36:25 +02002588 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Adrian Roosfa02da62018-01-15 16:01:18 +01002589 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
shawnlind0e23be2019-12-29 18:56:15 +08002590 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
Adrian Roosfa02da62018-01-15 16:01:18 +01002591 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002592 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2593 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002594 */
2595 @LayoutInDisplayCutoutMode
2596 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
2597
2598 /**
2599 * The window is allowed to extend into the {@link DisplayCutout} area, only if the
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002600 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is
Adrian Roosfa02da62018-01-15 16:01:18 +01002601 * laid out such that it does not overlap with the {@link DisplayCutout} area.
2602 *
2603 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002604 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or
2605 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait
2606 * if the cutout is at the top edge. Similarly for
2607 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen.
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002608 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the
Adrian Roosfa02da62018-01-15 16:01:18 +01002609 * cutout area.
2610 *
2611 * <p>
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002612 * The usual precautions for not overlapping with the status and navigation bar are
2613 * sufficient for ensuring that no important content overlaps with the DisplayCutout.
Adrian Roosfa02da62018-01-15 16:01:18 +01002614 *
2615 * @see DisplayCutout
2616 * @see WindowInsets
Adrian Roos87526af2018-03-27 16:36:25 +02002617 * @see #layoutInDisplayCutoutMode
2618 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2619 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002620 */
2621 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;
2622
2623 /**
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002624 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
2625 * edges of the screen.
2626 *
2627 * The window will never extend into a {@link DisplayCutout} area on the long edges of the
2628 * screen.
Adrian Roosfa02da62018-01-15 16:01:18 +01002629 *
2630 * <p>
2631 * The window must make sure that no important content overlaps with the
2632 * {@link DisplayCutout}.
2633 *
Adrian Roosad1da312018-03-27 19:17:50 +02002634 * <p>
2635 * In this mode, the window extends under cutouts on the short edge of the display in both
2636 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/>
2637 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png"
2638 * height="720"
2639 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in
2640 * portrait, no letterbox is applied."/>
2641 *
2642 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png"
2643 * width="720"
2644 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape,
2645 * no letterbox is applied."/>
2646 *
2647 * <p>
2648 * A cutout in the corner is considered to be on the short edge: <br/>
2649 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png"
2650 * height="720"
2651 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in
2652 * portrait, no letterbox is applied."/>
2653 *
2654 * <p>
2655 * On the other hand, should the cutout be on the long edge of the display, a letterbox will
2656 * be applied such that the window does not extend into the cutout on either long edge:
2657 * <br/>
2658 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png"
2659 * height="720"
2660 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait,
2661 * letterbox is applied."/>
2662 *
Adrian Roosfa02da62018-01-15 16:01:18 +01002663 * @see DisplayCutout
2664 * @see WindowInsets#getDisplayCutout()
Adrian Roos87526af2018-03-27 16:36:25 +02002665 * @see #layoutInDisplayCutoutMode
2666 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2667 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002668 */
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002669 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1;
Adrian Roosfa02da62018-01-15 16:01:18 +01002670
2671 /**
2672 * The window is never allowed to overlap with the DisplayCutout area.
2673 *
2674 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002675 * This should be used with windows that transiently set
2676 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION}
2677 * to avoid a relayout of the window when the respective flag is set or cleared.
Adrian Roosfa02da62018-01-15 16:01:18 +01002678 *
2679 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002680 * @see #layoutInDisplayCutoutMode
2681 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2682 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002683 */
2684 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;
2685
shawnlind0e23be2019-12-29 18:56:15 +08002686 /**
2687 * The window is always allowed to extend into the {@link DisplayCutout} areas on the all
2688 * edges of the screen.
2689 *
2690 * <p>
2691 * The window must make sure that no important content overlaps with the
2692 * {@link DisplayCutout}.
2693 *
2694 * <p>
2695 * In this mode, the window extends under cutouts on the all edges of the display in both
2696 * portrait and landscape, regardless of whether the window is hiding the system bars.
2697 *
2698 * @see DisplayCutout
2699 * @see WindowInsets#getDisplayCutout()
2700 * @see #layoutInDisplayCutoutMode
2701 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2702 * android:windowLayoutInDisplayCutoutMode
2703 */
2704 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 3;
Adrian Roosfa02da62018-01-15 16:01:18 +01002705
Jeff Brown474dcb52011-06-14 20:22:50 -07002706 /**
2707 * When this window has focus, disable touch pad pointer gesture processing.
2708 * The window will receive raw position updates from the touch pad instead
2709 * of pointer movements and synthetic touch events.
2710 *
2711 * @hide
2712 */
2713 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
2714
2715 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07002716 * Does not construct an input channel for this window. The channel will therefore
2717 * be incapable of receiving input.
2718 *
2719 * @hide
2720 */
2721 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
2722
2723 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002724 * When this window has focus, does not call user activity for all input events so
2725 * the application will have to do it itself. Should only be used by
2726 * the keyguard and phone app.
2727 * <p>
2728 * Should only be used by the keyguard and phone app.
2729 * </p>
2730 *
2731 * @hide
2732 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002733 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002734 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
2735
2736 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07002737 * Control special features of the input subsystem.
2738 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002739 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07002740 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002741 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07002742 * @hide
2743 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002744 @UnsupportedAppUsage
Jeff Brown474dcb52011-06-14 20:22:50 -07002745 public int inputFeatures;
2746
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002747 /**
2748 * Sets the number of milliseconds before the user activity timeout occurs
2749 * when this window has focus. A value of -1 uses the standard timeout.
2750 * A value of 0 uses the minimum support display timeout.
2751 * <p>
2752 * This property can only be used to reduce the user specified display timeout;
2753 * it can never make the timeout longer than it normally would be.
2754 * </p><p>
2755 * Should only be used by the keyguard and phone app.
2756 * </p>
2757 *
2758 * @hide
2759 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002760 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002761 public long userActivityTimeout = -1;
2762
Phil Weaver396d5492016-03-22 17:53:50 -07002763 /**
2764 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
2765 * window.
2766 *
2767 * @hide
2768 */
Phil Weaver8583ae82018-02-13 11:01:24 -08002769 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
Phil Weaver396d5492016-03-22 17:53:50 -07002770
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002771 /**
2772 * The window title isn't kept in sync with what is displayed in the title bar, so we
2773 * separately track the currently shown title to provide to accessibility.
2774 *
2775 * @hide
2776 */
Alan Viverette39259dd2017-05-25 11:10:46 -04002777 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002778 public CharSequence accessibilityTitle;
2779
Robert Carr70f0d222016-04-10 16:33:08 -07002780 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002781 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07002782 * by the window manager. Useful for transient notifications like toasts
2783 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002784 * is hidden. Must be specified at window creation time. Note that apps
2785 * are not prepared to handle their windows being removed without their
2786 * explicit request and may try to interact with the removed window
2787 * resulting in undefined behavior and crashes. Therefore, we do hide
2788 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07002789 *
2790 * @hide
2791 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002792 @UnsupportedAppUsage
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002793 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07002794
Romain Guy48327452017-01-23 17:03:35 -08002795 /**
Galia Peycheva056b3ee2019-06-26 14:05:12 +02002796 * Indicates whether this window wants the connected display to do minimal post processing
2797 * on the produced image or video frames. This will only be requested if the window is
2798 * visible on the screen.
2799 *
2800 * <p>This setting should be used when low latency has a higher priority than image
2801 * enhancement processing (e.g. for games or video conferencing).
2802 *
2803 * <p>If the Display sink is connected via HDMI, the device will begin to send infoframes
2804 * with Auto Low Latency Mode enabled and Game Content Type. This will switch the connected
2805 * display to a minimal image processing mode (if available), which reduces latency,
2806 * improving the user experience for gaming or video conferencing applications. For more
2807 * information, see HDMI 2.1 specification.
2808 *
2809 * <p>If the Display sink has an internal connection or uses some other protocol than HDMI,
2810 * effects may be similar but implementation-defined.
2811 *
2812 * <p>The ability to switch to a mode with minimal post proessing may be disabled by a user
2813 * setting in the system settings menu. In that case, this field is ignored and the display
2814 * will remain in its current mode.
2815 *
Galia Peychevabdd66e32020-02-27 19:16:28 +01002816 * @see android.content.pm.ActivityInfo#FLAG_PREFER_MINIMAL_POST_PROCESSING
Galia Peycheva056b3ee2019-06-26 14:05:12 +02002817 * @see android.view.Display#isMinimalPostProcessingSupported
2818 * @see android.view.Window#setPreferMinimalPostProcessing
2819 */
2820 public boolean preferMinimalPostProcessing = false;
2821
2822 /**
Romain Guy48327452017-01-23 17:03:35 -08002823 * The color mode requested by this window. The target display may
2824 * not be able to honor the request. When the color mode is not set
2825 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
2826 * pixel format specified in {@link #format}.
2827 *
2828 * @hide
2829 */
2830 @ActivityInfo.ColorMode
Jorim Jaggi484851b2017-09-22 16:03:27 +02002831 private int mColorMode = COLOR_MODE_DEFAULT;
Romain Guy48327452017-01-23 17:03:35 -08002832
Jorim Jaggib7848b72018-12-28 14:38:21 +01002833 /**
2834 * Carries the requests about {@link WindowInsetsController.Appearance} and
2835 * {@link WindowInsetsController.Behavior} to the system windows which can produce insets.
2836 *
2837 * @hide
2838 */
2839 public final InsetsFlags insetsFlags = new InsetsFlags();
2840
Tiger Huang4a7835f2019-11-06 00:07:56 +08002841 @ViewDebug.ExportedProperty(flagMapping = {
2842 @ViewDebug.FlagToString(
2843 mask = STATUS_BARS,
2844 equals = STATUS_BARS,
2845 name = "STATUS_BARS"),
2846 @ViewDebug.FlagToString(
2847 mask = NAVIGATION_BARS,
2848 equals = NAVIGATION_BARS,
2849 name = "NAVIGATION_BARS"),
2850 @ViewDebug.FlagToString(
2851 mask = CAPTION_BAR,
2852 equals = CAPTION_BAR,
2853 name = "CAPTION_BAR"),
2854 @ViewDebug.FlagToString(
2855 mask = IME,
2856 equals = IME,
2857 name = "IME"),
2858 @ViewDebug.FlagToString(
2859 mask = SYSTEM_GESTURES,
2860 equals = SYSTEM_GESTURES,
2861 name = "SYSTEM_GESTURES"),
2862 @ViewDebug.FlagToString(
2863 mask = MANDATORY_SYSTEM_GESTURES,
2864 equals = MANDATORY_SYSTEM_GESTURES,
2865 name = "MANDATORY_SYSTEM_GESTURES"),
2866 @ViewDebug.FlagToString(
2867 mask = TAPPABLE_ELEMENT,
2868 equals = TAPPABLE_ELEMENT,
2869 name = "TAPPABLE_ELEMENT"),
2870 @ViewDebug.FlagToString(
2871 mask = WINDOW_DECOR,
2872 equals = WINDOW_DECOR,
2873 name = "WINDOW_DECOR")
2874 })
Tiger Huang52724442020-01-20 21:38:42 +08002875 private @InsetsType int mFitInsetsTypes = Type.systemBars();
Tiger Huang4a7835f2019-11-06 00:07:56 +08002876
2877 @ViewDebug.ExportedProperty(flagMapping = {
2878 @ViewDebug.FlagToString(
2879 mask = LEFT,
2880 equals = LEFT,
2881 name = "LEFT"),
2882 @ViewDebug.FlagToString(
2883 mask = TOP,
2884 equals = TOP,
2885 name = "TOP"),
2886 @ViewDebug.FlagToString(
2887 mask = RIGHT,
2888 equals = RIGHT,
2889 name = "RIGHT"),
2890 @ViewDebug.FlagToString(
2891 mask = BOTTOM,
2892 equals = BOTTOM,
2893 name = "BOTTOM")
2894 })
Tiger Huang52724442020-01-20 21:38:42 +08002895 private @InsetsSide int mFitInsetsSides = Side.all();
Tiger Huang4a7835f2019-11-06 00:07:56 +08002896
Tiger Huang52724442020-01-20 21:38:42 +08002897 private boolean mFitInsetsIgnoringVisibility = false;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002898
2899 /**
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08002900 * {@link InsetsState.InternalInsetsType}s to be applied to the window
2901 * If {@link #type} has the predefined insets (like {@link #TYPE_STATUS_BAR} or
2902 * {@link #TYPE_NAVIGATION_BAR}), this field will be ignored.
2903 *
2904 * <p>Note: provide only one inset corresponding to the window type (like
2905 * {@link InsetsState.InternalInsetsType#ITYPE_STATUS_BAR} or
2906 * {@link InsetsState.InternalInsetsType#ITYPE_NAVIGATION_BAR})</p>
2907 * @hide
2908 */
2909 public @InsetsState.InternalInsetsType int[] providesInsetsTypes;
2910
2911 /**
Tiger Huang4a7835f2019-11-06 00:07:56 +08002912 * Specifies types of insets that this window should avoid overlapping during layout.
2913 *
2914 * @param types which types of insets that this window should avoid. The initial value of
2915 * this object includes all system bars.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002916 */
Tiger Huang52724442020-01-20 21:38:42 +08002917 public void setFitInsetsTypes(@InsetsType int types) {
2918 mFitInsetsTypes = types;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002919 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
2920 }
2921
2922 /**
2923 * Specifies sides of insets that this window should avoid overlapping during layout.
2924 *
2925 * @param sides which sides that this window should avoid overlapping with the types
2926 * specified. The initial value of this object includes all sides.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002927 */
Tiger Huang52724442020-01-20 21:38:42 +08002928 public void setFitInsetsSides(@InsetsSide int sides) {
2929 mFitInsetsSides = sides;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002930 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
2931 }
2932
2933 /**
2934 * Specifies if this window should fit the window insets no matter they are visible or not.
2935 *
2936 * @param ignore if true, this window will fit the given types even if they are not visible.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002937 */
Tiger Huang52724442020-01-20 21:38:42 +08002938 public void setFitInsetsIgnoringVisibility(boolean ignore) {
2939 mFitInsetsIgnoringVisibility = ignore;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002940 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
2941 }
2942
2943 /**
2944 * @return the insets types that this window is avoiding overlapping.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002945 */
Tiger Huang52724442020-01-20 21:38:42 +08002946 public @InsetsType int getFitInsetsTypes() {
2947 return mFitInsetsTypes;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002948 }
2949
2950 /**
2951 * @return the sides that this window is avoiding overlapping.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002952 */
Tiger Huang52724442020-01-20 21:38:42 +08002953 public @InsetsSide int getFitInsetsSides() {
2954 return mFitInsetsSides;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002955 }
2956
2957 /**
2958 * @return {@code true} if this window fits the window insets no matter they are visible or
2959 * not.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002960 */
Tiger Huang52724442020-01-20 21:38:42 +08002961 public boolean isFitInsetsIgnoringVisibility() {
2962 return mFitInsetsIgnoringVisibility;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002963 }
2964
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002965 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08002966 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002967 type = TYPE_APPLICATION;
2968 format = PixelFormat.OPAQUE;
2969 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002970
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08002972 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 type = _type;
2974 format = PixelFormat.OPAQUE;
2975 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002976
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08002978 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 type = _type;
2980 flags = _flags;
2981 format = PixelFormat.OPAQUE;
2982 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002983
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002984 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002985 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 type = _type;
2987 flags = _flags;
2988 format = _format;
2989 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002990
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002991 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2992 super(w, h);
2993 type = _type;
2994 flags = _flags;
2995 format = _format;
2996 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002997
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002998 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2999 int _flags, int _format) {
3000 super(w, h);
3001 x = xpos;
3002 y = ypos;
3003 type = _type;
3004 flags = _flags;
3005 format = _format;
3006 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003007
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 public final void setTitle(CharSequence title) {
3009 if (null == title)
3010 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003011
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003012 mTitle = TextUtils.stringOrSpannedString(title);
3013 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003015 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003016 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08003018
Wale Ogunwale246c2092016-04-07 14:12:44 -07003019 /**
3020 * Sets the surface insets based on the elevation (visual z position) of the input view.
3021 * @hide
3022 */
3023 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
3024 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07003025 // Partial workaround for b/28318973. Every inset change causes a freeform window
3026 // to jump a little for a few frames. If we never allow surface insets to decrease,
3027 // they will stabilize quickly (often from the very beginning, as most windows start
3028 // as focused).
3029 // TODO(b/22668382) to fix this properly.
3030 if (surfaceInset == 0) {
3031 // OK to have 0 (this is the case for non-freeform windows).
3032 surfaceInsets.set(0, 0, 0, 0);
3033 } else {
3034 surfaceInsets.set(
3035 Math.max(surfaceInset, surfaceInsets.left),
3036 Math.max(surfaceInset, surfaceInsets.top),
3037 Math.max(surfaceInset, surfaceInsets.right),
3038 Math.max(surfaceInset, surfaceInsets.bottom));
3039 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003040 hasManualSurfaceInsets = manual;
3041 preservePreviousSurfaceInsets = preservePrevious;
3042 }
3043
Romain Guy48327452017-01-23 17:03:35 -08003044 /**
3045 * <p>Set the color mode of the window. Setting the color mode might
3046 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
3047 *
3048 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
3049 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
3050 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
3051 *
3052 * @see #getColorMode()
3053 */
3054 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
3055 mColorMode = colorMode;
3056 }
3057
3058 /**
3059 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
3060 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
3061 *
3062 * @see #setColorMode(int)
3063 */
3064 @ActivityInfo.ColorMode
3065 public int getColorMode() {
3066 return mColorMode;
3067 }
3068
Bryce Lee53b9fbd2015-02-06 12:06:34 -08003069 /** @hide */
3070 @SystemApi
3071 public final void setUserActivityTimeout(long timeout) {
3072 userActivityTimeout = timeout;
3073 }
3074
3075 /** @hide */
3076 @SystemApi
3077 public final long getUserActivityTimeout() {
3078 return userActivityTimeout;
3079 }
3080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 public int describeContents() {
3082 return 0;
3083 }
3084
3085 public void writeToParcel(Parcel out, int parcelableFlags) {
3086 out.writeInt(width);
3087 out.writeInt(height);
3088 out.writeInt(x);
3089 out.writeInt(y);
3090 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003092 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003093 out.writeInt(softInputMode);
Adrian Roosfa02da62018-01-15 16:01:18 +01003094 out.writeInt(layoutInDisplayCutoutMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003095 out.writeInt(gravity);
3096 out.writeFloat(horizontalMargin);
3097 out.writeFloat(verticalMargin);
3098 out.writeInt(format);
3099 out.writeInt(windowAnimations);
3100 out.writeFloat(alpha);
3101 out.writeFloat(dimAmount);
3102 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003103 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08003104 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 out.writeStrongBinder(token);
3106 out.writeString(packageName);
3107 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
3108 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07003109 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003110 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08003111 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08003112 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08003113 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07003114 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003115 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07003116 out.writeInt(surfaceInsets.left);
3117 out.writeInt(surfaceInsets.top);
3118 out.writeInt(surfaceInsets.right);
3119 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08003120 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07003121 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Phil Weaver8583ae82018-02-13 11:01:24 -08003122 out.writeLong(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003123 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07003124 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003125 out.writeLong(hideTimeoutMilliseconds);
Jorim Jaggib7848b72018-12-28 14:38:21 +01003126 out.writeInt(insetsFlags.appearance);
3127 out.writeInt(insetsFlags.behavior);
Tiger Huang52724442020-01-20 21:38:42 +08003128 out.writeInt(mFitInsetsTypes);
3129 out.writeInt(mFitInsetsSides);
3130 out.writeBoolean(mFitInsetsIgnoringVisibility);
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003131 out.writeBoolean(preferMinimalPostProcessing);
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003132 if (providesInsetsTypes != null) {
3133 out.writeInt(providesInsetsTypes.length);
3134 out.writeIntArray(providesInsetsTypes);
3135 } else {
3136 out.writeInt(0);
3137 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003138 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003139
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07003140 public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003141 = new Parcelable.Creator<LayoutParams>() {
3142 public LayoutParams createFromParcel(Parcel in) {
3143 return new LayoutParams(in);
3144 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003145
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 public LayoutParams[] newArray(int size) {
3147 return new LayoutParams[size];
3148 }
3149 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003150
3151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 public LayoutParams(Parcel in) {
3153 width = in.readInt();
3154 height = in.readInt();
3155 x = in.readInt();
3156 y = in.readInt();
3157 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003158 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003159 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003160 softInputMode = in.readInt();
Adrian Roosfa02da62018-01-15 16:01:18 +01003161 layoutInDisplayCutoutMode = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003162 gravity = in.readInt();
3163 horizontalMargin = in.readFloat();
3164 verticalMargin = in.readFloat();
3165 format = in.readInt();
3166 windowAnimations = in.readInt();
3167 alpha = in.readFloat();
3168 dimAmount = in.readFloat();
3169 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003170 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08003171 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003172 token = in.readStrongBinder();
3173 packageName = in.readString();
3174 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
3175 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07003176 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003177 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08003178 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08003179 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08003180 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07003181 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003182 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07003183 surfaceInsets.left = in.readInt();
3184 surfaceInsets.top = in.readInt();
3185 surfaceInsets.right = in.readInt();
3186 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08003187 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07003188 preservePreviousSurfaceInsets = in.readInt() != 0;
Phil Weaver8583ae82018-02-13 11:01:24 -08003189 accessibilityIdOfAnchor = in.readLong();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003190 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07003191 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003192 hideTimeoutMilliseconds = in.readLong();
Jorim Jaggib7848b72018-12-28 14:38:21 +01003193 insetsFlags.appearance = in.readInt();
3194 insetsFlags.behavior = in.readInt();
Tiger Huang52724442020-01-20 21:38:42 +08003195 mFitInsetsTypes = in.readInt();
3196 mFitInsetsSides = in.readInt();
3197 mFitInsetsIgnoringVisibility = in.readBoolean();
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003198 preferMinimalPostProcessing = in.readBoolean();
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003199 int insetsTypesLength = in.readInt();
3200 if (insetsTypesLength > 0) {
3201 providesInsetsTypes = new int[insetsTypesLength];
3202 in.readIntArray(providesInsetsTypes);
3203 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003204 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003205
Romain Guy72998072009-06-22 11:09:20 -07003206 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 public static final int LAYOUT_CHANGED = 1<<0;
3208 public static final int TYPE_CHANGED = 1<<1;
3209 public static final int FLAGS_CHANGED = 1<<2;
3210 public static final int FORMAT_CHANGED = 1<<3;
3211 public static final int ANIMATION_CHANGED = 1<<4;
3212 public static final int DIM_AMOUNT_CHANGED = 1<<5;
3213 public static final int TITLE_CHANGED = 1<<6;
3214 public static final int ALPHA_CHANGED = 1<<7;
3215 public static final int MEMORY_TYPE_CHANGED = 1<<8;
3216 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
3217 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
3218 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08003219 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003220 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003221 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08003222 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003223 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08003224 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003225 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07003226 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003227 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003228 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003229 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07003230 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003231 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003232 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04003233 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
3234 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07003235 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003236 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07003237 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
3238 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003239 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
3240 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07003241 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
3242 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04003243 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003244 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
3245 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07003246 public static final int COLOR_MODE_CHANGED = 1 << 26;
3247 /** {@hide} */
Jorim Jaggib7848b72018-12-28 14:38:21 +01003248 public static final int INSET_FLAGS_CHANGED = 1 << 27;
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003249 /** {@hide} */
3250 public static final int MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED = 1 << 28;
Romain Guyf21c9b02011-09-06 16:56:54 -07003251
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003252 // internal buffer to backup/restore parameters under compatibility mode.
3253 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 public final int copyFrom(LayoutParams o) {
3256 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 if (width != o.width) {
3259 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07003260 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003261 }
3262 if (height != o.height) {
3263 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07003264 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003265 }
3266 if (x != o.x) {
3267 x = o.x;
3268 changes |= LAYOUT_CHANGED;
3269 }
3270 if (y != o.y) {
3271 y = o.y;
3272 changes |= LAYOUT_CHANGED;
3273 }
3274 if (horizontalWeight != o.horizontalWeight) {
3275 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07003276 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 }
3278 if (verticalWeight != o.verticalWeight) {
3279 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07003280 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003281 }
3282 if (horizontalMargin != o.horizontalMargin) {
3283 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07003284 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003285 }
3286 if (verticalMargin != o.verticalMargin) {
3287 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07003288 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003289 }
3290 if (type != o.type) {
3291 type = o.type;
3292 changes |= TYPE_CHANGED;
3293 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04003295 final int diff = flags ^ o.flags;
3296 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
3297 changes |= TRANSLUCENT_FLAGS_CHANGED;
3298 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07003300 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003302 if (privateFlags != o.privateFlags) {
3303 privateFlags = o.privateFlags;
3304 changes |= PRIVATE_FLAGS_CHANGED;
3305 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 if (softInputMode != o.softInputMode) {
3307 softInputMode = o.softInputMode;
3308 changes |= SOFT_INPUT_MODE_CHANGED;
3309 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003310 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) {
3311 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode;
3312 changes |= LAYOUT_CHANGED;
3313 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 if (gravity != o.gravity) {
3315 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07003316 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 if (format != o.format) {
3319 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07003320 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003321 }
3322 if (windowAnimations != o.windowAnimations) {
3323 windowAnimations = o.windowAnimations;
3324 changes |= ANIMATION_CHANGED;
3325 }
3326 if (token == null) {
3327 // NOTE: token only copied if the recipient doesn't
3328 // already have one.
3329 token = o.token;
3330 }
3331 if (packageName == null) {
3332 // NOTE: packageName only copied if the recipient doesn't
3333 // already have one.
3334 packageName = o.packageName;
3335 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08003336 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003337 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003338 mTitle = o.mTitle;
3339 changes |= TITLE_CHANGED;
3340 }
3341 if (alpha != o.alpha) {
3342 alpha = o.alpha;
3343 changes |= ALPHA_CHANGED;
3344 }
3345 if (dimAmount != o.dimAmount) {
3346 dimAmount = o.dimAmount;
3347 changes |= DIM_AMOUNT_CHANGED;
3348 }
3349 if (screenBrightness != o.screenBrightness) {
3350 screenBrightness = o.screenBrightness;
3351 changes |= SCREEN_BRIGHTNESS_CHANGED;
3352 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003353 if (buttonBrightness != o.buttonBrightness) {
3354 buttonBrightness = o.buttonBrightness;
3355 changes |= BUTTON_BRIGHTNESS_CHANGED;
3356 }
Craig Mautner3c174372013-02-21 17:54:37 -08003357 if (rotationAnimation != o.rotationAnimation) {
3358 rotationAnimation = o.rotationAnimation;
3359 changes |= ROTATION_ANIMATION_CHANGED;
3360 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003361
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003362 if (screenOrientation != o.screenOrientation) {
3363 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07003364 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003365 }
Romain Guy529b60a2010-08-03 18:05:47 -07003366
Michael Wright3f145a22014-07-22 19:46:03 -07003367 if (preferredRefreshRate != o.preferredRefreshRate) {
3368 preferredRefreshRate = o.preferredRefreshRate;
3369 changes |= PREFERRED_REFRESH_RATE_CHANGED;
3370 }
3371
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003372 if (preferredDisplayModeId != o.preferredDisplayModeId) {
3373 preferredDisplayModeId = o.preferredDisplayModeId;
3374 changes |= PREFERRED_DISPLAY_MODE_ID;
3375 }
3376
Joe Onorato14782f72011-01-25 19:53:17 -08003377 if (systemUiVisibility != o.systemUiVisibility
3378 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08003379 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08003380 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08003381 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
3382 }
3383
3384 if (hasSystemUiListeners != o.hasSystemUiListeners) {
3385 hasSystemUiListeners = o.hasSystemUiListeners;
3386 changes |= SYSTEM_UI_LISTENER_CHANGED;
3387 }
3388
Jeff Brown474dcb52011-06-14 20:22:50 -07003389 if (inputFeatures != o.inputFeatures) {
3390 inputFeatures = o.inputFeatures;
3391 changes |= INPUT_FEATURES_CHANGED;
3392 }
3393
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003394 if (userActivityTimeout != o.userActivityTimeout) {
3395 userActivityTimeout = o.userActivityTimeout;
3396 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
3397 }
3398
Alan Viverette49a22e82014-07-12 20:01:27 -07003399 if (!surfaceInsets.equals(o.surfaceInsets)) {
3400 surfaceInsets.set(o.surfaceInsets);
3401 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003402 }
3403
Alan Viverette5435a302015-01-29 10:25:34 -08003404 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
3405 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
3406 changes |= SURFACE_INSETS_CHANGED;
3407 }
3408
Wale Ogunwale246c2092016-04-07 14:12:44 -07003409 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
3410 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
3411 changes |= SURFACE_INSETS_CHANGED;
3412 }
3413
Phil Weaver396d5492016-03-22 17:53:50 -07003414 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
3415 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
3416 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
3417 }
3418
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003419 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
3420 && o.accessibilityTitle != null) {
3421 // NOTE: accessibilityTitle only copied if the originator set one.
3422 accessibilityTitle = o.accessibilityTitle;
3423 changes |= ACCESSIBILITY_TITLE_CHANGED;
3424 }
3425
Romain Guy26a2b972017-04-17 09:39:51 -07003426 if (mColorMode != o.mColorMode) {
3427 mColorMode = o.mColorMode;
3428 changes |= COLOR_MODE_CHANGED;
3429 }
3430
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003431 if (preferMinimalPostProcessing != o.preferMinimalPostProcessing) {
3432 preferMinimalPostProcessing = o.preferMinimalPostProcessing;
3433 changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED;
3434 }
3435
Robert Carr70f0d222016-04-10 16:33:08 -07003436 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003437 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07003438
Jorim Jaggib7848b72018-12-28 14:38:21 +01003439 if (insetsFlags.appearance != o.insetsFlags.appearance) {
3440 insetsFlags.appearance = o.insetsFlags.appearance;
3441 changes |= INSET_FLAGS_CHANGED;
3442 }
3443
3444 if (insetsFlags.behavior != o.insetsFlags.behavior) {
3445 insetsFlags.behavior = o.insetsFlags.behavior;
3446 changes |= INSET_FLAGS_CHANGED;
3447 }
3448
Tiger Huang52724442020-01-20 21:38:42 +08003449 if (mFitInsetsTypes != o.mFitInsetsTypes) {
3450 mFitInsetsTypes = o.mFitInsetsTypes;
Tiger Huang4a7835f2019-11-06 00:07:56 +08003451 changes |= LAYOUT_CHANGED;
3452 }
3453
Tiger Huang52724442020-01-20 21:38:42 +08003454 if (mFitInsetsSides != o.mFitInsetsSides) {
3455 mFitInsetsSides = o.mFitInsetsSides;
Tiger Huang4a7835f2019-11-06 00:07:56 +08003456 changes |= LAYOUT_CHANGED;
3457 }
3458
Tiger Huang52724442020-01-20 21:38:42 +08003459 if (mFitInsetsIgnoringVisibility != o.mFitInsetsIgnoringVisibility) {
3460 mFitInsetsIgnoringVisibility = o.mFitInsetsIgnoringVisibility;
Tiger Huang4a7835f2019-11-06 00:07:56 +08003461 changes |= LAYOUT_CHANGED;
3462 }
3463
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003464 if (!Arrays.equals(providesInsetsTypes, o.providesInsetsTypes)) {
3465 providesInsetsTypes = o.providesInsetsTypes;
3466 changes |= LAYOUT_CHANGED;
3467 }
3468
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 return changes;
3470 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003471
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 @Override
3473 public String debug(String output) {
3474 output += "Contents of " + this + ":";
3475 Log.d("Debug", output);
3476 output = super.debug("");
3477 Log.d("Debug", output);
3478 Log.d("Debug", "");
3479 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
3480 return "";
3481 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003483 @Override
3484 public String toString() {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003485 return toString("");
3486 }
3487
3488 /**
3489 * @hide
3490 */
Felipe Lemeda9ea342018-03-22 15:19:51 -07003491 public void dumpDimensions(StringBuilder sb) {
3492 sb.append('(');
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003493 sb.append(x);
3494 sb.append(',');
3495 sb.append(y);
3496 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08003497 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
3498 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08003500 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
3501 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003502 sb.append(")");
Felipe Lemeda9ea342018-03-22 15:19:51 -07003503 }
3504
3505 /**
3506 * @hide
3507 */
3508 public String toString(String prefix) {
3509 StringBuilder sb = new StringBuilder(256);
3510 sb.append('{');
3511 dumpDimensions(sb);
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003512 if (horizontalMargin != 0) {
3513 sb.append(" hm=");
3514 sb.append(horizontalMargin);
3515 }
3516 if (verticalMargin != 0) {
3517 sb.append(" vm=");
3518 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003519 }
3520 if (gravity != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003521 sb.append(" gr=");
3522 sb.append(Gravity.toString(gravity));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003524 if (softInputMode != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003525 sb.append(" sim={");
3526 sb.append(softInputModeToString(softInputMode));
3527 sb.append('}');
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003528 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003529 if (layoutInDisplayCutoutMode != 0) {
3530 sb.append(" layoutInDisplayCutoutMode=");
3531 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode));
3532 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003533 sb.append(" ty=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003534 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003535 if (format != PixelFormat.OPAQUE) {
3536 sb.append(" fmt=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003537 sb.append(PixelFormat.formatToString(format));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003538 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003539 if (windowAnimations != 0) {
3540 sb.append(" wanim=0x");
3541 sb.append(Integer.toHexString(windowAnimations));
3542 }
3543 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
3544 sb.append(" or=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003545 sb.append(ActivityInfo.screenOrientationToString(screenOrientation));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003547 if (alpha != 1.0f) {
3548 sb.append(" alpha=");
3549 sb.append(alpha);
3550 }
3551 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3552 sb.append(" sbrt=");
3553 sb.append(screenBrightness);
3554 }
3555 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3556 sb.append(" bbrt=");
3557 sb.append(buttonBrightness);
3558 }
Craig Mautner3c174372013-02-21 17:54:37 -08003559 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
3560 sb.append(" rotAnim=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003561 sb.append(rotationAnimationToString(rotationAnimation));
Craig Mautner3c174372013-02-21 17:54:37 -08003562 }
Michael Wright3f145a22014-07-22 19:46:03 -07003563 if (preferredRefreshRate != 0) {
3564 sb.append(" preferredRefreshRate=");
3565 sb.append(preferredRefreshRate);
3566 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003567 if (preferredDisplayModeId != 0) {
3568 sb.append(" preferredDisplayMode=");
3569 sb.append(preferredDisplayModeId);
3570 }
Joe Onorato664644d2011-01-23 17:53:23 -08003571 if (hasSystemUiListeners) {
3572 sb.append(" sysuil=");
3573 sb.append(hasSystemUiListeners);
3574 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003575 if (inputFeatures != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003576 sb.append(" if=").append(inputFeatureToString(inputFeatures));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003577 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003578 if (userActivityTimeout >= 0) {
3579 sb.append(" userActivityTimeout=").append(userActivityTimeout);
3580 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07003581 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07003582 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
3583 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07003584 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08003585 if (hasManualSurfaceInsets) {
3586 sb.append(" (manual)");
3587 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003588 if (!preservePreviousSurfaceInsets) {
3589 sb.append(" (!preservePreviousSurfaceInsets)");
3590 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07003591 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003592 if (mColorMode != COLOR_MODE_DEFAULT) {
3593 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode));
3594 }
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003595 if (preferMinimalPostProcessing) {
3596 sb.append(" preferMinimalPostProcessing=");
3597 sb.append(preferMinimalPostProcessing);
3598 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003599 sb.append(System.lineSeparator());
3600 sb.append(prefix).append(" fl=").append(
3601 ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
3602 if (privateFlags != 0) {
3603 sb.append(System.lineSeparator());
3604 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString(
3605 LayoutParams.class, "privateFlags", privateFlags));
3606 }
3607 if (systemUiVisibility != 0) {
3608 sb.append(System.lineSeparator());
3609 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString(
3610 View.class, "mSystemUiVisibility", systemUiVisibility));
3611 }
3612 if (subtreeSystemUiVisibility != 0) {
3613 sb.append(System.lineSeparator());
3614 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString(
3615 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility));
3616 }
Jorim Jaggib7848b72018-12-28 14:38:21 +01003617 if (insetsFlags.appearance != 0) {
3618 sb.append(System.lineSeparator());
3619 sb.append(prefix).append(" apr=").append(ViewDebug.flagsToString(
3620 InsetsFlags.class, "appearance", insetsFlags.appearance));
3621 }
3622 if (insetsFlags.behavior != 0) {
3623 sb.append(System.lineSeparator());
3624 sb.append(prefix).append(" bhv=").append(ViewDebug.flagsToString(
3625 InsetsFlags.class, "behavior", insetsFlags.behavior));
3626 }
Tiger Huang52724442020-01-20 21:38:42 +08003627 if (mFitInsetsTypes != 0) {
Tiger Huang4a7835f2019-11-06 00:07:56 +08003628 sb.append(System.lineSeparator());
3629 sb.append(prefix).append(" fitTypes=").append(ViewDebug.flagsToString(
Tiger Huang52724442020-01-20 21:38:42 +08003630 LayoutParams.class, "mFitInsetsTypes", mFitInsetsTypes));
Tiger Huang4a7835f2019-11-06 00:07:56 +08003631 }
Tiger Huang52724442020-01-20 21:38:42 +08003632 if (mFitInsetsSides != Side.all()) {
Tiger Huang4a7835f2019-11-06 00:07:56 +08003633 sb.append(System.lineSeparator());
3634 sb.append(prefix).append(" fitSides=").append(ViewDebug.flagsToString(
Tiger Huang52724442020-01-20 21:38:42 +08003635 LayoutParams.class, "mFitInsetsSides", mFitInsetsSides));
Tiger Huang4a7835f2019-11-06 00:07:56 +08003636 }
Tiger Huang52724442020-01-20 21:38:42 +08003637 if (mFitInsetsIgnoringVisibility) {
Tiger Huang4a7835f2019-11-06 00:07:56 +08003638 sb.append(System.lineSeparator());
3639 sb.append(prefix).append(" fitIgnoreVis");
3640 }
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003641 if (providesInsetsTypes != null) {
3642 sb.append(System.lineSeparator());
3643 sb.append(prefix).append(" insetsTypes=");
3644 for (int i = 0; i < providesInsetsTypes.length; ++i) {
3645 if (i > 0) sb.append(' ');
3646 sb.append(InsetsState.typeToString(providesInsetsTypes[i]));
3647 }
3648 }
Jorim Jaggib7848b72018-12-28 14:38:21 +01003649
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003650 sb.append('}');
3651 return sb.toString();
3652 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003653
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003654 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07003655 * @hide
3656 */
Jeffrey Huangcb782852019-12-05 11:28:11 -08003657 public void dumpDebug(ProtoOutputStream proto, long fieldId) {
Steven Timotiusaf03df62017-07-18 16:56:43 -07003658 final long token = proto.start(fieldId);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003659 proto.write(TYPE, type);
3660 proto.write(X, x);
3661 proto.write(Y, y);
3662 proto.write(WIDTH, width);
3663 proto.write(HEIGHT, height);
3664 proto.write(HORIZONTAL_MARGIN, horizontalMargin);
3665 proto.write(VERTICAL_MARGIN, verticalMargin);
3666 proto.write(GRAVITY, gravity);
3667 proto.write(SOFT_INPUT_MODE, softInputMode);
3668 proto.write(FORMAT, format);
3669 proto.write(WINDOW_ANIMATIONS, windowAnimations);
3670 proto.write(ALPHA, alpha);
3671 proto.write(SCREEN_BRIGHTNESS, screenBrightness);
3672 proto.write(BUTTON_BRIGHTNESS, buttonBrightness);
3673 proto.write(ROTATION_ANIMATION, rotationAnimation);
3674 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate);
3675 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId);
3676 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners);
3677 proto.write(INPUT_FEATURE_FLAGS, inputFeatures);
3678 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003679 proto.write(COLOR_MODE, mColorMode);
3680 proto.write(FLAGS, flags);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003681 proto.write(PRIVATE_FLAGS, privateFlags);
3682 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility);
3683 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility);
Jorim Jaggib7848b72018-12-28 14:38:21 +01003684 proto.write(APPEARANCE, insetsFlags.appearance);
3685 proto.write(BEHAVIOR, insetsFlags.behavior);
Tiger Huang52724442020-01-20 21:38:42 +08003686 proto.write(FIT_INSETS_TYPES, mFitInsetsTypes);
3687 proto.write(FIT_INSETS_SIDES, mFitInsetsSides);
3688 proto.write(FIT_IGNORE_VISIBILITY, mFitInsetsIgnoringVisibility);
Steven Timotiusaf03df62017-07-18 16:56:43 -07003689 proto.end(token);
3690 }
3691
3692 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003693 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003694 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003695 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003696 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003697 x = (int) (x * scale + 0.5f);
3698 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003699 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003700 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003701 }
3702 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003703 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003704 }
3705 }
3706
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003707 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003708 * Backup the layout parameters used in compatibility mode.
3709 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003710 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003711 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003712 void backup() {
3713 int[] backup = mCompatibilityParamsBackup;
3714 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003715 // we backup 4 elements, x, y, width, height
3716 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003717 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003718 backup[0] = x;
3719 backup[1] = y;
3720 backup[2] = width;
3721 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003722 }
3723
3724 /**
3725 * Restore the layout params' coordinates, size and gravity
3726 * @see LayoutParams#backup()
3727 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003728 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003729 void restore() {
3730 int[] backup = mCompatibilityParamsBackup;
3731 if (backup != null) {
3732 x = backup[0];
3733 y = backup[1];
3734 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003735 height = backup[3];
3736 }
3737 }
3738
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003739 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07003740
3741 /** @hide */
3742 @Override
3743 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
3744 super.encodeProperties(encoder);
3745
3746 encoder.addProperty("x", x);
3747 encoder.addProperty("y", y);
3748 encoder.addProperty("horizontalWeight", horizontalWeight);
3749 encoder.addProperty("verticalWeight", verticalWeight);
3750 encoder.addProperty("type", type);
3751 encoder.addProperty("flags", flags);
3752 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02003753
3754 /**
3755 * @hide
3756 * @return True if the layout parameters will cause the window to cover the full screen;
3757 * false otherwise.
3758 */
3759 public boolean isFullscreen() {
3760 return x == 0 && y == 0
3761 && width == WindowManager.LayoutParams.MATCH_PARENT
3762 && height == WindowManager.LayoutParams.MATCH_PARENT;
3763 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003764
Adrian Roosfa02da62018-01-15 16:01:18 +01003765 private static String layoutInDisplayCutoutModeToString(
3766 @LayoutInDisplayCutoutMode int mode) {
3767 switch (mode) {
3768 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT:
3769 return "default";
3770 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS:
3771 return "always";
3772 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER:
3773 return "never";
shawnlin465b7de2020-02-11 20:45:35 +08003774 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES:
3775 return "shortEdges";
Adrian Roosfa02da62018-01-15 16:01:18 +01003776 default:
3777 return "unknown(" + mode + ")";
3778 }
3779 }
3780
Jorim Jaggi484851b2017-09-22 16:03:27 +02003781 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) {
3782 final StringBuilder result = new StringBuilder();
3783 final int state = softInputMode & SOFT_INPUT_MASK_STATE;
3784 if (state != 0) {
3785 result.append("state=");
3786 switch (state) {
3787 case SOFT_INPUT_STATE_UNCHANGED:
3788 result.append("unchanged");
3789 break;
3790 case SOFT_INPUT_STATE_HIDDEN:
3791 result.append("hidden");
3792 break;
3793 case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
3794 result.append("always_hidden");
3795 break;
3796 case SOFT_INPUT_STATE_VISIBLE:
3797 result.append("visible");
3798 break;
3799 case SOFT_INPUT_STATE_ALWAYS_VISIBLE:
3800 result.append("always_visible");
3801 break;
3802 default:
3803 result.append(state);
3804 break;
3805 }
3806 result.append(' ');
3807 }
3808 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST;
3809 if (adjust != 0) {
3810 result.append("adjust=");
3811 switch (adjust) {
3812 case SOFT_INPUT_ADJUST_RESIZE:
3813 result.append("resize");
3814 break;
3815 case SOFT_INPUT_ADJUST_PAN:
3816 result.append("pan");
3817 break;
3818 case SOFT_INPUT_ADJUST_NOTHING:
3819 result.append("nothing");
3820 break;
3821 default:
3822 result.append(adjust);
3823 break;
3824 }
3825 result.append(' ');
3826 }
3827 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
3828 result.append("forwardNavigation").append(' ');
3829 }
3830 result.deleteCharAt(result.length() - 1);
3831 return result.toString();
3832 }
3833
3834 private static String rotationAnimationToString(int rotationAnimation) {
3835 switch (rotationAnimation) {
3836 case ROTATION_ANIMATION_UNSPECIFIED:
3837 return "UNSPECIFIED";
3838 case ROTATION_ANIMATION_ROTATE:
3839 return "ROTATE";
3840 case ROTATION_ANIMATION_CROSSFADE:
3841 return "CROSSFADE";
3842 case ROTATION_ANIMATION_JUMPCUT:
3843 return "JUMPCUT";
3844 case ROTATION_ANIMATION_SEAMLESS:
3845 return "SEAMLESS";
3846 default:
3847 return Integer.toString(rotationAnimation);
3848 }
3849 }
3850
3851 private static String inputFeatureToString(int inputFeature) {
3852 switch (inputFeature) {
3853 case INPUT_FEATURE_DISABLE_POINTER_GESTURES:
3854 return "DISABLE_POINTER_GESTURES";
3855 case INPUT_FEATURE_NO_INPUT_CHANNEL:
3856 return "NO_INPUT_CHANNEL";
3857 case INPUT_FEATURE_DISABLE_USER_ACTIVITY:
3858 return "DISABLE_USER_ACTIVITY";
3859 default:
3860 return Integer.toString(inputFeature);
3861 }
3862 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003863 }
3864}