blob: 76071278edf832fe3e3cce4799951137c4be8f34 [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 /**
Miranda Kephart7b2c3132020-03-27 09:54:14 -0400517 * Enum listing the possible sources from which a screenshot was originated. Used for logging.
518 *
Zak Cohenebd3b8b2020-01-17 11:16:00 -0800519 * @hide
520 */
Miranda Kephart7b2c3132020-03-27 09:54:14 -0400521 @IntDef({ScreenshotSource.SCREENSHOT_GLOBAL_ACTIONS,
522 ScreenshotSource.SCREENSHOT_KEY_CHORD,
523 ScreenshotSource.SCREENSHOT_KEY_OTHER,
524 ScreenshotSource.SCREENSHOT_OVERVIEW,
525 ScreenshotSource.SCREENSHOT_ACCESSIBILITY_ACTIONS,
526 ScreenshotSource.SCREENSHOT_OTHER})
527 @interface ScreenshotSource {
528 int SCREENSHOT_GLOBAL_ACTIONS = 0;
529 int SCREENSHOT_KEY_CHORD = 1;
530 int SCREENSHOT_KEY_OTHER = 2;
531 int SCREENSHOT_OVERVIEW = 3;
532 int SCREENSHOT_ACCESSIBILITY_ACTIONS = 4;
533 int SCREENSHOT_OTHER = 5;
534 }
Muyuan Li6ca619f2016-03-08 13:30:42 -0800535
536 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100537 * @hide
538 */
539 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
540
541 /**
542 * Request for keyboard shortcuts to be retrieved asynchronously.
543 *
544 * @param receiver The callback to be triggered when the result is ready.
545 *
546 * @hide
547 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000548 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100549
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400550 /**
551 * Return the touch region for the current IME window, or an empty region if there is none.
552 *
553 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
554 * region or there was an error.
555 *
556 * @hide
557 */
558 @SystemApi
559 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
560 public Region getCurrentImeTouchRegion();
561
Chilun8753ad32018-10-09 15:56:45 +0800562 /**
563 * Sets that the display should show its content when non-secure keyguard is shown.
564 *
565 * @param displayId Display ID.
566 * @param shouldShow Indicates that the display should show its content when non-secure keyguard
567 * is shown.
568 * @see KeyguardManager#isDeviceSecure()
569 * @see KeyguardManager#isDeviceLocked()
570 * @hide
571 */
572 @TestApi
573 default void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
574 }
575
576 /**
577 * Sets that the display should show system decors.
578 * <p>
579 * System decors include status bar, navigation bar, launcher.
580 * </p>
581 *
582 * @param displayId The id of the display.
583 * @param shouldShow Indicates that the display should show system decors.
Andrii Kuliandd989612019-02-21 12:13:28 -0800584 * @see #shouldShowSystemDecors(int)
Chilun8753ad32018-10-09 15:56:45 +0800585 * @hide
586 */
587 @TestApi
588 default void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
589 }
590
591 /**
Andrii Kuliandd989612019-02-21 12:13:28 -0800592 * Checks if the display supports showing system decors.
593 * <p>
594 * System decors include status bar, navigation bar, launcher.
595 * </p>
596 *
597 * @param displayId The id of the display.
598 * @see #setShouldShowSystemDecors(int, boolean)
599 * @hide
600 */
601 @TestApi
602 default boolean shouldShowSystemDecors(int displayId) {
603 return false;
604 }
605
606 /**
Chilun8753ad32018-10-09 15:56:45 +0800607 * Sets that the display should show IME.
608 *
609 * @param displayId Display ID.
610 * @param shouldShow Indicates that the display should show IME.
Chilun8753ad32018-10-09 15:56:45 +0800611 * @hide
612 */
613 @TestApi
614 default void setShouldShowIme(int displayId, boolean shouldShow) {
615 }
616
lumark9a72d222019-03-30 18:31:45 +0800617 /**
618 * Indicates that the display should show IME.
619 *
620 * @param displayId The id of the display.
621 * @return {@code true} if the display should show IME when an input field becomes
622 * focused on it.
623 * @hide
624 */
625 @TestApi
626 default boolean shouldShowIme(int displayId) {
627 return false;
628 }
629
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800630 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800631 /**
632 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700633 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
634 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800635 */
Romain Guy529b60a2010-08-03 18:05:47 -0700636 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700638
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 /**
640 * Y position for this window. With the default gravity it is ignored.
641 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
642 * an offset from the given edge.
643 */
Romain Guy529b60a2010-08-03 18:05:47 -0700644 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 public int y;
646
647 /**
648 * Indicates how much of the extra space will be allocated horizontally
649 * to the view associated with these LayoutParams. Specify 0 if the view
650 * should not be stretched. Otherwise the extra pixels will be pro-rated
651 * among all views whose weight is greater than 0.
652 */
Romain Guy529b60a2010-08-03 18:05:47 -0700653 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800654 public float horizontalWeight;
655
656 /**
657 * Indicates how much of the extra space will be allocated vertically
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 verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 /**
666 * The general type of window. There are three main classes of
667 * window types:
668 * <ul>
669 * <li> <strong>Application windows</strong> (ranging from
670 * {@link #FIRST_APPLICATION_WINDOW} to
671 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
672 * windows. For these types of windows, the {@link #token} must be
673 * set to the token of the activity they are a part of (this will
674 * normally be done for you if {@link #token} is null).
675 * <li> <strong>Sub-windows</strong> (ranging from
676 * {@link #FIRST_SUB_WINDOW} to
677 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
678 * window. For these types of windows, the {@link #token} must be
679 * the token of the window it is attached to.
680 * <li> <strong>System windows</strong> (ranging from
681 * {@link #FIRST_SYSTEM_WINDOW} to
682 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
683 * use by the system for specific purposes. They should not normally
684 * be used by applications, and a special permission is required
685 * to use them.
686 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700687 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 * @see #TYPE_BASE_APPLICATION
689 * @see #TYPE_APPLICATION
690 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700691 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 * @see #TYPE_APPLICATION_PANEL
693 * @see #TYPE_APPLICATION_MEDIA
694 * @see #TYPE_APPLICATION_SUB_PANEL
695 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
696 * @see #TYPE_STATUS_BAR
697 * @see #TYPE_SEARCH_BAR
698 * @see #TYPE_PHONE
699 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700 * @see #TYPE_TOAST
701 * @see #TYPE_SYSTEM_OVERLAY
702 * @see #TYPE_PRIORITY_PHONE
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 * @see #TYPE_SYSTEM_DIALOG
704 * @see #TYPE_KEYGUARD_DIALOG
705 * @see #TYPE_SYSTEM_ERROR
706 * @see #TYPE_INPUT_METHOD
707 * @see #TYPE_INPUT_METHOD_DIALOG
708 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700709 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700710 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200711 to = "BASE_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700712 @ViewDebug.IntToString(from = TYPE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200713 to = "APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700714 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200715 to = "APPLICATION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700716 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200717 to = "DRAWN_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700718 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200719 to = "APPLICATION_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700720 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200721 to = "APPLICATION_MEDIA"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700722 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200723 to = "APPLICATION_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700724 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200725 to = "APPLICATION_ABOVE_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700726 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200727 to = "APPLICATION_ATTACHED_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700728 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200729 to = "APPLICATION_MEDIA_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700730 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200731 to = "STATUS_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700732 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200733 to = "SEARCH_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700734 @ViewDebug.IntToString(from = TYPE_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200735 to = "PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700736 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200737 to = "SYSTEM_ALERT"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700738 @ViewDebug.IntToString(from = TYPE_TOAST,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200739 to = "TOAST"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700740 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200741 to = "SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700742 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200743 to = "PRIORITY_PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700744 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200745 to = "SYSTEM_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700746 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200747 to = "KEYGUARD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700748 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200749 to = "SYSTEM_ERROR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700750 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200751 to = "INPUT_METHOD"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700752 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200753 to = "INPUT_METHOD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700754 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200755 to = "WALLPAPER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700756 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200757 to = "STATUS_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700758 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200759 to = "SECURE_SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700760 @ViewDebug.IntToString(from = TYPE_DRAG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200761 to = "DRAG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700762 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200763 to = "STATUS_BAR_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700764 @ViewDebug.IntToString(from = TYPE_POINTER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200765 to = "POINTER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700766 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200767 to = "NAVIGATION_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700768 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200769 to = "VOLUME_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700770 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200771 to = "BOOT_PROGRESS"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700772 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200773 to = "INPUT_CONSUMER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700774 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200775 to = "NAVIGATION_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700776 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200777 to = "DISPLAY_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700778 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200779 to = "MAGNIFICATION_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700780 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200781 to = "PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700782 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200783 to = "PRIVATE_PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700784 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200785 to = "VOICE_INTERACTION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700786 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200787 to = "VOICE_INTERACTION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700788 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200789 to = "DOCK_DIVIDER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700790 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200791 to = "QS_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700792 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200793 to = "SCREENSHOT"),
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800794 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200795 to = "APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700796 })
Adrian Roos9c17e532020-03-11 16:00:50 +0100797 @WindowType
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800798 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700799
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800800 /**
801 * Start of window types that represent normal application windows.
802 */
803 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700804
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800805 /**
806 * Window type: an application window that serves as the "base" window
807 * of the overall application; all other application windows will
808 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700809 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 */
811 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700812
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800813 /**
814 * Window type: a normal application window. The {@link #token} must be
815 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700816 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800817 */
818 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700819
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800820 /**
821 * Window type: special application window that is displayed while the
822 * application is starting. Not for use by applications themselves;
823 * this is used by the system to display something until the
824 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700825 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 */
827 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700828
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700830 * Window type: a variation on TYPE_APPLICATION that ensures the window
831 * manager will wait for this window to be drawn before the app is shown.
832 * In multiuser systems shows only on the owning user's window.
833 */
834 public static final int TYPE_DRAWN_APPLICATION = 4;
835
836 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800837 * End of types of application windows.
838 */
839 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700840
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 /**
842 * Start of types of sub-windows. The {@link #token} of these windows
843 * must be set to the window they are attached to. These types of
844 * windows are kept next to their attached window in Z-order, and their
845 * coordinate space is relative to their attached window.
846 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700847 public static final int FIRST_SUB_WINDOW = 1000;
848
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 /**
850 * Window type: a panel on top of an application window. These windows
851 * appear on top of their attached window.
852 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700853 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800855 /**
John Spurlock33291d82013-03-13 14:45:14 -0400856 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 * are displayed behind their attached window.
858 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700859 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800861 /**
862 * Window type: a sub-panel on top of an application window. These
863 * windows are displayed on top their attached window and any
864 * {@link #TYPE_APPLICATION_PANEL} panels.
865 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700866 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867
868 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
869 * of the window happens as that of a top-level window, <em>not</em>
870 * as a child of its container.
871 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700872 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
873
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800874 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700875 * Window type: window for showing overlays on top of media windows.
876 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
877 * application window. They should be translucent to be useful. This
878 * is a big ugly hack so:
879 * @hide
880 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100881 @UnsupportedAppUsage
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700882 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
883
884 /**
885 * Window type: a above sub-panel on top of an application window and it's
886 * sub-panel windows. These windows are displayed on top of their attached window
887 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700888 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700889 */
890 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
891
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700892 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 * End of types of sub-windows.
894 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700895 public static final int LAST_SUB_WINDOW = 1999;
896
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800897 /**
898 * Start of system-specific window types. These are not normally
899 * created by applications.
900 */
901 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700902
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 /**
904 * Window type: the status bar. There can be only one status bar
905 * window; it is placed at the top of the screen, and all other
906 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700907 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 */
909 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700910
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800911 /**
912 * Window type: the search bar. There can be only one search bar
913 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700914 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800915 */
916 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700917
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800918 /**
919 * Window type: phone. These are non-application windows providing
920 * user interaction with the phone (in particular incoming calls).
921 * These windows are normally placed above all applications, but behind
922 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700923 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800924 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800926 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700928
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 /**
930 * Window type: system window, such as low power alert. These windows
931 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700932 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800933 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800935 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100937
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 /**
939 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700940 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200941 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 */
943 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100944
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 /**
946 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700947 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800948 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800950 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700952
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800953 /**
954 * Window type: system overlay windows, which need to be displayed
955 * on top of everything else. These windows must not take input
956 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700957 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800958 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800959 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800960 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800961 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700962
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800963 /**
964 * Window type: priority phone UI, which needs to be displayed even if
965 * the keyguard is active. These windows must not take input
966 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700967 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800968 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800970 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800971 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700972
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 /**
974 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700975 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800976 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700978
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 /**
980 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700981 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800982 */
983 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700984
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 /**
986 * Window type: internal system error windows, appear on top of
987 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700988 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800989 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800991 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700993
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 /**
995 * Window type: internal input methods windows, which appear above
996 * the normal UI. Application windows may be resized or panned to keep
997 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700998 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 */
1000 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
1001
1002 /**
1003 * Window type: internal input methods dialog windows, which appear above
1004 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -07001005 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001006 */
1007 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
1008
1009 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001010 * Window type: wallpaper window, placed behind any window that wants
1011 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -07001012 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001013 */
1014 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
1015
1016 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -08001017 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -07001018 * In multiuser systems shows on all users' windows.
Heemin Seog2cf45dd2020-02-24 15:43:29 -08001019 *
1020 * @deprecated This became API by accident and was never intended to be used for
1021 * applications.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -08001022 */
Heemin Seog2cf45dd2020-02-24 15:43:29 -08001023 @Deprecated
Dianne Hackbornbadc47e2009-11-08 17:37:07 -08001024 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -07001025
1026 /**
1027 * Window type: secure system overlay windows, which need to be displayed
1028 * on top of everything else. These windows must not take input
1029 * focus, or they will interfere with the keyguard.
1030 *
1031 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
1032 * system itself is allowed to create these overlays. Applications cannot
1033 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -07001034 *
1035 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -07001036 * @hide
1037 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001038 @UnsupportedAppUsage
Jeff Brown3b2b3542010-10-15 00:54:27 -07001039 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
1040
Dianne Hackbornbadc47e2009-11-08 17:37:07 -08001041 /**
Christopher Tatea53146c2010-09-07 11:57:52 -07001042 * Window type: the drag-and-drop pseudowindow. There is only one
1043 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -07001044 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -07001045 * @hide
1046 */
Jeff Brown3b2b3542010-10-15 00:54:27 -07001047 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -07001048
1049 /**
Robert Carr8360a782017-11-22 12:47:58 -08001050 * Window type: panel that slides out from over the status bar
1051 * In multiuser systems shows on all users' windows. These windows
1052 * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL}
1053 * windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -08001054 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -08001055 */
1056 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
1057
Jeff Brown83c09682010-12-23 17:50:18 -08001058 /**
1059 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -07001060 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -08001061 * @hide
1062 */
1063 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -08001064
1065 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -04001066 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -07001067 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -04001068 * @hide
1069 */
1070 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
1071
1072 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -07001073 * Window type: The volume level overlay/dialog shown when the user
1074 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -07001075 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -07001076 * @hide
1077 */
1078 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
1079
1080 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -07001081 * Window type: The boot progress dialog, goes on top of everything
1082 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -07001083 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -07001084 * @hide
1085 */
1086 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
1087
1088 /**
Selim Cinekf83e8242015-05-19 18:08:14 -07001089 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -07001090 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -07001091 * @hide
1092 */
Selim Cinekf83e8242015-05-19 18:08:14 -07001093 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -07001094
1095 /**
Jim Millere898ac52012-04-06 17:10:57 -07001096 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -07001097 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -07001098 * @hide
1099 */
1100 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
1101
1102 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -07001103 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -07001104 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -07001105 * @hide
1106 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001107 @UnsupportedAppUsage
Jeff Brownbd6e1502012-08-28 03:27:37 -07001108 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
1109
1110 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001111 * Window type: Magnification overlay window. Used to highlight the magnified
1112 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -07001113 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001114 * @hide
1115 */
1116 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
1117
1118 /**
keunyounga446bf02013-06-21 19:07:57 -07001119 * Window type: Window for Presentation on top of private
1120 * virtual display.
1121 */
1122 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
1123
1124 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -07001125 * Window type: Windows in the voice interaction layer.
1126 * @hide
1127 */
1128 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
1129
1130 /**
Phil Weaver40ded282016-01-25 15:49:02 -08001131 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -07001132 * android.accessibilityservice.AccessibilityService} for interception of
1133 * user interactions without changing the windows an accessibility service
1134 * can introspect. In particular, an accessibility service can introspect
1135 * only windows that a sighted user can interact with which is they can touch
1136 * these windows or can type into these windows. For example, if there
1137 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -08001138 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -07001139 * they are covered by a touchable window.
1140 */
1141 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
1142
1143 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -07001144 * Window type: Starting window for voice interaction layer.
1145 * @hide
1146 */
1147 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
1148
1149 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -07001150 * Window for displaying a handle used for resizing docked stacks. This window is owned
1151 * by the system process.
1152 * @hide
1153 */
1154 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
1155
1156 /**
Jason Monk8f7f3182015-11-18 16:35:14 -05001157 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
1158 * by Quick Settings Tiles.
1159 * @hide
1160 */
1161 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
1162
1163 /**
Galia Peycheva70b55712020-03-16 18:31:34 +01001164 * Window type: shows directly above the keyguard. The layer is
Matt Casey834c0f82020-05-13 14:01:41 -04001165 * reserved for screenshot animation, region selection and UI.
Galia Peycheva70b55712020-03-16 18:31:34 +01001166 * In multiuser systems shows only on the owning user's window.
Muyuan Li6ca619f2016-03-08 13:30:42 -08001167 * @hide
1168 */
1169 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
1170
1171 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -07001172 * Window type: Window for Presentation on an external display.
1173 * @see android.app.Presentation
1174 * @hide
1175 */
1176 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
1177
1178 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001179 * Window type: Application overlay windows are displayed above all activity windows
1180 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
1181 * but below critical system windows like the status bar or IME.
1182 * <p>
1183 * The system may change the position, size, or visibility of these windows at anytime
1184 * to reduce visual clutter to the user and also manage resources.
1185 * <p>
1186 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
1187 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -08001188 * The system will adjust the importance of processes with this window type to reduce the
1189 * chance of the low-memory-killer killing them.
1190 * <p>
1191 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001192 */
1193 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
1194
1195 /**
chaviw8065f442019-11-18 13:20:58 -08001196 * Window type: Window for adding accessibility window magnification above other windows.
1197 * This will place the window in the overlay windows.
1198 * @hide
1199 */
1200 public static final int TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 39;
1201
1202 /**
wilsonshihe8321942019-10-18 18:39:46 +08001203 * Window type: the notification shade and keyguard. There can be only one status bar
1204 * window; it is placed at the top of the screen, and all other
1205 * windows are shifted down so they are below it.
1206 * In multiuser systems shows on all users' windows.
1207 * @hide
1208 */
1209 public static final int TYPE_NOTIFICATION_SHADE = FIRST_SYSTEM_WINDOW + 40;
1210
1211 /**
Heemin Seog2cf45dd2020-02-24 15:43:29 -08001212 * Window type: used to show the status bar in non conventional parts of the screen (i.e.
1213 * the left or the bottom of the screen).
1214 * In multiuser systems shows on all users' windows.
1215 * @hide
1216 */
1217 public static final int TYPE_STATUS_BAR_ADDITIONAL = FIRST_SYSTEM_WINDOW + 41;
1218
1219 /**
Joshua Tsuji94d4c342020-05-04 14:00:24 -04001220 * Similar to TYPE_APPLICATION_OVERLAY, but trusted to overlay other windows since it is
1221 * is coming from the system.
1222 * @hide
1223 */
1224 // TODO(b/155781676): Remove and replace call points with trustedOverlay when that is ready.
1225 public static final int TYPE_TRUSTED_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 42;
1226
1227 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001228 * End of types of system windows.
1229 */
1230 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001232 /**
Albert Chaulke4338f82017-04-19 15:54:08 -04001233 * @hide
1234 * Used internally when there is no suitable type available.
1235 */
1236 public static final int INVALID_WINDOW_TYPE = -1;
1237
1238 /**
Adrian Roos9c17e532020-03-11 16:00:50 +01001239 * @hide
1240 */
1241 @IntDef(prefix = "TYPE_", value = {
1242 TYPE_ACCESSIBILITY_OVERLAY,
1243 TYPE_APPLICATION,
1244 TYPE_APPLICATION_ATTACHED_DIALOG,
1245 TYPE_APPLICATION_MEDIA,
1246 TYPE_APPLICATION_OVERLAY,
1247 TYPE_APPLICATION_PANEL,
1248 TYPE_APPLICATION_STARTING,
1249 TYPE_APPLICATION_SUB_PANEL,
1250 TYPE_BASE_APPLICATION,
1251 TYPE_DRAWN_APPLICATION,
1252 TYPE_INPUT_METHOD,
1253 TYPE_INPUT_METHOD_DIALOG,
1254 TYPE_KEYGUARD,
1255 TYPE_KEYGUARD_DIALOG,
1256 TYPE_PHONE,
1257 TYPE_PRIORITY_PHONE,
1258 TYPE_PRIVATE_PRESENTATION,
1259 TYPE_SEARCH_BAR,
1260 TYPE_STATUS_BAR,
1261 TYPE_STATUS_BAR_PANEL,
1262 TYPE_SYSTEM_ALERT,
1263 TYPE_SYSTEM_DIALOG,
1264 TYPE_SYSTEM_ERROR,
1265 TYPE_SYSTEM_OVERLAY,
1266 TYPE_TOAST,
1267 TYPE_WALLPAPER,
1268 })
1269 @Retention(RetentionPolicy.SOURCE)
1270 public @interface WindowType {}
1271
1272 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001273 * Return true if the window type is an alert window.
1274 *
1275 * @param type The window type.
1276 * @return If the window type is an alert window.
1277 * @hide
1278 */
Adrian Roos9c17e532020-03-11 16:00:50 +01001279 public static boolean isSystemAlertWindowType(@WindowType int type) {
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001280 switch (type) {
1281 case TYPE_PHONE:
1282 case TYPE_PRIORITY_PHONE:
1283 case TYPE_SYSTEM_ALERT:
1284 case TYPE_SYSTEM_ERROR:
1285 case TYPE_SYSTEM_OVERLAY:
1286 case TYPE_APPLICATION_OVERLAY:
1287 return true;
1288 }
1289 return false;
1290 }
1291
Mathias Agopiand2112302010-12-07 19:38:17 -08001292 /** @deprecated this is ignored, this value is set automatically when needed. */
1293 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -08001295 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001296 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001297 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -08001298 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001299 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001300 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -08001301 /** @deprecated this is ignored, this value is set automatically when needed. */
1302 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001303 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001304
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001305 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001306 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001308 @Deprecated
1309 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001310
Mike Lockwoodef731622010-01-27 17:51:34 -05001311 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001312 * the lock screen to activate while the screen is on.
1313 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -08001314 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -05001315 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
1316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001317 /** Window flag: everything behind this window will be dimmed.
1318 * Use {@link #dimAmount} to control the amount of dim. */
1319 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001320
1321 /** Window flag: blur everything behind this window.
1322 * @deprecated Blurring is no longer supported. */
1323 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001325
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001326 /** Window flag: this window won't ever get key input focus, so the
1327 * user can not send key or other button events to it. Those will
1328 * instead go to whatever focusable window is behind it. This flag
1329 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
1330 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001331 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 * <p>Setting this flag also implies that the window will not need to
1333 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001334 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 * independently of any active input method (typically this means it
1336 * gets Z-ordered on top of the input method, so it can use the full
Andrew Chant17c896e2019-12-05 22:39:02 +00001337 * screen for its content and cover the input method if needed. You
1338 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 /** Window flag: this window can never receive touch events. */
1342 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001343
John Spurlock33291d82013-03-13 14:45:14 -04001344 /** Window flag: even when this window is focusable (its
1345 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001346 * outside of the window to be sent to the windows behind it. Otherwise
1347 * it will consume all pointer events itself, regardless of whether they
1348 * are inside of the window. */
1349 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001350
John Spurlock33291d82013-03-13 14:45:14 -04001351 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001352 * screen is pressed, you will receive this first touch event. Usually
1353 * the first touch event is consumed by the system since the user can
1354 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -07001355 *
1356 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001358 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001361 /** Window flag: as long as this window is visible to the user, keep
1362 * the device's screen turned on and bright. */
1363 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001364
Tiger Huang52724442020-01-20 21:38:42 +08001365 /**
1366 * Window flag for attached windows: Place the window within the entire screen, ignoring
1367 * any constraints from the parent window.
Adrian Roosfa02da62018-01-15 16:01:18 +01001368 *
1369 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed
1370 * such that it avoids the {@link DisplayCutout} area if necessary according to the
1371 * {@link #layoutInDisplayCutoutMode}.
1372 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001374
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001375 /** Window flag: allow window to extend outside of the screen. */
1376 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001377
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001378 /**
John Spurlock33291d82013-03-13 14:45:14 -04001379 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 * this window is displayed. This allows the window to use the entire
1381 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -07001382 * an app window with this flag set is on the top layer. A fullscreen window
1383 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
1384 * {@link #softInputMode} field; the window will stay fullscreen
1385 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001386 *
1387 * <p>This flag can be controlled in your theme through the
1388 * {@link android.R.attr#windowFullscreen} attribute; this attribute
1389 * is automatically set for you in the standard fullscreen themes
1390 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
1391 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
1392 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
1393 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
1394 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
1395 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
1396 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
Tiger Huang52724442020-01-20 21:38:42 +08001397 *
1398 * @deprecated Use {@link WindowInsetsController#hide(int)} with {@link Type#statusBars()}
1399 * instead.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001400 */
Tiger Huang52724442020-01-20 21:38:42 +08001401 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001402 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001403
Tiger Huang52724442020-01-20 21:38:42 +08001404 /**
1405 * Window flag: override {@link #FLAG_FULLSCREEN} and force the
1406 * screen decorations (such as the status bar) to be shown.
1407 *
1408 * @deprecated This value became API "by accident", and shouldn't be used by 3rd party
1409 * applications.
1410 */
1411 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001413
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001414 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -07001415 * the screen.
1416 * @deprecated This flag is no longer used. */
1417 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001418 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001419
John Spurlock33291d82013-03-13 14:45:14 -04001420 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -07001421 * it from appearing in screenshots or from being viewed on non-secure
1422 * displays.
1423 *
1424 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
1425 * secure surfaces and secure displays.
1426 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001427 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001428
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001429 /** Window flag: a special mode where the layout parameters are used
1430 * to perform scaling of the surface when it is composited to the
1431 * screen. */
1432 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001433
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001434 /** Window flag: intended for windows that will often be used when the user is
1435 * holding the screen against their face, it will aggressively filter the event
1436 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001437 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001438 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001439 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001440 * until the finger is released. */
1441 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001442
Tiger Huang52724442020-01-20 21:38:42 +08001443 /**
1444 * Window flag: a special option only for use in combination with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001445 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
1446 * screen your window may appear on top of or behind screen decorations
1447 * such as the status bar. By also including this flag, the window
1448 * manager will report the inset rectangle needed to ensure your
1449 * content is not covered by screen decorations. This flag is normally
Tiger Huang52724442020-01-20 21:38:42 +08001450 * set for you by Window as described in {@link Window#setFlags}
1451 *
1452 * @deprecated Insets will always be delivered to your application.
1453 */
1454 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001455 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001456
Tarandeep Singhbcba88c2019-12-06 10:36:55 -08001457 /** Window flag: When set, input method can't interact with the focusable window
1458 * and can be placed to use more space and cover the input method.
1459 * Note: When combined with {@link #FLAG_NOT_FOCUSABLE}, this flag has no
1460 * effect since input method cannot interact with windows having {@link #FLAG_NOT_FOCUSABLE}
1461 * flag set.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001462 */
1463 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001464
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001465 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
1466 * can set this flag to receive a single special MotionEvent with
1467 * the action
1468 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
1469 * touches that occur outside of your window. Note that you will not
1470 * receive the full down/move/up gesture, only the location of the
1471 * first down as an ACTION_OUTSIDE.
1472 */
1473 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001474
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001475 /** Window flag: special flag to let windows be shown when the screen
1476 * is locked. This will let application windows take precedence over
1477 * key guard or any other lock screens. Can be used with
1478 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001479 * directly before showing the key guard window. Can be used with
1480 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
1481 * non-secure keyguards. This flag only applies to the top-most
1482 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -07001483 * @deprecated Use {@link android.R.attr#showWhenLocked} or
1484 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
1485 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001486 */
chaviw59b98852017-06-13 12:05:44 -07001487 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001488 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
1489
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001490 /** Window flag: ask that the system wallpaper be shown behind
1491 * your window. The window surface must be translucent to be able
1492 * to actually see the wallpaper behind it; this flag just ensures
1493 * that the wallpaper surface will be there if this window actually
1494 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001495 *
1496 * <p>This flag can be controlled in your theme through the
1497 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
1498 * is automatically set for you in the standard wallpaper themes
1499 * such as {@link android.R.style#Theme_Wallpaper},
1500 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
1501 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
1502 * {@link android.R.style#Theme_Holo_Wallpaper},
1503 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
1504 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
1505 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001506 */
1507 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001508
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001509 /** Window flag: when set as a window is being added or made
1510 * visible, once the window has been shown then the system will
1511 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -07001512 * up the device) to turn the screen on.
1513 * @deprecated Use {@link android.R.attr#turnScreenOn} or
1514 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
1515 * unintentional double life-cycle event.
1516 */
1517 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001518 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001519
Jeff Sharkey67f9d502017-08-05 13:49:13 -06001520 /**
1521 * Window flag: when set the window will cause the keyguard to be
1522 * dismissed, only if it is not a secure lock keyguard. Because such a
1523 * keyguard is not needed for security, it will never re-appear if the
1524 * user navigates to another window (in contrast to
1525 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1526 * secure and non-secure keyguards but ensure they reappear when the
1527 * user moves to another UI that doesn't hide them). If the keyguard is
1528 * currently active and is secure (requires an unlock credential) than
1529 * the user will still need to confirm it before seeing this window,
1530 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1531 *
1532 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1533 * {@link KeyguardManager#requestDismissKeyguard} instead.
1534 * Since keyguard was dismissed all the time as long as an
1535 * activity with this flag on its window was focused,
1536 * keyguard couldn't guard against unintentional touches on
1537 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001538 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001539 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001540 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001541
Jeff Brown01ce2e92010-09-26 22:20:12 -07001542 /** Window flag: when set the window will accept for touch events
1543 * outside of its bounds to be sent to other windows that also
1544 * support split touch. When this flag is not set, the first pointer
1545 * that goes down determines the window to which all subsequent touches
1546 * go until all pointers go up. When this flag is set, each pointer
1547 * (not necessarily the first) that goes down determines the window
1548 * to which all subsequent touches of that pointer will go until that
1549 * pointer goes up thereby enabling touches with multiple pointers
1550 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001551 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001552 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001553
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001554 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001555 * <p>Indicates whether this window should be hardware accelerated.
1556 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001557 *
Romain Guy72f0a272011-01-09 16:01:46 -08001558 * <p>This flag can be controlled programmatically <em>only</em> to enable
1559 * hardware acceleration. To enable hardware acceleration for a given
1560 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001561 *
Romain Guy72f0a272011-01-09 16:01:46 -08001562 * <pre>
1563 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1564 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1565 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1566 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001567 *
Romain Guy72f0a272011-01-09 16:01:46 -08001568 * <p>It is important to remember that this flag <strong>must</strong>
1569 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001570 *
Romain Guy72f0a272011-01-09 16:01:46 -08001571 * <p>This flag cannot be used to disable hardware acceleration after it
1572 * was enabled in your manifest using
1573 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1574 * and programmatically disable hardware acceleration (for automated testing
1575 * for instance), make sure it is turned off in your manifest and enable it
1576 * on your activity or dialog when you need it instead, using the method
1577 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001578 *
Romain Guy72f0a272011-01-09 16:01:46 -08001579 * <p>This flag is automatically set by the system if the
1580 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1581 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001582 */
1583 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001584
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001585 /**
1586 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001587 * overscan area, if there is one. The window should still correctly
1588 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001589 *
1590 * <p>This flag can be controlled in your theme through the
1591 * {@link android.R.attr#windowOverscan} attribute; this attribute
1592 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001593 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001594 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1595 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1596 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1597 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1598 *
1599 * <p>When this flag is enabled for a window, its normal content may be obscured
1600 * to some degree by the overscan region of the display. To ensure key parts of
1601 * that content are visible to the user, you can use
1602 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1603 * to set the point in the view hierarchy where the appropriate offsets should
1604 * be applied. (This can be done either by directly calling this function, using
1605 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1606 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1607 * View.fitSystemWindows(Rect)} method).</p>
1608 *
1609 * <p>This mechanism for positioning content elements is identical to its equivalent
1610 * use with layout and {@link View#setSystemUiVisibility(int)
1611 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1612 * position its UI elements with this overscan flag is set:</p>
1613 *
1614 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Jorim Jaggif081f062019-10-24 16:24:54 +02001615 *
Jorim Jaggi0fb8fb22020-03-04 17:00:22 +01001616 * @deprecated Overscan areas aren't set by any Android product anymore as of Android 11.
Dianne Hackbornc652de82013-02-15 16:32:56 -08001617 */
Jorim Jaggif081f062019-10-24 16:24:54 +02001618 @Deprecated
Dianne Hackbornc652de82013-02-15 16:32:56 -08001619 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1620
John Spurlockbd957402013-10-03 11:38:39 -04001621 /**
1622 * Window flag: request a translucent status bar with minimal system-provided
1623 * background protection.
1624 *
1625 * <p>This flag can be controlled in your theme through the
1626 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1627 * is automatically set for you in the standard translucent decor themes
1628 * such as
1629 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1630 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1631 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1632 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1633 *
1634 * <p>When this flag is enabled for a window, it automatically sets
1635 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1636 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001637 *
1638 * <p>Note: For devices that support
1639 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag may be ignored.
Tiger Huang52724442020-01-20 21:38:42 +08001640 *
1641 * @deprecated Use {@link Window#setStatusBarColor(int)} with a half-translucent color
1642 * instead.
John Spurlockbd957402013-10-03 11:38:39 -04001643 */
Tiger Huang52724442020-01-20 21:38:42 +08001644 @Deprecated
John Spurlockbd957402013-10-03 11:38:39 -04001645 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1646
1647 /**
1648 * Window flag: request a translucent navigation bar with minimal system-provided
1649 * background protection.
1650 *
1651 * <p>This flag can be controlled in your theme through the
1652 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1653 * is automatically set for you in the standard translucent decor themes
1654 * such as
1655 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1656 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1657 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1658 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1659 *
1660 * <p>When this flag is enabled for a window, it automatically sets
1661 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1662 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
Priyank Singhbb1dafb2019-07-16 14:25:53 -07001663 *
1664 * <p>Note: For devices that support
1665 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag can be disabled
1666 * by the car manufacturers.
Tiger Huang52724442020-01-20 21:38:42 +08001667 *
1668 * @deprecated Use {@link Window#setNavigationBarColor(int)} with a half-translucent color
1669 * instead.
John Spurlockbd957402013-10-03 11:38:39 -04001670 */
Tiger Huang52724442020-01-20 21:38:42 +08001671 @Deprecated
John Spurlockbd957402013-10-03 11:38:39 -04001672 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1673
Adam Lesinski6a591f52013-10-01 18:11:17 -07001674 /**
1675 * Flag for a window in local focus mode.
1676 * Window in local focus mode can control focus independent of window manager using
1677 * {@link Window#setLocalFocus(boolean, boolean)}.
1678 * Usually window in this mode will not get touch/key events from window manager, but will
1679 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1680 */
1681 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1682
Jeff Brown98db5fa2011-06-08 15:37:10 -07001683 /** Window flag: Enable touches to slide out of a window into neighboring
1684 * windows in mid-gesture instead of being captured for the duration of
1685 * the gesture.
1686 *
1687 * This flag changes the behavior of touch focus for this window only.
1688 * Touches can slide out of the window but they cannot necessarily slide
1689 * back in (unless the other window with touch focus permits it).
1690 *
1691 * {@hide}
1692 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001693 @UnsupportedAppUsage
Adam Lesinski6a591f52013-10-01 18:11:17 -07001694 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001695
Daniel Sandlere02d8082010-10-08 15:13:22 -04001696 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001697 * Window flag: When requesting layout with an attached window, the attached window may
1698 * overlap with the screen decorations of the parent window such as the navigation bar. By
1699 * including this flag, the window manager will layout the attached window within the decor
1700 * frame of the parent window such that it doesn't overlap with screen decorations.
Tiger Huang52724442020-01-20 21:38:42 +08001701 *
1702 * @deprecated Use {@link #setFitInsetsTypes(int)} to determine whether the attached
1703 * window will overlap with system bars.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001704 */
Tiger Huang52724442020-01-20 21:38:42 +08001705 @Deprecated
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001706 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001707
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001708 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001709 * Flag indicating that this Window is responsible for drawing the background for the
1710 * system bars. If set, the system bars are drawn with a transparent background and the
1711 * corresponding areas in this window are filled with the colors specified in
1712 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1713 */
1714 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1715
1716 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001717 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001718 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001719 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1720 * @see #FLAG_DIM_BEHIND
1721 * @see #FLAG_NOT_FOCUSABLE
1722 * @see #FLAG_NOT_TOUCHABLE
1723 * @see #FLAG_NOT_TOUCH_MODAL
1724 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1725 * @see #FLAG_KEEP_SCREEN_ON
1726 * @see #FLAG_LAYOUT_IN_SCREEN
1727 * @see #FLAG_LAYOUT_NO_LIMITS
1728 * @see #FLAG_FULLSCREEN
1729 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001730 * @see #FLAG_SECURE
1731 * @see #FLAG_SCALED
1732 * @see #FLAG_IGNORE_CHEEK_PRESSES
1733 * @see #FLAG_LAYOUT_INSET_DECOR
1734 * @see #FLAG_ALT_FOCUSABLE_IM
1735 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1736 * @see #FLAG_SHOW_WHEN_LOCKED
1737 * @see #FLAG_SHOW_WALLPAPER
1738 * @see #FLAG_TURN_SCREEN_ON
1739 * @see #FLAG_DISMISS_KEYGUARD
1740 * @see #FLAG_SPLIT_TOUCH
1741 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001742 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001743 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001744 */
1745 @ViewDebug.ExportedProperty(flagMapping = {
1746 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001747 name = "ALLOW_LOCK_WHILE_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001748 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001749 name = "DIM_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001750 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001751 name = "BLUR_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001752 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001753 name = "NOT_FOCUSABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001754 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001755 name = "NOT_TOUCHABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001756 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001757 name = "NOT_TOUCH_MODAL"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001758 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001759 name = "TOUCHABLE_WHEN_WAKING"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001760 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001761 name = "KEEP_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001762 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001763 name = "LAYOUT_IN_SCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001764 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001765 name = "LAYOUT_NO_LIMITS"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001766 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001767 name = "FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001768 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001769 name = "FORCE_NOT_FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001770 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001771 name = "DITHER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001772 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001773 name = "SECURE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001774 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001775 name = "SCALED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001776 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001777 name = "IGNORE_CHEEK_PRESSES"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001778 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001779 name = "LAYOUT_INSET_DECOR"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001780 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001781 name = "ALT_FOCUSABLE_IM"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001782 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001783 name = "WATCH_OUTSIDE_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001784 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001785 name = "SHOW_WHEN_LOCKED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001786 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001787 name = "SHOW_WALLPAPER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001788 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001789 name = "TURN_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001790 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001791 name = "DISMISS_KEYGUARD"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001792 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001793 name = "SPLIT_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001794 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001795 name = "HARDWARE_ACCELERATED"),
1796 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN,
1797 name = "LOCAL_FOCUS_MODE"),
John Spurlockbd957402013-10-03 11:38:39 -04001798 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001799 name = "TRANSLUCENT_STATUS"),
John Spurlockbd957402013-10-03 11:38:39 -04001800 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001801 name = "TRANSLUCENT_NAVIGATION"),
1802 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
1803 name = "LOCAL_FOCUS_MODE"),
1804 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY,
1805 name = "FLAG_SLIPPERY"),
1806 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR,
1807 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"),
Adrian Roos217ccd22014-05-09 14:29:04 +02001808 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001809 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001810 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001811 public int flags;
1812
1813 /**
John Reck61375a82014-09-18 19:27:48 +00001814 * If the window has requested hardware acceleration, but this is not
1815 * allowed in the process it is in, then still render it as if it is
1816 * hardware accelerated. This is used for the starting preview windows
1817 * in the system process, which don't need to have the overhead of
1818 * hardware acceleration (they are just a static rendering), but should
1819 * be rendered as such to match the actual window of the app even if it
1820 * is hardware accelerated.
1821 * Even if the window isn't hardware accelerated, still do its rendering
1822 * as if it was.
1823 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1824 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001825 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001826 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1827 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001828 *
John Reck61375a82014-09-18 19:27:48 +00001829 * @hide
1830 */
1831 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1832
1833 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001834 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001835 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001836 * If certain parts of the UI that really do want to use hardware
1837 * acceleration, this flag can be set to force it. This is basically
1838 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001839 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001840 * @hide
1841 */
1842 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1843
1844 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001845 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001846 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001847 * them (they do not affect the wallpaper scrolling operation) by calling
1848 * {@link
1849 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1850 *
1851 * @hide
1852 */
1853 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1854
Craig Mautner88400d32012-09-30 12:35:45 -07001855 /** In a multiuser system if this flag is set and the owner is a system process then this
1856 * window will appear on all user screens. This overrides the default behavior of window
1857 * types that normally only appear on the owning user's screen. Refer to each window type
1858 * to determine its default behavior.
1859 *
1860 * {@hide} */
Roshan Piusa3f89c62019-10-11 08:50:53 -07001861 @SystemApi
1862 @RequiresPermission(permission.INTERNAL_SYSTEM_WINDOW)
1863 public static final int SYSTEM_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
Craig Mautner88400d32012-09-30 12:35:45 -07001864
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001865 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001866 * Never animate position changes of the window.
1867 *
Robert Carrb48380a2017-04-04 14:56:37 -07001868 * {@hide}
1869 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00001870 @UnsupportedAppUsage
Robert Carrb48380a2017-04-04 14:56:37 -07001871 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001872 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1873
Adam Lesinski6a591f52013-10-01 18:11:17 -07001874 /** Window flag: special flag to limit the size of the window to be
1875 * original size ([320x480] x density). Used to create window for applications
1876 * running under compatibility mode.
1877 *
1878 * {@hide} */
1879 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1880
1881 /** Window flag: a special option intended for system dialogs. When
1882 * this flag is set, the window will demand focus unconditionally when
1883 * it is created.
1884 * {@hide} */
1885 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1886
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001887 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001888 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1889 *
1890 * {@hide}
1891 */
1892 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1893
1894 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001895 * 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 +08001896 * this flag is set it will be shown again.
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001897 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1898 *
1899 * {@hide}
1900 */
wilsonshihe8321942019-10-18 18:39:46 +08001901 public static final int PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR = 0x00001000;
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001902
1903 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001904 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001905 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001906 * because they are being managed externally through repositionChild.
1907 *
1908 * {@hide}
1909 */
1910 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1911
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001912 /**
1913 * Flag that will make window ignore app visibility and instead depend purely on the decor
1914 * view visibility for determining window visibility. This is used by recents to keep
1915 * drawing after it launches an app.
1916 * @hide
1917 */
1918 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1919
Robert Carra1eb4392015-12-10 12:43:51 -08001920 /**
1921 * Flag to indicate that this window is not expected to be replaced across
1922 * configuration change triggered activity relaunches. In general the WindowManager
1923 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1924 * until the replacement is ready to show in order to prevent visual glitch. However
1925 * some windows, such as PopupWindows expect to be cleared across configuration change,
1926 * and thus should hint to the WindowManager that it should not wait for a replacement.
1927 * @hide
1928 */
1929 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001930
1931 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001932 * Flag to indicate that this child window should always be laid-out in the parent
1933 * frame regardless of the current windowing mode configuration.
1934 * @hide
1935 */
1936 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1937
1938 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001939 * Flag to indicate that this window is always drawing the status bar background, no matter
1940 * what the other flags are.
1941 * @hide
1942 */
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001943 public static final int PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS = 0x00020000;
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001944
1945 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001946 * Flag to indicate that this window needs Sustained Performance Mode if
1947 * the device supports it.
1948 * @hide
1949 */
John Reck60e885f2016-04-21 15:40:45 -07001950 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001951
1952 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001953 * Flag to indicate that any window added by an application process that is of type
1954 * {@link #TYPE_TOAST} or that requires
1955 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1956 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001957 * @hide
1958 */
Philip P. Moltmannd66dd992018-09-17 11:26:04 -07001959 @SystemApi
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001960 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001961 public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001962
1963 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001964 * Indicates that this window is the rounded corners overlay present on some
1965 * devices this means that it will be excluded from: screenshots,
1966 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001967 * @hide
1968 */
Robert Carr132c9f52017-07-31 17:02:30 -07001969 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001970
1971 /**
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001972 * Flag to indicate that this window should be considered a screen decoration similar to the
1973 * nav bar and status bar. This will cause this window to affect the window insets reported
1974 * to other windows when it is visible.
1975 * @hide
1976 */
1977 @RequiresPermission(permission.STATUS_BAR_SERVICE)
1978 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
1979
1980 /**
Tiger Huanga90dea42018-08-03 17:20:17 +08001981 * Flag to indicate that the status bar window is in a state such that it forces showing
1982 * the navigation bar unless the navigation bar window is explicitly set to
1983 * {@link View#GONE}.
1984 * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}.
Tiger Huang34046012018-06-29 15:26:52 +08001985 * @hide
1986 */
Tiger Huanga90dea42018-08-03 17:20:17 +08001987 public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
Tiger Huang34046012018-06-29 15:26:52 +08001988
1989 /**
Peiyong Lin75045382019-03-04 19:22:33 -08001990 * Flag to indicate that the window is color space agnostic, and the color can be
1991 * interpreted to any color space.
1992 * @hide
1993 */
1994 public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000;
1995
1996 /**
Robert Carr48ec4e02019-07-16 14:28:47 -07001997 * Flag to request creation of a BLAST (Buffer as LayerState) Layer.
1998 * If not specified the client will receive a BufferQueue layer.
1999 * @hide
2000 */
2001 public static final int PRIVATE_FLAG_USE_BLAST = 0x02000000;
2002
2003 /**
Tiger Huang7238a052020-01-10 20:37:01 +08002004 * Flag to indicate that the window is controlling the appearance of system bars. So we
2005 * don't need to adjust it by reading its system UI flags for compatibility.
2006 * @hide
2007 */
2008 public static final int PRIVATE_FLAG_APPEARANCE_CONTROLLED = 0x04000000;
2009
2010 /**
2011 * Flag to indicate that the window is controlling the behavior of system bars. So we don't
2012 * need to adjust it by reading its window flags or system UI flags for compatibility.
2013 * @hide
2014 */
2015 public static final int PRIVATE_FLAG_BEHAVIOR_CONTROLLED = 0x08000000;
2016
2017 /**
Tiger Huang4a7835f2019-11-06 00:07:56 +08002018 * Flag to indicate that the window is controlling how it fits window insets on its own.
2019 * So we don't need to adjust its attributes for fitting window insets.
2020 * @hide
2021 */
Tiger Huang7238a052020-01-10 20:37:01 +08002022 public static final int PRIVATE_FLAG_FIT_INSETS_CONTROLLED = 0x10000000;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002023
2024 /**
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07002025 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2026 *
2027 * @hide
2028 */
2029 @SystemApi
2030 @Retention(RetentionPolicy.SOURCE)
2031 @IntDef(flag = true, prefix = { "SYSTEM_FLAG_" }, value = {
2032 SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Roshan Piusa3f89c62019-10-11 08:50:53 -07002033 SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07002034 })
2035 public @interface SystemFlags {}
2036
2037 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002038 * Control flags that are private to the platform.
2039 * @hide
2040 */
Artur Satayevf0b7d0b2019-11-04 11:16:45 +00002041 @UnsupportedAppUsage
Jorim Jaggi484851b2017-09-22 16:03:27 +02002042 @ViewDebug.ExportedProperty(flagMapping = {
2043 @ViewDebug.FlagToString(
2044 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
2045 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
2046 name = "FAKE_HARDWARE_ACCELERATED"),
2047 @ViewDebug.FlagToString(
2048 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
2049 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
2050 name = "FORCE_HARDWARE_ACCELERATED"),
2051 @ViewDebug.FlagToString(
2052 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
2053 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
2054 name = "WANTS_OFFSET_NOTIFICATIONS"),
2055 @ViewDebug.FlagToString(
Roshan Piusa3f89c62019-10-11 08:50:53 -07002056 mask = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
2057 equals = SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02002058 name = "SHOW_FOR_ALL_USERS"),
2059 @ViewDebug.FlagToString(
2060 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
2061 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
2062 name = "NO_MOVE_ANIMATION"),
2063 @ViewDebug.FlagToString(
2064 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
2065 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
2066 name = "COMPATIBLE_WINDOW"),
2067 @ViewDebug.FlagToString(
2068 mask = PRIVATE_FLAG_SYSTEM_ERROR,
2069 equals = PRIVATE_FLAG_SYSTEM_ERROR,
2070 name = "SYSTEM_ERROR"),
2071 @ViewDebug.FlagToString(
Jorim Jaggi484851b2017-09-22 16:03:27 +02002072 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
2073 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
2074 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"),
2075 @ViewDebug.FlagToString(
wilsonshihe8321942019-10-18 18:39:46 +08002076 mask = PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR,
2077 equals = PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR,
2078 name = "FORCE_STATUS_BAR_VISIBLE"),
Jorim Jaggi484851b2017-09-22 16:03:27 +02002079 @ViewDebug.FlagToString(
2080 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY,
2081 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY,
2082 name = "PRESERVE_GEOMETRY"),
2083 @ViewDebug.FlagToString(
2084 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
2085 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
2086 name = "FORCE_DECOR_VIEW_VISIBILITY"),
2087 @ViewDebug.FlagToString(
2088 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
2089 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
2090 name = "WILL_NOT_REPLACE_ON_RELAUNCH"),
2091 @ViewDebug.FlagToString(
2092 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
2093 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
2094 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
2095 @ViewDebug.FlagToString(
Jorim Jaggia6aabac2019-03-11 14:23:16 -07002096 mask = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
2097 equals = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02002098 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
2099 @ViewDebug.FlagToString(
2100 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
2101 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
2102 name = "SUSTAINED_PERFORMANCE_MODE"),
2103 @ViewDebug.FlagToString(
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07002104 mask = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
2105 equals = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02002106 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"),
2107 @ViewDebug.FlagToString(
2108 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
2109 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
2110 name = "IS_ROUNDED_CORNERS_OVERLAY"),
2111 @ViewDebug.FlagToString(
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07002112 mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
2113 equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
Tiger Huang34046012018-06-29 15:26:52 +08002114 name = "IS_SCREEN_DECOR"),
2115 @ViewDebug.FlagToString(
Tiger Huanga90dea42018-08-03 17:20:17 +08002116 mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
2117 equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
Peiyong Lin75045382019-03-04 19:22:33 -08002118 name = "STATUS_FORCE_SHOW_NAVIGATION"),
2119 @ViewDebug.FlagToString(
2120 mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
2121 equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
Tiger Huang4a7835f2019-11-06 00:07:56 +08002122 name = "COLOR_SPACE_AGNOSTIC"),
2123 @ViewDebug.FlagToString(
Tiger Huang7238a052020-01-10 20:37:01 +08002124 mask = PRIVATE_FLAG_APPEARANCE_CONTROLLED,
2125 equals = PRIVATE_FLAG_APPEARANCE_CONTROLLED,
2126 name = "APPEARANCE_CONTROLLED"),
2127 @ViewDebug.FlagToString(
2128 mask = PRIVATE_FLAG_BEHAVIOR_CONTROLLED,
2129 equals = PRIVATE_FLAG_BEHAVIOR_CONTROLLED,
2130 name = "BEHAVIOR_CONTROLLED"),
2131 @ViewDebug.FlagToString(
Tiger Huang4a7835f2019-11-06 00:07:56 +08002132 mask = PRIVATE_FLAG_FIT_INSETS_CONTROLLED,
2133 equals = PRIVATE_FLAG_FIT_INSETS_CONTROLLED,
Jorim Jaggi0da8fd12020-01-10 01:23:21 +01002134 name = "FIT_INSETS_CONTROLLED")
Jorim Jaggi484851b2017-09-22 16:03:27 +02002135 })
Robert Carrb48380a2017-04-04 14:56:37 -07002136 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002137 public int privateFlags;
2138
2139 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002140 * Given a particular set of window manager flags, determine whether
2141 * such a window may be a target for an input method when it has
2142 * focus. In particular, this checks the
2143 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
2144 * flags and returns true if the combination of the two corresponds
2145 * to a window that needs to be behind the input method so that the
2146 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002147 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002148 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002149 *
Tarandeep Singhbcba88c2019-12-06 10:36:55 -08002150 * @return Returns {@code true} if such a window should be behind/interact
2151 * with an input method, {@code false} if not.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 */
2153 public static boolean mayUseInputMethod(int flags) {
Tarandeep Singhbcba88c2019-12-06 10:36:55 -08002154 return (flags & FLAG_NOT_FOCUSABLE) != FLAG_NOT_FOCUSABLE
2155 && (flags & FLAG_ALT_FOCUSABLE_IM) != FLAG_ALT_FOCUSABLE_IM;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002156 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002157
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 /**
2159 * Mask for {@link #softInputMode} of the bits that determine the
2160 * desired visibility state of the soft input area for this window.
2161 */
2162 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002163
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002164 /**
Yohei Yukawaa7547852018-03-27 15:47:45 -07002165 * Visibility state for {@link #softInputMode}: no state has been specified. The system may
2166 * show or hide the software keyboard for better user experience when the window gains
2167 * focus.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002168 */
2169 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002171 /**
2172 * Visibility state for {@link #softInputMode}: please don't change the state of
2173 * the soft input area.
2174 */
2175 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002176
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002177 /**
2178 * Visibility state for {@link #softInputMode}: please hide any soft input
2179 * area when normally appropriate (when the user is navigating
2180 * forward to your window).
2181 */
2182 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002184 /**
2185 * Visibility state for {@link #softInputMode}: please always hide any
2186 * soft input area when this window receives focus.
2187 */
2188 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002190 /**
2191 * Visibility state for {@link #softInputMode}: please show the soft
2192 * input area when normally appropriate (when the user is navigating
2193 * forward to your window).
Yohei Yukawacf68d522017-12-12 09:33:26 -08002194 *
2195 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2196 * is ignored unless there is a focused view that returns {@code true} from
2197 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002198 */
2199 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201 /**
2202 * Visibility state for {@link #softInputMode}: please always make the
2203 * soft input area visible when this window receives input focus.
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_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002210
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002211 /**
2212 * Mask for {@link #softInputMode} of the bits that determine the
2213 * way that the window should be adjusted to accommodate the soft
2214 * input window.
2215 */
2216 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002217
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002218 /** Adjustment option for {@link #softInputMode}: nothing specified.
2219 * The system will try to pick one or
2220 * the other depending on the contents of the window.
2221 */
2222 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002223
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002224 /** Adjustment option for {@link #softInputMode}: set to allow the
2225 * window to be resized when an input
2226 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07002227 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002228 * {@link #SOFT_INPUT_ADJUST_PAN}; if
2229 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07002230 * the other depending on the contents of the window. If the window's
2231 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
2232 * value for {@link #softInputMode} will be ignored; the window will
2233 * not resize, but will stay fullscreen.
Tiger Huang52724442020-01-20 21:38:42 +08002234 *
Jorim Jaggi1f08f642020-01-29 13:11:46 +01002235 * @deprecated Call {@link Window#setDecorFitsSystemWindows(boolean)} with {@code false} and
2236 * install an {@link OnApplyWindowInsetsListener} on your root content view that fits insets
2237 * of type {@link Type#ime()}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002238 */
Tiger Huang52724442020-01-20 21:38:42 +08002239 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002240 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002242 /** Adjustment option for {@link #softInputMode}: set to have a window
2243 * pan when an input method is
2244 * shown, so it doesn't need to deal with resizing but just panned
2245 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07002246 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002247 * neither of these are set, then the system will try to pick one or
2248 * the other depending on the contents of the window.
2249 */
2250 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002251
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002252 /** Adjustment option for {@link #softInputMode}: set to have a window
2253 * not adjust for a shown input method. The window will not be resized,
2254 * and it will not be panned to make its focus visible.
2255 */
2256 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
2257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 /**
2259 * Bit for {@link #softInputMode}: set when the user has navigated
2260 * forward to the window. This is normally set automatically for
2261 * you by the system, though you may want to set it in certain cases
2262 * when you are displaying a window yourself. This flag will always
2263 * be cleared automatically after the window is displayed.
2264 */
2265 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002266
2267 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002268 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2269 *
2270 * @hide
2271 */
2272 @Retention(RetentionPolicy.SOURCE)
Jeff Sharkeyce8db992017-12-13 20:05:05 -07002273 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = {
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002274 SOFT_INPUT_STATE_UNSPECIFIED,
2275 SOFT_INPUT_STATE_UNCHANGED,
2276 SOFT_INPUT_STATE_HIDDEN,
2277 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
2278 SOFT_INPUT_STATE_VISIBLE,
2279 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
2280 SOFT_INPUT_ADJUST_UNSPECIFIED,
2281 SOFT_INPUT_ADJUST_RESIZE,
2282 SOFT_INPUT_ADJUST_PAN,
2283 SOFT_INPUT_ADJUST_NOTHING,
2284 SOFT_INPUT_IS_FORWARD_NAVIGATION,
2285 })
2286 public @interface SoftInputModeFlags {}
2287
2288 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08002289 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002291 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002292 * <ul>
2293 * <li> One of the visibility states
2294 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002295 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
2296 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002297 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002298 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
2299 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08002300 * </ul>
2301 *
2302 *
2303 * <p>This flag can be controlled in your theme through the
2304 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002305 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002306 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002309 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002310 * Placement of window within the screen as per {@link Gravity}. Both
2311 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2312 * android.graphics.Rect) Gravity.apply} and
2313 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2314 * Gravity.applyDisplay} are used during window layout, with this value
2315 * given as the desired gravity. For example you can specify
2316 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
2317 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
2318 * to control the behavior of
2319 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2320 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002321 *
2322 * @see Gravity
2323 */
2324 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002325
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002326 /**
2327 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002328 * between the container and the widget. See
2329 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2330 * android.graphics.Rect) Gravity.apply} for how this is used. This
2331 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 */
2333 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002335 /**
2336 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002337 * between the container and the widget. See
2338 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2339 * android.graphics.Rect) Gravity.apply} for how this is used. This
2340 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002341 */
2342 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002343
2344 /**
2345 * Positive insets between the drawing surface and window content.
2346 *
2347 * @hide
2348 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07002349 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08002350
2351 /**
2352 * Whether the surface insets have been manually set. When set to
2353 * {@code false}, the view root will automatically determine the
2354 * appropriate surface insets.
2355 *
2356 * @see #surfaceInsets
2357 * @hide
2358 */
2359 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002361 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07002362 * Whether the previous surface insets should be used vs. what is currently set. When set
2363 * to {@code true}, the view root will ignore surfaces insets in this object and use what
2364 * it currently has.
2365 *
2366 * @see #surfaceInsets
2367 * @hide
2368 */
2369 public boolean preservePreviousSurfaceInsets = true;
2370
2371 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002372 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08002373 * {@link android.graphics.PixelFormat}. The choice of format
2374 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002375 */
2376 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002377
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002378 /**
2379 * A style resource defining the animations to use for this window.
2380 * This must be a system resource; it can not be an application resource
2381 * because the window manager does not have access to applications.
2382 */
2383 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 /**
2386 * An alpha value to apply to this entire window.
2387 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
2388 */
2389 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002390
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002391 /**
2392 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
2393 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
2394 * dim.
2395 */
2396 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002397
2398 /**
2399 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
2400 * indicating that the brightness value is not overridden for this window
2401 * and normal brightness policy should be used.
2402 */
2403 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
2404
2405 /**
2406 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2407 * indicating that the screen or button backlight brightness should be set
2408 * to the lowest value when this window is in front.
2409 */
2410 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
2411
2412 /**
2413 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2414 * indicating that the screen or button backlight brightness should be set
2415 * to the hightest value when this window is in front.
2416 */
2417 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002418
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002419 /**
2420 * This can be used to override the user's preferred brightness of
2421 * the screen. A value of less than 0, the default, means to use the
2422 * preferred screen brightness. 0 to 1 adjusts the brightness from
2423 * dark to full bright.
2424 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002425 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002426
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002427 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002428 * This can be used to override the standard behavior of the button and
2429 * keyboard backlights. A value of less than 0, the default, means to
2430 * use the standard backlight behavior. 0 to 1 adjusts the brightness
2431 * from dark to full bright.
2432 */
2433 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
2434
2435 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07002436 * Unspecified value for {@link #rotationAnimation} indicating
2437 * a lack of preference.
2438 * @hide
2439 */
2440 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
2441
2442 /**
Robert Carr652aae42016-10-17 16:48:14 -07002443 * Value for {@link #rotationAnimation} which specifies that this
2444 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002445 */
2446 public static final int ROTATION_ANIMATION_ROTATE = 0;
2447
2448 /**
Robert Carr652aae42016-10-17 16:48:14 -07002449 * Value for {@link #rotationAnimation} which specifies that this
2450 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002451 */
2452 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
2453
2454 /**
Robert Carr652aae42016-10-17 16:48:14 -07002455 * Value for {@link #rotationAnimation} which specifies that this window
2456 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002457 */
2458 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
2459
2460 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07002461 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
2462 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07002463 * can't be applied without pausing the screen. For example, this is ideal
2464 * for Camera apps which don't want the viewfinder contents to ever rotate
2465 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
2466 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07002467 */
2468 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
2469
2470 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002471 * Define the exit and entry animations used on this window when the device is rotated.
2472 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08002473 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002474 * by other windows. All other situations default to the
2475 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002476 *
Craig Mautner3c174372013-02-21 17:54:37 -08002477 * @see #ROTATION_ANIMATION_ROTATE
2478 * @see #ROTATION_ANIMATION_CROSSFADE
2479 * @see #ROTATION_ANIMATION_JUMPCUT
2480 */
2481 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
2482
2483 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002484 * Identifier for this window. This will usually be filled in for
2485 * you.
2486 */
2487 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002488
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002489 /**
2490 * Name of the package owning this window.
2491 */
2492 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002493
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002494 /**
2495 * Specific orientation value for a window.
2496 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002497 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
2498 * If not set, a default value of
2499 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 * will be used.
2501 */
Vadim Caenfc14c662020-01-20 16:00:31 +01002502 @ActivityInfo.ScreenOrientation
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002503 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08002504
2505 /**
Michael Wright3f145a22014-07-22 19:46:03 -07002506 * The preferred refresh rate for the window.
2507 *
2508 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002509 * is on. The selected refresh rate will be applied to the display's default mode.
2510 *
2511 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07002512 *
2513 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002514 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07002515 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002516 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07002517 public float preferredRefreshRate;
2518
2519 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002520 * Id of the preferred display mode for the window.
2521 * <p>
2522 * This must be one of the supported modes obtained for the display(s) the window is on.
2523 * A value of {@code 0} means no preference.
2524 *
2525 * @see Display#getSupportedModes()
2526 * @see Display.Mode#getModeId()
2527 */
2528 public int preferredDisplayModeId;
2529
2530 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002531 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08002532 *
2533 * @see View#STATUS_BAR_VISIBLE
2534 * @see View#STATUS_BAR_HIDDEN
Tiger Huang52724442020-01-20 21:38:42 +08002535 *
2536 * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController}
2537 * instead.
Joe Onorato664644d2011-01-23 17:53:23 -08002538 */
Tiger Huang52724442020-01-20 21:38:42 +08002539 @Deprecated
Joe Onorato664644d2011-01-23 17:53:23 -08002540 public int systemUiVisibility;
2541
2542 /**
Joe Onorato14782f72011-01-25 19:53:17 -08002543 * @hide
2544 * The ui visibility as requested by the views in this hierarchy.
2545 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
2546 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002547 @UnsupportedAppUsage
Joe Onorato14782f72011-01-25 19:53:17 -08002548 public int subtreeSystemUiVisibility;
2549
2550 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002551 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002552 *
Joe Onorato664644d2011-01-23 17:53:23 -08002553 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
2554 *
2555 * @hide
2556 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002557 @UnsupportedAppUsage
Joe Onorato664644d2011-01-23 17:53:23 -08002558 public boolean hasSystemUiListeners;
2559
Adrian Roosfa02da62018-01-15 16:01:18 +01002560
2561 /** @hide */
2562 @Retention(RetentionPolicy.SOURCE)
2563 @IntDef(
2564 flag = true,
2565 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
Adrian Roos87526af2018-03-27 16:36:25 +02002566 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
shawnlind0e23be2019-12-29 18:56:15 +08002567 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER,
2568 LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS})
Adrian Roosfa02da62018-01-15 16:01:18 +01002569 @interface LayoutInDisplayCutoutMode {}
2570
2571 /**
2572 * Controls how the window is laid out if there is a {@link DisplayCutout}.
2573 *
2574 * <p>
2575 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}.
2576 *
2577 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
Adrian Roos87526af2018-03-27 16:36:25 +02002578 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Adrian Roosfa02da62018-01-15 16:01:18 +01002579 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
shawnlind0e23be2019-12-29 18:56:15 +08002580 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
Adrian Roosfa02da62018-01-15 16:01:18 +01002581 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002582 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2583 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002584 */
2585 @LayoutInDisplayCutoutMode
2586 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
2587
2588 /**
2589 * The window is allowed to extend into the {@link DisplayCutout} area, only if the
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002590 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is
Adrian Roosfa02da62018-01-15 16:01:18 +01002591 * laid out such that it does not overlap with the {@link DisplayCutout} area.
2592 *
2593 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002594 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or
2595 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait
2596 * if the cutout is at the top edge. Similarly for
2597 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen.
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002598 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the
Adrian Roosfa02da62018-01-15 16:01:18 +01002599 * cutout area.
2600 *
2601 * <p>
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002602 * The usual precautions for not overlapping with the status and navigation bar are
2603 * sufficient for ensuring that no important content overlaps with the DisplayCutout.
Adrian Roosfa02da62018-01-15 16:01:18 +01002604 *
2605 * @see DisplayCutout
2606 * @see WindowInsets
Adrian Roos87526af2018-03-27 16:36:25 +02002607 * @see #layoutInDisplayCutoutMode
2608 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2609 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002610 */
2611 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;
2612
2613 /**
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002614 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
2615 * edges of the screen.
2616 *
2617 * The window will never extend into a {@link DisplayCutout} area on the long edges of the
2618 * screen.
Adrian Roosfa02da62018-01-15 16:01:18 +01002619 *
2620 * <p>
2621 * The window must make sure that no important content overlaps with the
2622 * {@link DisplayCutout}.
2623 *
Adrian Roosad1da312018-03-27 19:17:50 +02002624 * <p>
2625 * In this mode, the window extends under cutouts on the short edge of the display in both
2626 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/>
2627 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png"
2628 * height="720"
2629 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in
2630 * portrait, no letterbox is applied."/>
2631 *
2632 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png"
2633 * width="720"
2634 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape,
2635 * no letterbox is applied."/>
2636 *
2637 * <p>
2638 * A cutout in the corner is considered to be on the short edge: <br/>
2639 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png"
2640 * height="720"
2641 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in
2642 * portrait, no letterbox is applied."/>
2643 *
2644 * <p>
2645 * On the other hand, should the cutout be on the long edge of the display, a letterbox will
2646 * be applied such that the window does not extend into the cutout on either long edge:
2647 * <br/>
2648 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png"
2649 * height="720"
2650 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait,
2651 * letterbox is applied."/>
2652 *
Adrian Roosfa02da62018-01-15 16:01:18 +01002653 * @see DisplayCutout
2654 * @see WindowInsets#getDisplayCutout()
Adrian Roos87526af2018-03-27 16:36:25 +02002655 * @see #layoutInDisplayCutoutMode
2656 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2657 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002658 */
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002659 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1;
Adrian Roosfa02da62018-01-15 16:01:18 +01002660
2661 /**
2662 * The window is never allowed to overlap with the DisplayCutout area.
2663 *
2664 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002665 * This should be used with windows that transiently set
2666 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION}
2667 * to avoid a relayout of the window when the respective flag is set or cleared.
Adrian Roosfa02da62018-01-15 16:01:18 +01002668 *
2669 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002670 * @see #layoutInDisplayCutoutMode
2671 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2672 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002673 */
2674 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;
2675
shawnlind0e23be2019-12-29 18:56:15 +08002676 /**
2677 * The window is always allowed to extend into the {@link DisplayCutout} areas on the all
2678 * edges of the screen.
2679 *
2680 * <p>
2681 * The window must make sure that no important content overlaps with the
2682 * {@link DisplayCutout}.
2683 *
2684 * <p>
2685 * In this mode, the window extends under cutouts on the all edges of the display in both
2686 * portrait and landscape, regardless of whether the window is hiding the system bars.
2687 *
2688 * @see DisplayCutout
2689 * @see WindowInsets#getDisplayCutout()
2690 * @see #layoutInDisplayCutoutMode
2691 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2692 * android:windowLayoutInDisplayCutoutMode
2693 */
2694 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 3;
Adrian Roosfa02da62018-01-15 16:01:18 +01002695
Jeff Brown474dcb52011-06-14 20:22:50 -07002696 /**
2697 * When this window has focus, disable touch pad pointer gesture processing.
2698 * The window will receive raw position updates from the touch pad instead
2699 * of pointer movements and synthetic touch events.
2700 *
2701 * @hide
2702 */
2703 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
2704
2705 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07002706 * Does not construct an input channel for this window. The channel will therefore
2707 * be incapable of receiving input.
2708 *
2709 * @hide
2710 */
2711 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
2712
2713 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002714 * When this window has focus, does not call user activity for all input events so
2715 * the application will have to do it itself. Should only be used by
2716 * the keyguard and phone app.
2717 * <p>
2718 * Should only be used by the keyguard and phone app.
2719 * </p>
2720 *
2721 * @hide
2722 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002723 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002724 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
2725
2726 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07002727 * Control special features of the input subsystem.
2728 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002729 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07002730 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002731 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07002732 * @hide
2733 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002734 @UnsupportedAppUsage
Jeff Brown474dcb52011-06-14 20:22:50 -07002735 public int inputFeatures;
2736
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002737 /**
2738 * Sets the number of milliseconds before the user activity timeout occurs
2739 * when this window has focus. A value of -1 uses the standard timeout.
2740 * A value of 0 uses the minimum support display timeout.
2741 * <p>
2742 * This property can only be used to reduce the user specified display timeout;
2743 * it can never make the timeout longer than it normally would be.
2744 * </p><p>
2745 * Should only be used by the keyguard and phone app.
2746 * </p>
2747 *
2748 * @hide
2749 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002750 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002751 public long userActivityTimeout = -1;
2752
Phil Weaver396d5492016-03-22 17:53:50 -07002753 /**
2754 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
2755 * window.
2756 *
2757 * @hide
2758 */
Phil Weaver8583ae82018-02-13 11:01:24 -08002759 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
Phil Weaver396d5492016-03-22 17:53:50 -07002760
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002761 /**
2762 * The window title isn't kept in sync with what is displayed in the title bar, so we
2763 * separately track the currently shown title to provide to accessibility.
2764 *
2765 * @hide
2766 */
Alan Viverette39259dd2017-05-25 11:10:46 -04002767 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002768 public CharSequence accessibilityTitle;
2769
Robert Carr70f0d222016-04-10 16:33:08 -07002770 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002771 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07002772 * by the window manager. Useful for transient notifications like toasts
2773 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002774 * is hidden. Must be specified at window creation time. Note that apps
2775 * are not prepared to handle their windows being removed without their
2776 * explicit request and may try to interact with the removed window
2777 * resulting in undefined behavior and crashes. Therefore, we do hide
2778 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07002779 *
2780 * @hide
2781 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002782 @UnsupportedAppUsage
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002783 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07002784
Romain Guy48327452017-01-23 17:03:35 -08002785 /**
Galia Peycheva056b3ee2019-06-26 14:05:12 +02002786 * Indicates whether this window wants the connected display to do minimal post processing
2787 * on the produced image or video frames. This will only be requested if the window is
2788 * visible on the screen.
2789 *
2790 * <p>This setting should be used when low latency has a higher priority than image
2791 * enhancement processing (e.g. for games or video conferencing).
2792 *
2793 * <p>If the Display sink is connected via HDMI, the device will begin to send infoframes
2794 * with Auto Low Latency Mode enabled and Game Content Type. This will switch the connected
2795 * display to a minimal image processing mode (if available), which reduces latency,
2796 * improving the user experience for gaming or video conferencing applications. For more
2797 * information, see HDMI 2.1 specification.
2798 *
2799 * <p>If the Display sink has an internal connection or uses some other protocol than HDMI,
2800 * effects may be similar but implementation-defined.
2801 *
2802 * <p>The ability to switch to a mode with minimal post proessing may be disabled by a user
2803 * setting in the system settings menu. In that case, this field is ignored and the display
2804 * will remain in its current mode.
2805 *
Galia Peychevabdd66e32020-02-27 19:16:28 +01002806 * @see android.content.pm.ActivityInfo#FLAG_PREFER_MINIMAL_POST_PROCESSING
Galia Peycheva056b3ee2019-06-26 14:05:12 +02002807 * @see android.view.Display#isMinimalPostProcessingSupported
2808 * @see android.view.Window#setPreferMinimalPostProcessing
2809 */
2810 public boolean preferMinimalPostProcessing = false;
2811
2812 /**
Romain Guy48327452017-01-23 17:03:35 -08002813 * The color mode requested by this window. The target display may
2814 * not be able to honor the request. When the color mode is not set
2815 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
2816 * pixel format specified in {@link #format}.
2817 *
2818 * @hide
2819 */
2820 @ActivityInfo.ColorMode
Jorim Jaggi484851b2017-09-22 16:03:27 +02002821 private int mColorMode = COLOR_MODE_DEFAULT;
Romain Guy48327452017-01-23 17:03:35 -08002822
Jorim Jaggib7848b72018-12-28 14:38:21 +01002823 /**
2824 * Carries the requests about {@link WindowInsetsController.Appearance} and
2825 * {@link WindowInsetsController.Behavior} to the system windows which can produce insets.
2826 *
2827 * @hide
2828 */
2829 public final InsetsFlags insetsFlags = new InsetsFlags();
2830
Tiger Huang4a7835f2019-11-06 00:07:56 +08002831 @ViewDebug.ExportedProperty(flagMapping = {
2832 @ViewDebug.FlagToString(
2833 mask = STATUS_BARS,
2834 equals = STATUS_BARS,
2835 name = "STATUS_BARS"),
2836 @ViewDebug.FlagToString(
2837 mask = NAVIGATION_BARS,
2838 equals = NAVIGATION_BARS,
2839 name = "NAVIGATION_BARS"),
2840 @ViewDebug.FlagToString(
2841 mask = CAPTION_BAR,
2842 equals = CAPTION_BAR,
2843 name = "CAPTION_BAR"),
2844 @ViewDebug.FlagToString(
2845 mask = IME,
2846 equals = IME,
2847 name = "IME"),
2848 @ViewDebug.FlagToString(
2849 mask = SYSTEM_GESTURES,
2850 equals = SYSTEM_GESTURES,
2851 name = "SYSTEM_GESTURES"),
2852 @ViewDebug.FlagToString(
2853 mask = MANDATORY_SYSTEM_GESTURES,
2854 equals = MANDATORY_SYSTEM_GESTURES,
2855 name = "MANDATORY_SYSTEM_GESTURES"),
2856 @ViewDebug.FlagToString(
2857 mask = TAPPABLE_ELEMENT,
2858 equals = TAPPABLE_ELEMENT,
2859 name = "TAPPABLE_ELEMENT"),
2860 @ViewDebug.FlagToString(
2861 mask = WINDOW_DECOR,
2862 equals = WINDOW_DECOR,
2863 name = "WINDOW_DECOR")
2864 })
Tiger Huang52724442020-01-20 21:38:42 +08002865 private @InsetsType int mFitInsetsTypes = Type.systemBars();
Tiger Huang4a7835f2019-11-06 00:07:56 +08002866
2867 @ViewDebug.ExportedProperty(flagMapping = {
2868 @ViewDebug.FlagToString(
2869 mask = LEFT,
2870 equals = LEFT,
2871 name = "LEFT"),
2872 @ViewDebug.FlagToString(
2873 mask = TOP,
2874 equals = TOP,
2875 name = "TOP"),
2876 @ViewDebug.FlagToString(
2877 mask = RIGHT,
2878 equals = RIGHT,
2879 name = "RIGHT"),
2880 @ViewDebug.FlagToString(
2881 mask = BOTTOM,
2882 equals = BOTTOM,
2883 name = "BOTTOM")
2884 })
Tiger Huang52724442020-01-20 21:38:42 +08002885 private @InsetsSide int mFitInsetsSides = Side.all();
Tiger Huang4a7835f2019-11-06 00:07:56 +08002886
Tiger Huang52724442020-01-20 21:38:42 +08002887 private boolean mFitInsetsIgnoringVisibility = false;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002888
2889 /**
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08002890 * {@link InsetsState.InternalInsetsType}s to be applied to the window
2891 * If {@link #type} has the predefined insets (like {@link #TYPE_STATUS_BAR} or
2892 * {@link #TYPE_NAVIGATION_BAR}), this field will be ignored.
2893 *
2894 * <p>Note: provide only one inset corresponding to the window type (like
2895 * {@link InsetsState.InternalInsetsType#ITYPE_STATUS_BAR} or
2896 * {@link InsetsState.InternalInsetsType#ITYPE_NAVIGATION_BAR})</p>
2897 * @hide
2898 */
2899 public @InsetsState.InternalInsetsType int[] providesInsetsTypes;
2900
2901 /**
Tiger Huang4a7835f2019-11-06 00:07:56 +08002902 * Specifies types of insets that this window should avoid overlapping during layout.
2903 *
2904 * @param types which types of insets that this window should avoid. The initial value of
2905 * this object includes all system bars.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002906 */
Tiger Huang52724442020-01-20 21:38:42 +08002907 public void setFitInsetsTypes(@InsetsType int types) {
2908 mFitInsetsTypes = types;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002909 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
2910 }
2911
2912 /**
2913 * Specifies sides of insets that this window should avoid overlapping during layout.
2914 *
2915 * @param sides which sides that this window should avoid overlapping with the types
2916 * specified. The initial value of this object includes all sides.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002917 */
Tiger Huang52724442020-01-20 21:38:42 +08002918 public void setFitInsetsSides(@InsetsSide int sides) {
2919 mFitInsetsSides = sides;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002920 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
2921 }
2922
2923 /**
2924 * Specifies if this window should fit the window insets no matter they are visible or not.
2925 *
2926 * @param ignore if true, this window will fit the given types even if they are not visible.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002927 */
Tiger Huang52724442020-01-20 21:38:42 +08002928 public void setFitInsetsIgnoringVisibility(boolean ignore) {
2929 mFitInsetsIgnoringVisibility = ignore;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002930 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
2931 }
2932
2933 /**
2934 * @return the insets types that this window is avoiding overlapping.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002935 */
Tiger Huang52724442020-01-20 21:38:42 +08002936 public @InsetsType int getFitInsetsTypes() {
2937 return mFitInsetsTypes;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002938 }
2939
2940 /**
2941 * @return the sides that this window is avoiding overlapping.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002942 */
Tiger Huang52724442020-01-20 21:38:42 +08002943 public @InsetsSide int getFitInsetsSides() {
2944 return mFitInsetsSides;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002945 }
2946
2947 /**
2948 * @return {@code true} if this window fits the window insets no matter they are visible or
2949 * not.
Tiger Huang4a7835f2019-11-06 00:07:56 +08002950 */
Tiger Huang52724442020-01-20 21:38:42 +08002951 public boolean isFitInsetsIgnoringVisibility() {
2952 return mFitInsetsIgnoringVisibility;
Tiger Huang4a7835f2019-11-06 00:07:56 +08002953 }
2954
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002955 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08002956 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002957 type = TYPE_APPLICATION;
2958 format = PixelFormat.OPAQUE;
2959 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002960
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08002962 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 type = _type;
2964 format = PixelFormat.OPAQUE;
2965 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002966
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002967 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08002968 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 type = _type;
2970 flags = _flags;
2971 format = PixelFormat.OPAQUE;
2972 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002973
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002974 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002975 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002976 type = _type;
2977 flags = _flags;
2978 format = _format;
2979 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002980
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002981 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2982 super(w, h);
2983 type = _type;
2984 flags = _flags;
2985 format = _format;
2986 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002988 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2989 int _flags, int _format) {
2990 super(w, h);
2991 x = xpos;
2992 y = ypos;
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 final void setTitle(CharSequence title) {
2999 if (null == title)
3000 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003001
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003002 mTitle = TextUtils.stringOrSpannedString(title);
3003 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003004
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003005 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003006 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08003008
Wale Ogunwale246c2092016-04-07 14:12:44 -07003009 /**
3010 * Sets the surface insets based on the elevation (visual z position) of the input view.
3011 * @hide
3012 */
3013 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
3014 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07003015 // Partial workaround for b/28318973. Every inset change causes a freeform window
3016 // to jump a little for a few frames. If we never allow surface insets to decrease,
3017 // they will stabilize quickly (often from the very beginning, as most windows start
3018 // as focused).
3019 // TODO(b/22668382) to fix this properly.
3020 if (surfaceInset == 0) {
3021 // OK to have 0 (this is the case for non-freeform windows).
3022 surfaceInsets.set(0, 0, 0, 0);
3023 } else {
3024 surfaceInsets.set(
3025 Math.max(surfaceInset, surfaceInsets.left),
3026 Math.max(surfaceInset, surfaceInsets.top),
3027 Math.max(surfaceInset, surfaceInsets.right),
3028 Math.max(surfaceInset, surfaceInsets.bottom));
3029 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003030 hasManualSurfaceInsets = manual;
3031 preservePreviousSurfaceInsets = preservePrevious;
3032 }
3033
Romain Guy48327452017-01-23 17:03:35 -08003034 /**
3035 * <p>Set the color mode of the window. Setting the color mode might
3036 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
3037 *
3038 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
3039 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
3040 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
3041 *
3042 * @see #getColorMode()
3043 */
3044 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
3045 mColorMode = colorMode;
3046 }
3047
3048 /**
3049 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
3050 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
3051 *
3052 * @see #setColorMode(int)
3053 */
3054 @ActivityInfo.ColorMode
3055 public int getColorMode() {
3056 return mColorMode;
3057 }
3058
Bryce Lee53b9fbd2015-02-06 12:06:34 -08003059 /** @hide */
3060 @SystemApi
3061 public final void setUserActivityTimeout(long timeout) {
3062 userActivityTimeout = timeout;
3063 }
3064
3065 /** @hide */
3066 @SystemApi
3067 public final long getUserActivityTimeout() {
3068 return userActivityTimeout;
3069 }
3070
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003071 public int describeContents() {
3072 return 0;
3073 }
3074
3075 public void writeToParcel(Parcel out, int parcelableFlags) {
3076 out.writeInt(width);
3077 out.writeInt(height);
3078 out.writeInt(x);
3079 out.writeInt(y);
3080 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003082 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 out.writeInt(softInputMode);
Adrian Roosfa02da62018-01-15 16:01:18 +01003084 out.writeInt(layoutInDisplayCutoutMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003085 out.writeInt(gravity);
3086 out.writeFloat(horizontalMargin);
3087 out.writeFloat(verticalMargin);
3088 out.writeInt(format);
3089 out.writeInt(windowAnimations);
3090 out.writeFloat(alpha);
3091 out.writeFloat(dimAmount);
3092 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003093 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08003094 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003095 out.writeStrongBinder(token);
3096 out.writeString(packageName);
3097 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
3098 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07003099 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003100 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08003101 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08003102 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08003103 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07003104 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003105 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07003106 out.writeInt(surfaceInsets.left);
3107 out.writeInt(surfaceInsets.top);
3108 out.writeInt(surfaceInsets.right);
3109 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08003110 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07003111 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Phil Weaver8583ae82018-02-13 11:01:24 -08003112 out.writeLong(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003113 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07003114 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003115 out.writeLong(hideTimeoutMilliseconds);
Jorim Jaggib7848b72018-12-28 14:38:21 +01003116 out.writeInt(insetsFlags.appearance);
3117 out.writeInt(insetsFlags.behavior);
Tiger Huang52724442020-01-20 21:38:42 +08003118 out.writeInt(mFitInsetsTypes);
3119 out.writeInt(mFitInsetsSides);
3120 out.writeBoolean(mFitInsetsIgnoringVisibility);
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003121 out.writeBoolean(preferMinimalPostProcessing);
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003122 if (providesInsetsTypes != null) {
3123 out.writeInt(providesInsetsTypes.length);
3124 out.writeIntArray(providesInsetsTypes);
3125 } else {
3126 out.writeInt(0);
3127 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003129
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07003130 public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 = new Parcelable.Creator<LayoutParams>() {
3132 public LayoutParams createFromParcel(Parcel in) {
3133 return new LayoutParams(in);
3134 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003135
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 public LayoutParams[] newArray(int size) {
3137 return new LayoutParams[size];
3138 }
3139 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003140
3141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003142 public LayoutParams(Parcel in) {
3143 width = in.readInt();
3144 height = in.readInt();
3145 x = in.readInt();
3146 y = in.readInt();
3147 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003149 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003150 softInputMode = in.readInt();
Adrian Roosfa02da62018-01-15 16:01:18 +01003151 layoutInDisplayCutoutMode = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 gravity = in.readInt();
3153 horizontalMargin = in.readFloat();
3154 verticalMargin = in.readFloat();
3155 format = in.readInt();
3156 windowAnimations = in.readInt();
3157 alpha = in.readFloat();
3158 dimAmount = in.readFloat();
3159 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003160 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08003161 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003162 token = in.readStrongBinder();
3163 packageName = in.readString();
3164 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
3165 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07003166 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003167 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08003168 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08003169 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08003170 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07003171 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003172 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07003173 surfaceInsets.left = in.readInt();
3174 surfaceInsets.top = in.readInt();
3175 surfaceInsets.right = in.readInt();
3176 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08003177 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07003178 preservePreviousSurfaceInsets = in.readInt() != 0;
Phil Weaver8583ae82018-02-13 11:01:24 -08003179 accessibilityIdOfAnchor = in.readLong();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003180 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07003181 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003182 hideTimeoutMilliseconds = in.readLong();
Jorim Jaggib7848b72018-12-28 14:38:21 +01003183 insetsFlags.appearance = in.readInt();
3184 insetsFlags.behavior = in.readInt();
Tiger Huang52724442020-01-20 21:38:42 +08003185 mFitInsetsTypes = in.readInt();
3186 mFitInsetsSides = in.readInt();
3187 mFitInsetsIgnoringVisibility = in.readBoolean();
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003188 preferMinimalPostProcessing = in.readBoolean();
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003189 int insetsTypesLength = in.readInt();
3190 if (insetsTypesLength > 0) {
3191 providesInsetsTypes = new int[insetsTypesLength];
3192 in.readIntArray(providesInsetsTypes);
3193 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003194 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003195
Romain Guy72998072009-06-22 11:09:20 -07003196 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003197 public static final int LAYOUT_CHANGED = 1<<0;
3198 public static final int TYPE_CHANGED = 1<<1;
3199 public static final int FLAGS_CHANGED = 1<<2;
3200 public static final int FORMAT_CHANGED = 1<<3;
3201 public static final int ANIMATION_CHANGED = 1<<4;
3202 public static final int DIM_AMOUNT_CHANGED = 1<<5;
3203 public static final int TITLE_CHANGED = 1<<6;
3204 public static final int ALPHA_CHANGED = 1<<7;
3205 public static final int MEMORY_TYPE_CHANGED = 1<<8;
3206 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
3207 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
3208 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08003209 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003210 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003211 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08003212 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003213 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08003214 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003215 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07003216 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003217 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003218 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003219 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07003220 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08003221 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003222 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04003223 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
3224 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07003225 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003226 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07003227 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
3228 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003229 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
3230 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07003231 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
3232 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04003233 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003234 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
3235 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07003236 public static final int COLOR_MODE_CHANGED = 1 << 26;
3237 /** {@hide} */
Jorim Jaggib7848b72018-12-28 14:38:21 +01003238 public static final int INSET_FLAGS_CHANGED = 1 << 27;
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003239 /** {@hide} */
3240 public static final int MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED = 1 << 28;
Romain Guyf21c9b02011-09-06 16:56:54 -07003241
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003242 // internal buffer to backup/restore parameters under compatibility mode.
3243 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 public final int copyFrom(LayoutParams o) {
3246 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003248 if (width != o.width) {
3249 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07003250 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 }
3252 if (height != o.height) {
3253 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07003254 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 }
3256 if (x != o.x) {
3257 x = o.x;
3258 changes |= LAYOUT_CHANGED;
3259 }
3260 if (y != o.y) {
3261 y = o.y;
3262 changes |= LAYOUT_CHANGED;
3263 }
3264 if (horizontalWeight != o.horizontalWeight) {
3265 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07003266 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003267 }
3268 if (verticalWeight != o.verticalWeight) {
3269 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07003270 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003271 }
3272 if (horizontalMargin != o.horizontalMargin) {
3273 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07003274 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003275 }
3276 if (verticalMargin != o.verticalMargin) {
3277 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07003278 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279 }
3280 if (type != o.type) {
3281 type = o.type;
3282 changes |= TYPE_CHANGED;
3283 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003284 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04003285 final int diff = flags ^ o.flags;
3286 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
3287 changes |= TRANSLUCENT_FLAGS_CHANGED;
3288 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003289 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07003290 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003291 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07003292 if (privateFlags != o.privateFlags) {
3293 privateFlags = o.privateFlags;
3294 changes |= PRIVATE_FLAGS_CHANGED;
3295 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 if (softInputMode != o.softInputMode) {
3297 softInputMode = o.softInputMode;
3298 changes |= SOFT_INPUT_MODE_CHANGED;
3299 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003300 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) {
3301 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode;
3302 changes |= LAYOUT_CHANGED;
3303 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003304 if (gravity != o.gravity) {
3305 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07003306 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003307 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003308 if (format != o.format) {
3309 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07003310 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 }
3312 if (windowAnimations != o.windowAnimations) {
3313 windowAnimations = o.windowAnimations;
3314 changes |= ANIMATION_CHANGED;
3315 }
3316 if (token == null) {
3317 // NOTE: token only copied if the recipient doesn't
3318 // already have one.
3319 token = o.token;
3320 }
3321 if (packageName == null) {
3322 // NOTE: packageName only copied if the recipient doesn't
3323 // already have one.
3324 packageName = o.packageName;
3325 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08003326 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003327 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003328 mTitle = o.mTitle;
3329 changes |= TITLE_CHANGED;
3330 }
3331 if (alpha != o.alpha) {
3332 alpha = o.alpha;
3333 changes |= ALPHA_CHANGED;
3334 }
3335 if (dimAmount != o.dimAmount) {
3336 dimAmount = o.dimAmount;
3337 changes |= DIM_AMOUNT_CHANGED;
3338 }
3339 if (screenBrightness != o.screenBrightness) {
3340 screenBrightness = o.screenBrightness;
3341 changes |= SCREEN_BRIGHTNESS_CHANGED;
3342 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05003343 if (buttonBrightness != o.buttonBrightness) {
3344 buttonBrightness = o.buttonBrightness;
3345 changes |= BUTTON_BRIGHTNESS_CHANGED;
3346 }
Craig Mautner3c174372013-02-21 17:54:37 -08003347 if (rotationAnimation != o.rotationAnimation) {
3348 rotationAnimation = o.rotationAnimation;
3349 changes |= ROTATION_ANIMATION_CHANGED;
3350 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003351
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003352 if (screenOrientation != o.screenOrientation) {
3353 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07003354 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003355 }
Romain Guy529b60a2010-08-03 18:05:47 -07003356
Michael Wright3f145a22014-07-22 19:46:03 -07003357 if (preferredRefreshRate != o.preferredRefreshRate) {
3358 preferredRefreshRate = o.preferredRefreshRate;
3359 changes |= PREFERRED_REFRESH_RATE_CHANGED;
3360 }
3361
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003362 if (preferredDisplayModeId != o.preferredDisplayModeId) {
3363 preferredDisplayModeId = o.preferredDisplayModeId;
3364 changes |= PREFERRED_DISPLAY_MODE_ID;
3365 }
3366
Joe Onorato14782f72011-01-25 19:53:17 -08003367 if (systemUiVisibility != o.systemUiVisibility
3368 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08003369 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08003370 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08003371 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
3372 }
3373
3374 if (hasSystemUiListeners != o.hasSystemUiListeners) {
3375 hasSystemUiListeners = o.hasSystemUiListeners;
3376 changes |= SYSTEM_UI_LISTENER_CHANGED;
3377 }
3378
Jeff Brown474dcb52011-06-14 20:22:50 -07003379 if (inputFeatures != o.inputFeatures) {
3380 inputFeatures = o.inputFeatures;
3381 changes |= INPUT_FEATURES_CHANGED;
3382 }
3383
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003384 if (userActivityTimeout != o.userActivityTimeout) {
3385 userActivityTimeout = o.userActivityTimeout;
3386 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
3387 }
3388
Alan Viverette49a22e82014-07-12 20:01:27 -07003389 if (!surfaceInsets.equals(o.surfaceInsets)) {
3390 surfaceInsets.set(o.surfaceInsets);
3391 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003392 }
3393
Alan Viverette5435a302015-01-29 10:25:34 -08003394 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
3395 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
3396 changes |= SURFACE_INSETS_CHANGED;
3397 }
3398
Wale Ogunwale246c2092016-04-07 14:12:44 -07003399 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
3400 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
3401 changes |= SURFACE_INSETS_CHANGED;
3402 }
3403
Phil Weaver396d5492016-03-22 17:53:50 -07003404 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
3405 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
3406 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
3407 }
3408
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003409 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
3410 && o.accessibilityTitle != null) {
3411 // NOTE: accessibilityTitle only copied if the originator set one.
3412 accessibilityTitle = o.accessibilityTitle;
3413 changes |= ACCESSIBILITY_TITLE_CHANGED;
3414 }
3415
Romain Guy26a2b972017-04-17 09:39:51 -07003416 if (mColorMode != o.mColorMode) {
3417 mColorMode = o.mColorMode;
3418 changes |= COLOR_MODE_CHANGED;
3419 }
3420
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003421 if (preferMinimalPostProcessing != o.preferMinimalPostProcessing) {
3422 preferMinimalPostProcessing = o.preferMinimalPostProcessing;
3423 changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED;
3424 }
3425
Robert Carr70f0d222016-04-10 16:33:08 -07003426 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003427 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07003428
Jorim Jaggib7848b72018-12-28 14:38:21 +01003429 if (insetsFlags.appearance != o.insetsFlags.appearance) {
3430 insetsFlags.appearance = o.insetsFlags.appearance;
3431 changes |= INSET_FLAGS_CHANGED;
3432 }
3433
3434 if (insetsFlags.behavior != o.insetsFlags.behavior) {
3435 insetsFlags.behavior = o.insetsFlags.behavior;
3436 changes |= INSET_FLAGS_CHANGED;
3437 }
3438
Tiger Huang52724442020-01-20 21:38:42 +08003439 if (mFitInsetsTypes != o.mFitInsetsTypes) {
3440 mFitInsetsTypes = o.mFitInsetsTypes;
Tiger Huang4a7835f2019-11-06 00:07:56 +08003441 changes |= LAYOUT_CHANGED;
3442 }
3443
Tiger Huang52724442020-01-20 21:38:42 +08003444 if (mFitInsetsSides != o.mFitInsetsSides) {
3445 mFitInsetsSides = o.mFitInsetsSides;
Tiger Huang4a7835f2019-11-06 00:07:56 +08003446 changes |= LAYOUT_CHANGED;
3447 }
3448
Tiger Huang52724442020-01-20 21:38:42 +08003449 if (mFitInsetsIgnoringVisibility != o.mFitInsetsIgnoringVisibility) {
3450 mFitInsetsIgnoringVisibility = o.mFitInsetsIgnoringVisibility;
Tiger Huang4a7835f2019-11-06 00:07:56 +08003451 changes |= LAYOUT_CHANGED;
3452 }
3453
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003454 if (!Arrays.equals(providesInsetsTypes, o.providesInsetsTypes)) {
3455 providesInsetsTypes = o.providesInsetsTypes;
3456 changes |= LAYOUT_CHANGED;
3457 }
3458
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003459 return changes;
3460 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003461
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003462 @Override
3463 public String debug(String output) {
3464 output += "Contents of " + this + ":";
3465 Log.d("Debug", output);
3466 output = super.debug("");
3467 Log.d("Debug", output);
3468 Log.d("Debug", "");
3469 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
3470 return "";
3471 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003472
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003473 @Override
3474 public String toString() {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003475 return toString("");
3476 }
3477
3478 /**
3479 * @hide
3480 */
Felipe Lemeda9ea342018-03-22 15:19:51 -07003481 public void dumpDimensions(StringBuilder sb) {
3482 sb.append('(');
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003483 sb.append(x);
3484 sb.append(',');
3485 sb.append(y);
3486 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08003487 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
3488 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003489 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08003490 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
3491 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 sb.append(")");
Felipe Lemeda9ea342018-03-22 15:19:51 -07003493 }
3494
3495 /**
3496 * @hide
3497 */
3498 public String toString(String prefix) {
3499 StringBuilder sb = new StringBuilder(256);
3500 sb.append('{');
3501 dumpDimensions(sb);
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003502 if (horizontalMargin != 0) {
3503 sb.append(" hm=");
3504 sb.append(horizontalMargin);
3505 }
3506 if (verticalMargin != 0) {
3507 sb.append(" vm=");
3508 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003509 }
3510 if (gravity != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003511 sb.append(" gr=");
3512 sb.append(Gravity.toString(gravity));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003513 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003514 if (softInputMode != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003515 sb.append(" sim={");
3516 sb.append(softInputModeToString(softInputMode));
3517 sb.append('}');
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003518 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003519 if (layoutInDisplayCutoutMode != 0) {
3520 sb.append(" layoutInDisplayCutoutMode=");
3521 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode));
3522 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 sb.append(" ty=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003524 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003525 if (format != PixelFormat.OPAQUE) {
3526 sb.append(" fmt=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003527 sb.append(PixelFormat.formatToString(format));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003528 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003529 if (windowAnimations != 0) {
3530 sb.append(" wanim=0x");
3531 sb.append(Integer.toHexString(windowAnimations));
3532 }
3533 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
3534 sb.append(" or=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003535 sb.append(ActivityInfo.screenOrientationToString(screenOrientation));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003536 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003537 if (alpha != 1.0f) {
3538 sb.append(" alpha=");
3539 sb.append(alpha);
3540 }
3541 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3542 sb.append(" sbrt=");
3543 sb.append(screenBrightness);
3544 }
3545 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3546 sb.append(" bbrt=");
3547 sb.append(buttonBrightness);
3548 }
Craig Mautner3c174372013-02-21 17:54:37 -08003549 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
3550 sb.append(" rotAnim=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003551 sb.append(rotationAnimationToString(rotationAnimation));
Craig Mautner3c174372013-02-21 17:54:37 -08003552 }
Michael Wright3f145a22014-07-22 19:46:03 -07003553 if (preferredRefreshRate != 0) {
3554 sb.append(" preferredRefreshRate=");
3555 sb.append(preferredRefreshRate);
3556 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003557 if (preferredDisplayModeId != 0) {
3558 sb.append(" preferredDisplayMode=");
3559 sb.append(preferredDisplayModeId);
3560 }
Joe Onorato664644d2011-01-23 17:53:23 -08003561 if (hasSystemUiListeners) {
3562 sb.append(" sysuil=");
3563 sb.append(hasSystemUiListeners);
3564 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003565 if (inputFeatures != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003566 sb.append(" if=").append(inputFeatureToString(inputFeatures));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003567 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003568 if (userActivityTimeout >= 0) {
3569 sb.append(" userActivityTimeout=").append(userActivityTimeout);
3570 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07003571 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07003572 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
3573 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07003574 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08003575 if (hasManualSurfaceInsets) {
3576 sb.append(" (manual)");
3577 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003578 if (!preservePreviousSurfaceInsets) {
3579 sb.append(" (!preservePreviousSurfaceInsets)");
3580 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07003581 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003582 if (mColorMode != COLOR_MODE_DEFAULT) {
3583 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode));
3584 }
Galia Peycheva056b3ee2019-06-26 14:05:12 +02003585 if (preferMinimalPostProcessing) {
3586 sb.append(" preferMinimalPostProcessing=");
3587 sb.append(preferMinimalPostProcessing);
3588 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003589 sb.append(System.lineSeparator());
3590 sb.append(prefix).append(" fl=").append(
3591 ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
3592 if (privateFlags != 0) {
3593 sb.append(System.lineSeparator());
3594 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString(
3595 LayoutParams.class, "privateFlags", privateFlags));
3596 }
3597 if (systemUiVisibility != 0) {
3598 sb.append(System.lineSeparator());
3599 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString(
3600 View.class, "mSystemUiVisibility", systemUiVisibility));
3601 }
3602 if (subtreeSystemUiVisibility != 0) {
3603 sb.append(System.lineSeparator());
3604 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString(
3605 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility));
3606 }
Jorim Jaggib7848b72018-12-28 14:38:21 +01003607 if (insetsFlags.appearance != 0) {
3608 sb.append(System.lineSeparator());
3609 sb.append(prefix).append(" apr=").append(ViewDebug.flagsToString(
3610 InsetsFlags.class, "appearance", insetsFlags.appearance));
3611 }
3612 if (insetsFlags.behavior != 0) {
3613 sb.append(System.lineSeparator());
3614 sb.append(prefix).append(" bhv=").append(ViewDebug.flagsToString(
3615 InsetsFlags.class, "behavior", insetsFlags.behavior));
3616 }
Tiger Huang52724442020-01-20 21:38:42 +08003617 if (mFitInsetsTypes != 0) {
Tiger Huang4a7835f2019-11-06 00:07:56 +08003618 sb.append(System.lineSeparator());
3619 sb.append(prefix).append(" fitTypes=").append(ViewDebug.flagsToString(
Tiger Huang52724442020-01-20 21:38:42 +08003620 LayoutParams.class, "mFitInsetsTypes", mFitInsetsTypes));
Tiger Huang4a7835f2019-11-06 00:07:56 +08003621 }
Tiger Huang52724442020-01-20 21:38:42 +08003622 if (mFitInsetsSides != Side.all()) {
Tiger Huang4a7835f2019-11-06 00:07:56 +08003623 sb.append(System.lineSeparator());
3624 sb.append(prefix).append(" fitSides=").append(ViewDebug.flagsToString(
Tiger Huang52724442020-01-20 21:38:42 +08003625 LayoutParams.class, "mFitInsetsSides", mFitInsetsSides));
Tiger Huang4a7835f2019-11-06 00:07:56 +08003626 }
Tiger Huang52724442020-01-20 21:38:42 +08003627 if (mFitInsetsIgnoringVisibility) {
Tiger Huang4a7835f2019-11-06 00:07:56 +08003628 sb.append(System.lineSeparator());
3629 sb.append(prefix).append(" fitIgnoreVis");
3630 }
Yuncheol Heo13a6eb62020-03-04 23:50:37 -08003631 if (providesInsetsTypes != null) {
3632 sb.append(System.lineSeparator());
3633 sb.append(prefix).append(" insetsTypes=");
3634 for (int i = 0; i < providesInsetsTypes.length; ++i) {
3635 if (i > 0) sb.append(' ');
3636 sb.append(InsetsState.typeToString(providesInsetsTypes[i]));
3637 }
3638 }
Jorim Jaggib7848b72018-12-28 14:38:21 +01003639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003640 sb.append('}');
3641 return sb.toString();
3642 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003643
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003644 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07003645 * @hide
3646 */
Jeffrey Huangcb782852019-12-05 11:28:11 -08003647 public void dumpDebug(ProtoOutputStream proto, long fieldId) {
Steven Timotiusaf03df62017-07-18 16:56:43 -07003648 final long token = proto.start(fieldId);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003649 proto.write(TYPE, type);
3650 proto.write(X, x);
3651 proto.write(Y, y);
3652 proto.write(WIDTH, width);
3653 proto.write(HEIGHT, height);
3654 proto.write(HORIZONTAL_MARGIN, horizontalMargin);
3655 proto.write(VERTICAL_MARGIN, verticalMargin);
3656 proto.write(GRAVITY, gravity);
3657 proto.write(SOFT_INPUT_MODE, softInputMode);
3658 proto.write(FORMAT, format);
3659 proto.write(WINDOW_ANIMATIONS, windowAnimations);
3660 proto.write(ALPHA, alpha);
3661 proto.write(SCREEN_BRIGHTNESS, screenBrightness);
3662 proto.write(BUTTON_BRIGHTNESS, buttonBrightness);
3663 proto.write(ROTATION_ANIMATION, rotationAnimation);
3664 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate);
3665 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId);
3666 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners);
3667 proto.write(INPUT_FEATURE_FLAGS, inputFeatures);
3668 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003669 proto.write(COLOR_MODE, mColorMode);
3670 proto.write(FLAGS, flags);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003671 proto.write(PRIVATE_FLAGS, privateFlags);
3672 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility);
3673 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility);
Jorim Jaggib7848b72018-12-28 14:38:21 +01003674 proto.write(APPEARANCE, insetsFlags.appearance);
3675 proto.write(BEHAVIOR, insetsFlags.behavior);
Tiger Huang52724442020-01-20 21:38:42 +08003676 proto.write(FIT_INSETS_TYPES, mFitInsetsTypes);
3677 proto.write(FIT_INSETS_SIDES, mFitInsetsSides);
3678 proto.write(FIT_IGNORE_VISIBILITY, mFitInsetsIgnoringVisibility);
Steven Timotiusaf03df62017-07-18 16:56:43 -07003679 proto.end(token);
3680 }
3681
3682 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003683 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003684 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003685 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003686 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003687 x = (int) (x * scale + 0.5f);
3688 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003689 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003690 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003691 }
3692 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003693 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003694 }
3695 }
3696
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003697 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003698 * Backup the layout parameters used in compatibility mode.
3699 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003700 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003701 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003702 void backup() {
3703 int[] backup = mCompatibilityParamsBackup;
3704 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003705 // we backup 4 elements, x, y, width, height
3706 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003707 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003708 backup[0] = x;
3709 backup[1] = y;
3710 backup[2] = width;
3711 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003712 }
3713
3714 /**
3715 * Restore the layout params' coordinates, size and gravity
3716 * @see LayoutParams#backup()
3717 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003718 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003719 void restore() {
3720 int[] backup = mCompatibilityParamsBackup;
3721 if (backup != null) {
3722 x = backup[0];
3723 y = backup[1];
3724 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003725 height = backup[3];
3726 }
3727 }
3728
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003729 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07003730
3731 /** @hide */
3732 @Override
3733 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
3734 super.encodeProperties(encoder);
3735
3736 encoder.addProperty("x", x);
3737 encoder.addProperty("y", y);
3738 encoder.addProperty("horizontalWeight", horizontalWeight);
3739 encoder.addProperty("verticalWeight", verticalWeight);
3740 encoder.addProperty("type", type);
3741 encoder.addProperty("flags", flags);
3742 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02003743
3744 /**
3745 * @hide
3746 * @return True if the layout parameters will cause the window to cover the full screen;
3747 * false otherwise.
3748 */
3749 public boolean isFullscreen() {
3750 return x == 0 && y == 0
3751 && width == WindowManager.LayoutParams.MATCH_PARENT
3752 && height == WindowManager.LayoutParams.MATCH_PARENT;
3753 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003754
Adrian Roosfa02da62018-01-15 16:01:18 +01003755 private static String layoutInDisplayCutoutModeToString(
3756 @LayoutInDisplayCutoutMode int mode) {
3757 switch (mode) {
3758 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT:
3759 return "default";
3760 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS:
3761 return "always";
3762 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER:
3763 return "never";
shawnlin465b7de2020-02-11 20:45:35 +08003764 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES:
3765 return "shortEdges";
Adrian Roosfa02da62018-01-15 16:01:18 +01003766 default:
3767 return "unknown(" + mode + ")";
3768 }
3769 }
3770
Jorim Jaggi484851b2017-09-22 16:03:27 +02003771 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) {
3772 final StringBuilder result = new StringBuilder();
3773 final int state = softInputMode & SOFT_INPUT_MASK_STATE;
3774 if (state != 0) {
3775 result.append("state=");
3776 switch (state) {
3777 case SOFT_INPUT_STATE_UNCHANGED:
3778 result.append("unchanged");
3779 break;
3780 case SOFT_INPUT_STATE_HIDDEN:
3781 result.append("hidden");
3782 break;
3783 case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
3784 result.append("always_hidden");
3785 break;
3786 case SOFT_INPUT_STATE_VISIBLE:
3787 result.append("visible");
3788 break;
3789 case SOFT_INPUT_STATE_ALWAYS_VISIBLE:
3790 result.append("always_visible");
3791 break;
3792 default:
3793 result.append(state);
3794 break;
3795 }
3796 result.append(' ');
3797 }
3798 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST;
3799 if (adjust != 0) {
3800 result.append("adjust=");
3801 switch (adjust) {
3802 case SOFT_INPUT_ADJUST_RESIZE:
3803 result.append("resize");
3804 break;
3805 case SOFT_INPUT_ADJUST_PAN:
3806 result.append("pan");
3807 break;
3808 case SOFT_INPUT_ADJUST_NOTHING:
3809 result.append("nothing");
3810 break;
3811 default:
3812 result.append(adjust);
3813 break;
3814 }
3815 result.append(' ');
3816 }
3817 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
3818 result.append("forwardNavigation").append(' ');
3819 }
3820 result.deleteCharAt(result.length() - 1);
3821 return result.toString();
3822 }
3823
3824 private static String rotationAnimationToString(int rotationAnimation) {
3825 switch (rotationAnimation) {
3826 case ROTATION_ANIMATION_UNSPECIFIED:
3827 return "UNSPECIFIED";
3828 case ROTATION_ANIMATION_ROTATE:
3829 return "ROTATE";
3830 case ROTATION_ANIMATION_CROSSFADE:
3831 return "CROSSFADE";
3832 case ROTATION_ANIMATION_JUMPCUT:
3833 return "JUMPCUT";
3834 case ROTATION_ANIMATION_SEAMLESS:
3835 return "SEAMLESS";
3836 default:
3837 return Integer.toString(rotationAnimation);
3838 }
3839 }
3840
3841 private static String inputFeatureToString(int inputFeature) {
3842 switch (inputFeature) {
3843 case INPUT_FEATURE_DISABLE_POINTER_GESTURES:
3844 return "DISABLE_POINTER_GESTURES";
3845 case INPUT_FEATURE_NO_INPUT_CHANNEL:
3846 return "NO_INPUT_CHANNEL";
3847 case INPUT_FEATURE_DISABLE_USER_ACTIVITY:
3848 return "DISABLE_USER_ACTIVITY";
3849 default:
3850 return Integer.toString(inputFeature);
3851 }
3852 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 }
3854}