blob: 36fea589da997b7340cfd20c8e8b009de6e91b25 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
Jorim Jaggi484851b2017-09-22 16:03:27 +020019import static android.content.pm.ActivityInfo.COLOR_MODE_DEFAULT;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080020import static android.view.WindowLayoutParamsProto.ALPHA;
21import static android.view.WindowLayoutParamsProto.BUTTON_BRIGHTNESS;
22import static android.view.WindowLayoutParamsProto.COLOR_MODE;
23import static android.view.WindowLayoutParamsProto.FLAGS;
Vishnu Nair1d0fa072018-01-04 07:53:00 -080024import static android.view.WindowLayoutParamsProto.FORMAT;
25import static android.view.WindowLayoutParamsProto.GRAVITY;
26import static android.view.WindowLayoutParamsProto.HAS_SYSTEM_UI_LISTENERS;
27import static android.view.WindowLayoutParamsProto.HEIGHT;
28import static android.view.WindowLayoutParamsProto.HORIZONTAL_MARGIN;
29import static android.view.WindowLayoutParamsProto.INPUT_FEATURE_FLAGS;
30import static android.view.WindowLayoutParamsProto.NEEDS_MENU_KEY;
31import static android.view.WindowLayoutParamsProto.PREFERRED_REFRESH_RATE;
32import static android.view.WindowLayoutParamsProto.PRIVATE_FLAGS;
33import static android.view.WindowLayoutParamsProto.ROTATION_ANIMATION;
34import static android.view.WindowLayoutParamsProto.SCREEN_BRIGHTNESS;
35import static android.view.WindowLayoutParamsProto.SOFT_INPUT_MODE;
36import static android.view.WindowLayoutParamsProto.SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS;
37import static android.view.WindowLayoutParamsProto.SYSTEM_UI_VISIBILITY_FLAGS;
38import static android.view.WindowLayoutParamsProto.TYPE;
39import static android.view.WindowLayoutParamsProto.USER_ACTIVITY_TIMEOUT;
40import static android.view.WindowLayoutParamsProto.VERTICAL_MARGIN;
41import static android.view.WindowLayoutParamsProto.WIDTH;
42import static android.view.WindowLayoutParamsProto.WINDOW_ANIMATIONS;
43import static android.view.WindowLayoutParamsProto.X;
44import static android.view.WindowLayoutParamsProto.Y;
Jorim Jaggi484851b2017-09-22 16:03:27 +020045
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020046import android.Manifest.permission;
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080047import android.annotation.IntDef;
Siva Velusamy0d857b92015-04-22 10:23:56 -070048import android.annotation.NonNull;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040049import android.annotation.RequiresPermission;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080050import android.annotation.SystemApi;
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060051import android.annotation.SystemService;
Robert Carrb48380a2017-04-04 14:56:37 -070052import android.annotation.TestApi;
Mathew Inwooda570dee2018-08-17 14:56:00 +010053import android.annotation.UnsupportedAppUsage;
Jorim Jaggi241ae102016-11-02 21:57:33 -070054import android.app.KeyguardManager;
Jeff Browna492c3a2012-08-23 19:48:44 -070055import android.app.Presentation;
56import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import android.content.pm.ActivityInfo;
58import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070059import android.graphics.Rect;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040060import android.graphics.Region;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061import android.os.IBinder;
62import android.os.Parcel;
63import android.os.Parcelable;
64import android.text.TextUtils;
65import android.util.Log;
Steven Timotiusaf03df62017-07-18 16:56:43 -070066import android.util.proto.ProtoOutputStream;
Phil Weaver8583ae82018-02-13 11:01:24 -080067import android.view.accessibility.AccessibilityNodeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080069import java.lang.annotation.Retention;
70import java.lang.annotation.RetentionPolicy;
Clara Bayarri75e09792015-07-29 16:20:40 +010071import java.util.List;
Wale Ogunwale1f240c92016-02-22 18:04:58 -080072import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073
74/**
75 * The interface that apps use to talk to the window manager.
Jeff Browna492c3a2012-08-23 19:48:44 -070076 * </p><p>
77 * Each window manager instance is bound to a particular {@link Display}.
78 * To obtain a {@link WindowManager} for a different display, use
79 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
80 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
81 * to get the WindowManager.
82 * </p><p>
83 * The simplest way to show a window on another display is to create a
84 * {@link Presentation}. The presentation will automatically obtain a
85 * {@link WindowManager} and {@link Context} for that display.
86 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 */
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060088@SystemService(Context.WINDOW_SERVICE)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089public interface WindowManager extends ViewManager {
Jorim Jaggi61f39a72015-10-29 16:54:18 +010090
91 /** @hide */
92 int DOCKED_INVALID = -1;
93 /** @hide */
94 int DOCKED_LEFT = 1;
95 /** @hide */
96 int DOCKED_TOP = 2;
97 /** @hide */
98 int DOCKED_RIGHT = 3;
99 /** @hide */
100 int DOCKED_BOTTOM = 4;
101
Winson41275482016-10-10 15:17:45 -0700102 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000103 String INPUT_CONSUMER_PIP = "pip_input_consumer";
Winson41275482016-10-10 15:17:45 -0700104 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000105 String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer";
Winson41275482016-10-10 15:17:45 -0700106 /** @hide */
Winson Chunga89ffed2018-01-25 17:46:11 +0000107 String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer";
108 /** @hide */
109 String INPUT_CONSUMER_RECENTS_ANIMATION = "recents_animation_input_consumer";
Winson41275482016-10-10 15:17:45 -0700110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100112 * Not set up for a transition.
113 * @hide
114 */
115 int TRANSIT_UNSET = -1;
116
117 /**
118 * No animation for transition.
119 * @hide
120 */
121 int TRANSIT_NONE = 0;
122
123 /**
124 * A window in a new activity is being opened on top of an existing one in the same task.
125 * @hide
126 */
127 int TRANSIT_ACTIVITY_OPEN = 6;
128
129 /**
130 * The window in the top-most activity is being closed to reveal the previous activity in the
131 * same task.
132 * @hide
133 */
134 int TRANSIT_ACTIVITY_CLOSE = 7;
135
136 /**
137 * A window in a new task is being opened on top of an existing one in another activity's task.
138 * @hide
139 */
140 int TRANSIT_TASK_OPEN = 8;
141
142 /**
143 * A window in the top-most activity is being closed to reveal the previous activity in a
144 * different task.
145 * @hide
146 */
147 int TRANSIT_TASK_CLOSE = 9;
148
149 /**
150 * A window in an existing task is being displayed on top of an existing one in another
151 * activity's task.
152 * @hide
153 */
154 int TRANSIT_TASK_TO_FRONT = 10;
155
156 /**
157 * A window in an existing task is being put below all other tasks.
158 * @hide
159 */
160 int TRANSIT_TASK_TO_BACK = 11;
161
162 /**
163 * A window in a new activity that doesn't have a wallpaper is being opened on top of one that
164 * does, effectively closing the wallpaper.
165 * @hide
166 */
167 int TRANSIT_WALLPAPER_CLOSE = 12;
168
169 /**
170 * A window in a new activity that does have a wallpaper is being opened on one that didn't,
171 * effectively opening the wallpaper.
172 * @hide
173 */
174 int TRANSIT_WALLPAPER_OPEN = 13;
175
176 /**
177 * A window in a new activity is being opened on top of an existing one, and both are on top
178 * of the wallpaper.
179 * @hide
180 */
181 int TRANSIT_WALLPAPER_INTRA_OPEN = 14;
182
183 /**
184 * The window in the top-most activity is being closed to reveal the previous activity, and
185 * both are on top of the wallpaper.
186 * @hide
187 */
188 int TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
189
190 /**
191 * A window in a new task is being opened behind an existing one in another activity's task.
192 * The new window will show briefly and then be gone.
193 * @hide
194 */
195 int TRANSIT_TASK_OPEN_BEHIND = 16;
196
197 /**
198 * A window in a task is being animated in-place.
199 * @hide
200 */
201 int TRANSIT_TASK_IN_PLACE = 17;
202
203 /**
204 * An activity is being relaunched (e.g. due to configuration change).
205 * @hide
206 */
207 int TRANSIT_ACTIVITY_RELAUNCH = 18;
208
209 /**
210 * A task is being docked from recents.
211 * @hide
212 */
213 int TRANSIT_DOCK_TASK_FROM_RECENTS = 19;
214
215 /**
216 * Keyguard is going away.
217 * @hide
218 */
219 int TRANSIT_KEYGUARD_GOING_AWAY = 20;
220
221 /**
222 * Keyguard is going away with showing an activity behind that requests wallpaper.
223 * @hide
224 */
225 int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
226
227 /**
228 * Keyguard is being occluded.
229 * @hide
230 */
231 int TRANSIT_KEYGUARD_OCCLUDE = 22;
232
233 /**
234 * Keyguard is being unoccluded.
235 * @hide
236 */
237 int TRANSIT_KEYGUARD_UNOCCLUDE = 23;
238
239 /**
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200240 * A translucent activity is being opened.
241 * @hide
242 */
243 int TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24;
244
245 /**
246 * A translucent activity is being closed.
247 * @hide
248 */
249 int TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25;
250
251 /**
Adrian Roos93577212018-04-10 14:12:10 -0700252 * A crashing activity is being closed.
253 * @hide
254 */
255 int TRANSIT_CRASHING_ACTIVITY_CLOSE = 26;
256
257 /**
Evan Rosky2289ba12018-11-19 18:28:18 -0800258 * A task is changing windowing modes
259 * @hide
260 */
261 int TRANSIT_TASK_CHANGE_WINDOWING_MODE = 27;
262
263 /**
Issei Suzukicac2a502019-04-16 16:52:50 +0200264 * A display which can only contain one task is being shown because the first activity is
265 * started or it's being turned on.
266 * @hide
267 */
268 int TRANSIT_SHOW_SINGLE_TASK_DISPLAY = 28;
269
270 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100271 * @hide
272 */
273 @IntDef(prefix = { "TRANSIT_" }, value = {
274 TRANSIT_UNSET,
275 TRANSIT_NONE,
276 TRANSIT_ACTIVITY_OPEN,
277 TRANSIT_ACTIVITY_CLOSE,
278 TRANSIT_TASK_OPEN,
279 TRANSIT_TASK_CLOSE,
280 TRANSIT_TASK_TO_FRONT,
281 TRANSIT_TASK_TO_BACK,
282 TRANSIT_WALLPAPER_CLOSE,
283 TRANSIT_WALLPAPER_OPEN,
284 TRANSIT_WALLPAPER_INTRA_OPEN,
285 TRANSIT_WALLPAPER_INTRA_CLOSE,
286 TRANSIT_TASK_OPEN_BEHIND,
287 TRANSIT_TASK_IN_PLACE,
288 TRANSIT_ACTIVITY_RELAUNCH,
289 TRANSIT_DOCK_TASK_FROM_RECENTS,
290 TRANSIT_KEYGUARD_GOING_AWAY,
291 TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
292 TRANSIT_KEYGUARD_OCCLUDE,
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200293 TRANSIT_KEYGUARD_UNOCCLUDE,
294 TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
Jorim Jaggi9c52ebb2018-06-01 14:45:24 +0200295 TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
Evan Rosky2289ba12018-11-19 18:28:18 -0800296 TRANSIT_CRASHING_ACTIVITY_CLOSE,
Issei Suzukicac2a502019-04-16 16:52:50 +0200297 TRANSIT_TASK_CHANGE_WINDOWING_MODE,
298 TRANSIT_SHOW_SINGLE_TASK_DISPLAY
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100299 })
300 @Retention(RetentionPolicy.SOURCE)
301 @interface TransitionType {}
302
303 /**
304 * Transition flag: Keyguard is going away, but keeping the notification shade open
305 * @hide
306 */
307 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE = 0x1;
308
309 /**
310 * Transition flag: Keyguard is going away, but doesn't want an animation for it
311 * @hide
312 */
313 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION = 0x2;
314
315 /**
316 * Transition flag: Keyguard is going away while it was showing the system wallpaper.
317 * @hide
318 */
319 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER = 0x4;
320
321 /**
Issei Suzuki5609ccb2019-06-13 15:04:08 +0200322 * Transition flag: Keyguard is going away with subtle animation.
323 * @hide
324 */
325 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION = 0x8;
326
327 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100328 * @hide
329 */
330 @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = {
331 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE,
332 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION,
333 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER,
334 })
335 @Retention(RetentionPolicy.SOURCE)
336 @interface TransitionFlags {}
337
338 /**
Chilun8753ad32018-10-09 15:56:45 +0800339 * Remove content mode: Indicates remove content mode is currently not defined.
340 * @hide
341 */
342 int REMOVE_CONTENT_MODE_UNDEFINED = 0;
343
344 /**
345 * Remove content mode: Indicates that when display is removed, all its activities will be moved
346 * to the primary display and the topmost activity should become focused.
347 * @hide
348 */
349 int REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY = 1;
350
351 /**
352 * Remove content mode: Indicates that when display is removed, all its stacks and tasks will be
353 * removed, all activities will be destroyed according to the usual lifecycle.
354 * @hide
355 */
356 int REMOVE_CONTENT_MODE_DESTROY = 2;
357
358 /**
359 * @hide
360 */
361 @IntDef(prefix = { "REMOVE_CONTENT_MODE_" }, value = {
362 REMOVE_CONTENT_MODE_UNDEFINED,
363 REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY,
364 REMOVE_CONTENT_MODE_DESTROY,
365 })
366 @interface RemoveContentMode {}
367
368 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800369 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100370 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 * is invalid.
372 */
373 public static class BadTokenException extends RuntimeException {
374 public BadTokenException() {
375 }
376
377 public BadTokenException(String name) {
378 super(name);
379 }
380 }
381
382 /**
Craig Mautner6018aee2012-10-23 14:27:49 -0700383 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
384 * be found. See {@link android.app.Presentation} for more information on secondary displays.
385 */
386 public static class InvalidDisplayException extends RuntimeException {
387 public InvalidDisplayException() {
388 }
389
390 public InvalidDisplayException(String name) {
391 super(name);
392 }
393 }
394
395 /**
Jeff Browna492c3a2012-08-23 19:48:44 -0700396 * Returns the {@link Display} upon which this {@link WindowManager} instance
397 * will create new windows.
398 * <p>
399 * Despite the name of this method, the display that is returned is not
400 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
401 * The returned display could instead be a secondary display that this
402 * window manager instance is managing. Think of it as the display that
403 * this {@link WindowManager} instance uses by default.
404 * </p><p>
405 * To create windows on a different display, you need to obtain a
406 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
407 * class documentation for more information.)
408 * </p>
409 *
410 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 */
412 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700413
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800414 /**
415 * Special variation of {@link #removeView} that immediately invokes
416 * the given view hierarchy's {@link View#onDetachedFromWindow()
417 * View.onDetachedFromWindow()} methods before returning. This is not
418 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700419 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 * @param view The view to be removed.
421 */
422 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700423
Clara Bayarri75e09792015-07-29 16:20:40 +0100424 /**
425 * Used to asynchronously request Keyboard Shortcuts from the focused window.
426 *
427 * @hide
428 */
429 public interface KeyboardShortcutsReceiver {
430 /**
431 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
432 *
433 * @param result The keyboard shortcuts to be displayed.
434 */
435 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
436 }
437
438 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800439 * Message for taking fullscreen screenshot
440 * @hide
441 */
442 final int TAKE_SCREENSHOT_FULLSCREEN = 1;
443
444 /**
445 * Message for taking screenshot of selected region.
446 * @hide
447 */
448 final int TAKE_SCREENSHOT_SELECTED_REGION = 2;
449
450 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100451 * @hide
452 */
453 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
454
455 /**
456 * Request for keyboard shortcuts to be retrieved asynchronously.
457 *
458 * @param receiver The callback to be triggered when the result is ready.
459 *
460 * @hide
461 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000462 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100463
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400464 /**
465 * Return the touch region for the current IME window, or an empty region if there is none.
466 *
467 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
468 * region or there was an error.
469 *
470 * @hide
471 */
472 @SystemApi
473 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
474 public Region getCurrentImeTouchRegion();
475
Chilun8753ad32018-10-09 15:56:45 +0800476 /**
477 * Sets that the display should show its content when non-secure keyguard is shown.
478 *
479 * @param displayId Display ID.
480 * @param shouldShow Indicates that the display should show its content when non-secure keyguard
481 * is shown.
482 * @see KeyguardManager#isDeviceSecure()
483 * @see KeyguardManager#isDeviceLocked()
484 * @hide
485 */
486 @TestApi
487 default void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
488 }
489
490 /**
491 * Sets that the display should show system decors.
492 * <p>
493 * System decors include status bar, navigation bar, launcher.
494 * </p>
495 *
496 * @param displayId The id of the display.
497 * @param shouldShow Indicates that the display should show system decors.
Andrii Kuliandd989612019-02-21 12:13:28 -0800498 * @see #shouldShowSystemDecors(int)
Chilun8753ad32018-10-09 15:56:45 +0800499 * @hide
500 */
501 @TestApi
502 default void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
503 }
504
505 /**
Andrii Kuliandd989612019-02-21 12:13:28 -0800506 * Checks if the display supports showing system decors.
507 * <p>
508 * System decors include status bar, navigation bar, launcher.
509 * </p>
510 *
511 * @param displayId The id of the display.
512 * @see #setShouldShowSystemDecors(int, boolean)
513 * @hide
514 */
515 @TestApi
516 default boolean shouldShowSystemDecors(int displayId) {
517 return false;
518 }
519
520 /**
Chilun8753ad32018-10-09 15:56:45 +0800521 * Sets that the display should show IME.
522 *
523 * @param displayId Display ID.
524 * @param shouldShow Indicates that the display should show IME.
Chilun8753ad32018-10-09 15:56:45 +0800525 * @hide
526 */
527 @TestApi
528 default void setShouldShowIme(int displayId, boolean shouldShow) {
529 }
530
lumark9a72d222019-03-30 18:31:45 +0800531 /**
532 * Indicates that the display should show IME.
533 *
534 * @param displayId The id of the display.
535 * @return {@code true} if the display should show IME when an input field becomes
536 * focused on it.
537 * @hide
538 */
539 @TestApi
540 default boolean shouldShowIme(int displayId) {
541 return false;
542 }
543
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800544 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800545 /**
546 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700547 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
548 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 */
Romain Guy529b60a2010-08-03 18:05:47 -0700550 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700552
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 /**
554 * Y position for this window. With the default gravity it is ignored.
555 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
556 * an offset from the given edge.
557 */
Romain Guy529b60a2010-08-03 18:05:47 -0700558 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 public int y;
560
561 /**
562 * Indicates how much of the extra space will be allocated horizontally
563 * to the view associated with these LayoutParams. Specify 0 if the view
564 * should not be stretched. Otherwise the extra pixels will be pro-rated
565 * among all views whose weight is greater than 0.
566 */
Romain Guy529b60a2010-08-03 18:05:47 -0700567 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800568 public float horizontalWeight;
569
570 /**
571 * Indicates how much of the extra space will be allocated vertically
572 * to the view associated with these LayoutParams. Specify 0 if the view
573 * should not be stretched. Otherwise the extra pixels will be pro-rated
574 * among all views whose weight is greater than 0.
575 */
Romain Guy529b60a2010-08-03 18:05:47 -0700576 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800577 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700578
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 /**
580 * The general type of window. There are three main classes of
581 * window types:
582 * <ul>
583 * <li> <strong>Application windows</strong> (ranging from
584 * {@link #FIRST_APPLICATION_WINDOW} to
585 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
586 * windows. For these types of windows, the {@link #token} must be
587 * set to the token of the activity they are a part of (this will
588 * normally be done for you if {@link #token} is null).
589 * <li> <strong>Sub-windows</strong> (ranging from
590 * {@link #FIRST_SUB_WINDOW} to
591 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
592 * window. For these types of windows, the {@link #token} must be
593 * the token of the window it is attached to.
594 * <li> <strong>System windows</strong> (ranging from
595 * {@link #FIRST_SYSTEM_WINDOW} to
596 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
597 * use by the system for specific purposes. They should not normally
598 * be used by applications, and a special permission is required
599 * to use them.
600 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700601 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800602 * @see #TYPE_BASE_APPLICATION
603 * @see #TYPE_APPLICATION
604 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700605 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 * @see #TYPE_APPLICATION_PANEL
607 * @see #TYPE_APPLICATION_MEDIA
608 * @see #TYPE_APPLICATION_SUB_PANEL
609 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
610 * @see #TYPE_STATUS_BAR
611 * @see #TYPE_SEARCH_BAR
612 * @see #TYPE_PHONE
613 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 * @see #TYPE_TOAST
615 * @see #TYPE_SYSTEM_OVERLAY
616 * @see #TYPE_PRIORITY_PHONE
617 * @see #TYPE_STATUS_BAR_PANEL
618 * @see #TYPE_SYSTEM_DIALOG
619 * @see #TYPE_KEYGUARD_DIALOG
620 * @see #TYPE_SYSTEM_ERROR
621 * @see #TYPE_INPUT_METHOD
622 * @see #TYPE_INPUT_METHOD_DIALOG
623 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700624 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700625 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200626 to = "BASE_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700627 @ViewDebug.IntToString(from = TYPE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200628 to = "APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700629 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200630 to = "APPLICATION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700631 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200632 to = "DRAWN_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700633 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200634 to = "APPLICATION_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700635 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200636 to = "APPLICATION_MEDIA"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700637 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200638 to = "APPLICATION_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700639 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200640 to = "APPLICATION_ABOVE_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700641 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200642 to = "APPLICATION_ATTACHED_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700643 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200644 to = "APPLICATION_MEDIA_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700645 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200646 to = "STATUS_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700647 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200648 to = "SEARCH_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700649 @ViewDebug.IntToString(from = TYPE_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200650 to = "PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700651 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200652 to = "SYSTEM_ALERT"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700653 @ViewDebug.IntToString(from = TYPE_TOAST,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200654 to = "TOAST"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700655 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200656 to = "SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700657 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200658 to = "PRIORITY_PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700659 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200660 to = "SYSTEM_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700661 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200662 to = "KEYGUARD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700663 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200664 to = "SYSTEM_ERROR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700665 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200666 to = "INPUT_METHOD"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700667 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200668 to = "INPUT_METHOD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700669 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200670 to = "WALLPAPER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700671 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200672 to = "STATUS_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700673 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200674 to = "SECURE_SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700675 @ViewDebug.IntToString(from = TYPE_DRAG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200676 to = "DRAG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700677 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200678 to = "STATUS_BAR_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700679 @ViewDebug.IntToString(from = TYPE_POINTER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200680 to = "POINTER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700681 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200682 to = "NAVIGATION_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700683 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200684 to = "VOLUME_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700685 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200686 to = "BOOT_PROGRESS"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700687 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200688 to = "INPUT_CONSUMER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700689 @ViewDebug.IntToString(from = TYPE_DREAM,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200690 to = "DREAM"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700691 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200692 to = "NAVIGATION_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700693 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200694 to = "DISPLAY_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700695 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200696 to = "MAGNIFICATION_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700697 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200698 to = "PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700699 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200700 to = "PRIVATE_PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700701 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200702 to = "VOICE_INTERACTION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700703 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200704 to = "VOICE_INTERACTION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700705 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200706 to = "DOCK_DIVIDER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700707 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200708 to = "QS_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700709 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200710 to = "SCREENSHOT"),
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800711 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200712 to = "APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700713 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700715
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 /**
717 * Start of window types that represent normal application windows.
718 */
719 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 /**
722 * Window type: an application window that serves as the "base" window
723 * of the overall application; all other application windows will
724 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700725 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800726 */
727 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 /**
730 * Window type: a normal application window. The {@link #token} must be
731 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700732 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 */
734 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700735
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800736 /**
737 * Window type: special application window that is displayed while the
738 * application is starting. Not for use by applications themselves;
739 * this is used by the system to display something until the
740 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700741 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742 */
743 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700744
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700746 * Window type: a variation on TYPE_APPLICATION that ensures the window
747 * manager will wait for this window to be drawn before the app is shown.
748 * In multiuser systems shows only on the owning user's window.
749 */
750 public static final int TYPE_DRAWN_APPLICATION = 4;
751
752 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800753 * End of types of application windows.
754 */
755 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700756
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800757 /**
758 * Start of types of sub-windows. The {@link #token} of these windows
759 * must be set to the window they are attached to. These types of
760 * windows are kept next to their attached window in Z-order, and their
761 * coordinate space is relative to their attached window.
762 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700763 public static final int FIRST_SUB_WINDOW = 1000;
764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800765 /**
766 * Window type: a panel on top of an application window. These windows
767 * appear on top of their attached window.
768 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700769 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
770
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800771 /**
John Spurlock33291d82013-03-13 14:45:14 -0400772 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 * are displayed behind their attached window.
774 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700775 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
776
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777 /**
778 * Window type: a sub-panel on top of an application window. These
779 * windows are displayed on top their attached window and any
780 * {@link #TYPE_APPLICATION_PANEL} panels.
781 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700782 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800783
784 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
785 * of the window happens as that of a top-level window, <em>not</em>
786 * as a child of its container.
787 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700788 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
789
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800790 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700791 * Window type: window for showing overlays on top of media windows.
792 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
793 * application window. They should be translucent to be useful. This
794 * is a big ugly hack so:
795 * @hide
796 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100797 @UnsupportedAppUsage
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700798 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
799
800 /**
801 * Window type: a above sub-panel on top of an application window and it's
802 * sub-panel windows. These windows are displayed on top of their attached window
803 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700804 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700805 */
806 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
807
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700808 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800809 * End of types of sub-windows.
810 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700811 public static final int LAST_SUB_WINDOW = 1999;
812
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800813 /**
814 * Start of system-specific window types. These are not normally
815 * created by applications.
816 */
817 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700818
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 /**
820 * Window type: the status bar. There can be only one status bar
821 * window; it is placed at the top of the screen, and all other
822 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700823 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800824 */
825 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700826
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 /**
828 * Window type: the search bar. There can be only one search bar
829 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700830 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800831 */
832 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700833
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 /**
835 * Window type: phone. These are non-application windows providing
836 * user interaction with the phone (in particular incoming calls).
837 * These windows are normally placed above all applications, but behind
838 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700839 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800840 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800842 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700844
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800845 /**
846 * Window type: system window, such as low power alert. These windows
847 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700848 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800849 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800851 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100853
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800854 /**
855 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700856 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200857 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800858 */
859 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800861 /**
862 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700863 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800864 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800865 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800866 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700868
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 /**
870 * Window type: system overlay windows, which need to be displayed
871 * on top of everything else. These windows must not take input
872 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700873 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800874 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800876 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800877 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800879 /**
880 * Window type: priority phone UI, which needs to be displayed even if
881 * the keyguard is active. These windows must not take input
882 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700883 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800884 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800885 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800886 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700888
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800889 /**
890 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700891 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700894
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 /**
896 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700897 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800898 */
899 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700900
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 /**
902 * Window type: internal system error windows, appear on top of
903 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700904 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800905 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800906 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800907 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700909
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800910 /**
911 * Window type: internal input methods windows, which appear above
912 * the normal UI. Application windows may be resized or panned to keep
913 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700914 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800915 */
916 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
917
918 /**
919 * Window type: internal input methods dialog windows, which appear above
920 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700921 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800922 */
923 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
924
925 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700926 * Window type: wallpaper window, placed behind any window that wants
927 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700928 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700929 */
930 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
931
932 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800933 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700934 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800935 */
936 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700937
938 /**
939 * Window type: secure system overlay windows, which need to be displayed
940 * on top of everything else. These windows must not take input
941 * focus, or they will interfere with the keyguard.
942 *
943 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
944 * system itself is allowed to create these overlays. Applications cannot
945 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700946 *
947 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700948 * @hide
949 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100950 @UnsupportedAppUsage
Jeff Brown3b2b3542010-10-15 00:54:27 -0700951 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
952
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800953 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700954 * Window type: the drag-and-drop pseudowindow. There is only one
955 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700956 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700957 * @hide
958 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700959 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700960
961 /**
Robert Carr8360a782017-11-22 12:47:58 -0800962 * Window type: panel that slides out from over the status bar
963 * In multiuser systems shows on all users' windows. These windows
964 * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL}
965 * windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800966 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800967 */
968 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
969
Jeff Brown83c09682010-12-23 17:50:18 -0800970 /**
971 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700972 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800973 * @hide
974 */
975 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800976
977 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400978 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700979 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400980 * @hide
981 */
982 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
983
984 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700985 * Window type: The volume level overlay/dialog shown when the user
986 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700987 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700988 * @hide
989 */
990 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
991
992 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700993 * Window type: The boot progress dialog, goes on top of everything
994 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700995 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700996 * @hide
997 */
998 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
999
1000 /**
Selim Cinekf83e8242015-05-19 18:08:14 -07001001 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -07001002 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -07001003 * @hide
1004 */
Selim Cinekf83e8242015-05-19 18:08:14 -07001005 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -07001006
1007 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -05001008 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -07001009 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -05001010 * @hide
1011 */
1012 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
1013
1014 /**
Jim Millere898ac52012-04-06 17:10:57 -07001015 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -07001016 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -07001017 * @hide
1018 */
1019 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
1020
1021 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -07001022 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -07001023 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -07001024 * @hide
1025 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001026 @UnsupportedAppUsage
Jeff Brownbd6e1502012-08-28 03:27:37 -07001027 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
1028
1029 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001030 * Window type: Magnification overlay window. Used to highlight the magnified
1031 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -07001032 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001033 * @hide
1034 */
1035 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
1036
1037 /**
keunyounga446bf02013-06-21 19:07:57 -07001038 * Window type: Window for Presentation on top of private
1039 * virtual display.
1040 */
1041 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
1042
1043 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -07001044 * Window type: Windows in the voice interaction layer.
1045 * @hide
1046 */
1047 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
1048
1049 /**
Phil Weaver40ded282016-01-25 15:49:02 -08001050 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -07001051 * android.accessibilityservice.AccessibilityService} for interception of
1052 * user interactions without changing the windows an accessibility service
1053 * can introspect. In particular, an accessibility service can introspect
1054 * only windows that a sighted user can interact with which is they can touch
1055 * these windows or can type into these windows. For example, if there
1056 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -08001057 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -07001058 * they are covered by a touchable window.
1059 */
1060 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
1061
1062 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -07001063 * Window type: Starting window for voice interaction layer.
1064 * @hide
1065 */
1066 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
1067
1068 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -07001069 * Window for displaying a handle used for resizing docked stacks. This window is owned
1070 * by the system process.
1071 * @hide
1072 */
1073 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
1074
1075 /**
Jason Monk8f7f3182015-11-18 16:35:14 -05001076 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
1077 * by Quick Settings Tiles.
1078 * @hide
1079 */
1080 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
1081
1082 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -08001083 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is
Muyuan Li36ca72c2016-08-06 20:24:06 -07001084 * reserved for screenshot region selection. These windows must not take input focus.
Muyuan Li6ca619f2016-03-08 13:30:42 -08001085 * @hide
1086 */
1087 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
1088
1089 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -07001090 * Window type: Window for Presentation on an external display.
1091 * @see android.app.Presentation
1092 * @hide
1093 */
1094 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
1095
1096 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001097 * Window type: Application overlay windows are displayed above all activity windows
1098 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
1099 * but below critical system windows like the status bar or IME.
1100 * <p>
1101 * The system may change the position, size, or visibility of these windows at anytime
1102 * to reduce visual clutter to the user and also manage resources.
1103 * <p>
1104 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
1105 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -08001106 * The system will adjust the importance of processes with this window type to reduce the
1107 * chance of the low-memory-killer killing them.
1108 * <p>
1109 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001110 */
1111 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
1112
1113 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001114 * End of types of system windows.
1115 */
1116 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001117
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001118 /**
Albert Chaulke4338f82017-04-19 15:54:08 -04001119 * @hide
1120 * Used internally when there is no suitable type available.
1121 */
1122 public static final int INVALID_WINDOW_TYPE = -1;
1123
1124 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001125 * Return true if the window type is an alert window.
1126 *
1127 * @param type The window type.
1128 * @return If the window type is an alert window.
1129 * @hide
1130 */
1131 public static boolean isSystemAlertWindowType(int type) {
1132 switch (type) {
1133 case TYPE_PHONE:
1134 case TYPE_PRIORITY_PHONE:
1135 case TYPE_SYSTEM_ALERT:
1136 case TYPE_SYSTEM_ERROR:
1137 case TYPE_SYSTEM_OVERLAY:
1138 case TYPE_APPLICATION_OVERLAY:
1139 return true;
1140 }
1141 return false;
1142 }
1143
Mathias Agopiand2112302010-12-07 19:38:17 -08001144 /** @deprecated this is ignored, this value is set automatically when needed. */
1145 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -08001147 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001148 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -08001150 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001151 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -08001153 /** @deprecated this is ignored, this value is set automatically when needed. */
1154 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001156
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001158 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001160 @Deprecated
1161 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001162
Mike Lockwoodef731622010-01-27 17:51:34 -05001163 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001164 * the lock screen to activate while the screen is on.
1165 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -08001166 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -05001167 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
1168
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 /** Window flag: everything behind this window will be dimmed.
1170 * Use {@link #dimAmount} to control the amount of dim. */
1171 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001172
1173 /** Window flag: blur everything behind this window.
1174 * @deprecated Blurring is no longer supported. */
1175 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001177
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178 /** Window flag: this window won't ever get key input focus, so the
1179 * user can not send key or other button events to it. Those will
1180 * instead go to whatever focusable window is behind it. This flag
1181 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
1182 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001183 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 * <p>Setting this flag also implies that the window will not need to
1185 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001186 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 * independently of any active input method (typically this means it
1188 * gets Z-ordered on top of the input method, so it can use the full
1189 * screen for its content and cover the input method if needed. You
1190 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
1191 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001192
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 /** Window flag: this window can never receive touch events. */
1194 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001195
John Spurlock33291d82013-03-13 14:45:14 -04001196 /** Window flag: even when this window is focusable (its
1197 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001198 * outside of the window to be sent to the windows behind it. Otherwise
1199 * it will consume all pointer events itself, regardless of whether they
1200 * are inside of the window. */
1201 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001202
John Spurlock33291d82013-03-13 14:45:14 -04001203 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 * screen is pressed, you will receive this first touch event. Usually
1205 * the first touch event is consumed by the system since the user can
1206 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -07001207 *
1208 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001210 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 /** Window flag: as long as this window is visible to the user, keep
1214 * the device's screen turned on and bright. */
1215 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001216
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -04001218 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 * window must correctly position its contents to take the screen
1220 * decoration into account. This flag is normally set for you
Adrian Roosfa02da62018-01-15 16:01:18 +01001221 * by Window as described in {@link Window#setFlags}.
1222 *
1223 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed
1224 * such that it avoids the {@link DisplayCutout} area if necessary according to the
1225 * {@link #layoutInDisplayCutoutMode}.
1226 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 /** Window flag: allow window to extend outside of the screen. */
1230 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001231
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001232 /**
John Spurlock33291d82013-03-13 14:45:14 -04001233 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 * this window is displayed. This allows the window to use the entire
1235 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -07001236 * an app window with this flag set is on the top layer. A fullscreen window
1237 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
1238 * {@link #softInputMode} field; the window will stay fullscreen
1239 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001240 *
1241 * <p>This flag can be controlled in your theme through the
1242 * {@link android.R.attr#windowFullscreen} attribute; this attribute
1243 * is automatically set for you in the standard fullscreen themes
1244 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
1245 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
1246 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
1247 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
1248 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
1249 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
1250 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
1251 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001252 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001253
John Spurlock33291d82013-03-13 14:45:14 -04001254 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
1255 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001256 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -07001259 * the screen.
1260 * @deprecated This flag is no longer used. */
1261 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001262 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001263
John Spurlock33291d82013-03-13 14:45:14 -04001264 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -07001265 * it from appearing in screenshots or from being viewed on non-secure
1266 * displays.
1267 *
1268 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
1269 * secure surfaces and secure displays.
1270 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 /** Window flag: a special mode where the layout parameters are used
1274 * to perform scaling of the surface when it is composited to the
1275 * screen. */
1276 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001277
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 /** Window flag: intended for windows that will often be used when the user is
1279 * holding the screen against their face, it will aggressively filter the event
1280 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001281 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001283 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 * until the finger is released. */
1285 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001286
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001287 /** Window flag: a special option only for use in combination with
1288 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
1289 * screen your window may appear on top of or behind screen decorations
1290 * such as the status bar. By also including this flag, the window
1291 * manager will report the inset rectangle needed to ensure your
1292 * content is not covered by screen decorations. This flag is normally
1293 * set for you by Window as described in {@link Window#setFlags}.*/
1294 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001295
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
1297 * respect to how this window interacts with the current method. That
1298 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
1299 * window will behave as if it needs to interact with the input method
1300 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
1301 * not set and this flag is set, then the window will behave as if it
1302 * doesn't need to interact with the input method and can be placed
1303 * to use more space and cover the input method.
1304 */
1305 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
1308 * can set this flag to receive a single special MotionEvent with
1309 * the action
1310 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
1311 * touches that occur outside of your window. Note that you will not
1312 * receive the full down/move/up gesture, only the location of the
1313 * first down as an ACTION_OUTSIDE.
1314 */
1315 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001316
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001317 /** Window flag: special flag to let windows be shown when the screen
1318 * is locked. This will let application windows take precedence over
1319 * key guard or any other lock screens. Can be used with
1320 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001321 * directly before showing the key guard window. Can be used with
1322 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
1323 * non-secure keyguards. This flag only applies to the top-most
1324 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -07001325 * @deprecated Use {@link android.R.attr#showWhenLocked} or
1326 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
1327 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001328 */
chaviw59b98852017-06-13 12:05:44 -07001329 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001330 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
1331
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001332 /** Window flag: ask that the system wallpaper be shown behind
1333 * your window. The window surface must be translucent to be able
1334 * to actually see the wallpaper behind it; this flag just ensures
1335 * that the wallpaper surface will be there if this window actually
1336 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001337 *
1338 * <p>This flag can be controlled in your theme through the
1339 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
1340 * is automatically set for you in the standard wallpaper themes
1341 * such as {@link android.R.style#Theme_Wallpaper},
1342 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
1343 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
1344 * {@link android.R.style#Theme_Holo_Wallpaper},
1345 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
1346 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
1347 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001348 */
1349 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001350
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001351 /** Window flag: when set as a window is being added or made
1352 * visible, once the window has been shown then the system will
1353 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -07001354 * up the device) to turn the screen on.
1355 * @deprecated Use {@link android.R.attr#turnScreenOn} or
1356 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
1357 * unintentional double life-cycle event.
1358 */
1359 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001360 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001361
Jeff Sharkey67f9d502017-08-05 13:49:13 -06001362 /**
1363 * Window flag: when set the window will cause the keyguard to be
1364 * dismissed, only if it is not a secure lock keyguard. Because such a
1365 * keyguard is not needed for security, it will never re-appear if the
1366 * user navigates to another window (in contrast to
1367 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1368 * secure and non-secure keyguards but ensure they reappear when the
1369 * user moves to another UI that doesn't hide them). If the keyguard is
1370 * currently active and is secure (requires an unlock credential) than
1371 * the user will still need to confirm it before seeing this window,
1372 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1373 *
1374 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1375 * {@link KeyguardManager#requestDismissKeyguard} instead.
1376 * Since keyguard was dismissed all the time as long as an
1377 * activity with this flag on its window was focused,
1378 * keyguard couldn't guard against unintentional touches on
1379 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001380 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001381 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001382 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001383
Jeff Brown01ce2e92010-09-26 22:20:12 -07001384 /** Window flag: when set the window will accept for touch events
1385 * outside of its bounds to be sent to other windows that also
1386 * support split touch. When this flag is not set, the first pointer
1387 * that goes down determines the window to which all subsequent touches
1388 * go until all pointers go up. When this flag is set, each pointer
1389 * (not necessarily the first) that goes down determines the window
1390 * to which all subsequent touches of that pointer will go until that
1391 * pointer goes up thereby enabling touches with multiple pointers
1392 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001393 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001394 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001395
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001396 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001397 * <p>Indicates whether this window should be hardware accelerated.
1398 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001399 *
Romain Guy72f0a272011-01-09 16:01:46 -08001400 * <p>This flag can be controlled programmatically <em>only</em> to enable
1401 * hardware acceleration. To enable hardware acceleration for a given
1402 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001403 *
Romain Guy72f0a272011-01-09 16:01:46 -08001404 * <pre>
1405 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1406 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1407 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1408 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001409 *
Romain Guy72f0a272011-01-09 16:01:46 -08001410 * <p>It is important to remember that this flag <strong>must</strong>
1411 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001412 *
Romain Guy72f0a272011-01-09 16:01:46 -08001413 * <p>This flag cannot be used to disable hardware acceleration after it
1414 * was enabled in your manifest using
1415 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1416 * and programmatically disable hardware acceleration (for automated testing
1417 * for instance), make sure it is turned off in your manifest and enable it
1418 * on your activity or dialog when you need it instead, using the method
1419 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001420 *
Romain Guy72f0a272011-01-09 16:01:46 -08001421 * <p>This flag is automatically set by the system if the
1422 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1423 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001424 */
1425 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001426
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001427 /**
1428 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001429 * overscan area, if there is one. The window should still correctly
1430 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001431 *
1432 * <p>This flag can be controlled in your theme through the
1433 * {@link android.R.attr#windowOverscan} attribute; this attribute
1434 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001435 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001436 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1437 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1438 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1439 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1440 *
1441 * <p>When this flag is enabled for a window, its normal content may be obscured
1442 * to some degree by the overscan region of the display. To ensure key parts of
1443 * that content are visible to the user, you can use
1444 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1445 * to set the point in the view hierarchy where the appropriate offsets should
1446 * be applied. (This can be done either by directly calling this function, using
1447 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1448 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1449 * View.fitSystemWindows(Rect)} method).</p>
1450 *
1451 * <p>This mechanism for positioning content elements is identical to its equivalent
1452 * use with layout and {@link View#setSystemUiVisibility(int)
1453 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1454 * position its UI elements with this overscan flag is set:</p>
1455 *
1456 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -08001457 */
1458 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1459
John Spurlockbd957402013-10-03 11:38:39 -04001460 /**
1461 * Window flag: request a translucent status bar with minimal system-provided
1462 * background protection.
1463 *
1464 * <p>This flag can be controlled in your theme through the
1465 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1466 * is automatically set for you in the standard translucent decor themes
1467 * such as
1468 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1469 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1470 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1471 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1472 *
1473 * <p>When this flag is enabled for a window, it automatically sets
1474 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1475 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
Priyank Singh3228b572019-07-16 14:25:53 -07001476 *
1477 * <p>Note: For devices that support
1478 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag may be ignored.
John Spurlockbd957402013-10-03 11:38:39 -04001479 */
1480 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1481
1482 /**
1483 * Window flag: request a translucent navigation bar with minimal system-provided
1484 * background protection.
1485 *
1486 * <p>This flag can be controlled in your theme through the
1487 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1488 * is automatically set for you in the standard translucent decor themes
1489 * such as
1490 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1491 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1492 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1493 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1494 *
1495 * <p>When this flag is enabled for a window, it automatically sets
1496 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1497 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
Priyank Singh3228b572019-07-16 14:25:53 -07001498 *
1499 * <p>Note: For devices that support
1500 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag can be disabled
1501 * by the car manufacturers.
John Spurlockbd957402013-10-03 11:38:39 -04001502 */
1503 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1504
Adam Lesinski6a591f52013-10-01 18:11:17 -07001505 /**
1506 * Flag for a window in local focus mode.
1507 * Window in local focus mode can control focus independent of window manager using
1508 * {@link Window#setLocalFocus(boolean, boolean)}.
1509 * Usually window in this mode will not get touch/key events from window manager, but will
1510 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1511 */
1512 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1513
Jeff Brown98db5fa2011-06-08 15:37:10 -07001514 /** Window flag: Enable touches to slide out of a window into neighboring
1515 * windows in mid-gesture instead of being captured for the duration of
1516 * the gesture.
1517 *
1518 * This flag changes the behavior of touch focus for this window only.
1519 * Touches can slide out of the window but they cannot necessarily slide
1520 * back in (unless the other window with touch focus permits it).
1521 *
1522 * {@hide}
1523 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001524 @UnsupportedAppUsage
Adam Lesinski6a591f52013-10-01 18:11:17 -07001525 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001526
Daniel Sandlere02d8082010-10-08 15:13:22 -04001527 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001528 * Window flag: When requesting layout with an attached window, the attached window may
1529 * overlap with the screen decorations of the parent window such as the navigation bar. By
1530 * including this flag, the window manager will layout the attached window within the decor
1531 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001532 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001533 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001535 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001536 * Flag indicating that this Window is responsible for drawing the background for the
1537 * system bars. If set, the system bars are drawn with a transparent background and the
1538 * corresponding areas in this window are filled with the colors specified in
1539 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1540 */
1541 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1542
1543 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001544 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001545 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001546 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1547 * @see #FLAG_DIM_BEHIND
1548 * @see #FLAG_NOT_FOCUSABLE
1549 * @see #FLAG_NOT_TOUCHABLE
1550 * @see #FLAG_NOT_TOUCH_MODAL
1551 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1552 * @see #FLAG_KEEP_SCREEN_ON
1553 * @see #FLAG_LAYOUT_IN_SCREEN
1554 * @see #FLAG_LAYOUT_NO_LIMITS
1555 * @see #FLAG_FULLSCREEN
1556 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001557 * @see #FLAG_SECURE
1558 * @see #FLAG_SCALED
1559 * @see #FLAG_IGNORE_CHEEK_PRESSES
1560 * @see #FLAG_LAYOUT_INSET_DECOR
1561 * @see #FLAG_ALT_FOCUSABLE_IM
1562 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1563 * @see #FLAG_SHOW_WHEN_LOCKED
1564 * @see #FLAG_SHOW_WALLPAPER
1565 * @see #FLAG_TURN_SCREEN_ON
1566 * @see #FLAG_DISMISS_KEYGUARD
1567 * @see #FLAG_SPLIT_TOUCH
1568 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001569 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001570 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001571 */
1572 @ViewDebug.ExportedProperty(flagMapping = {
1573 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001574 name = "ALLOW_LOCK_WHILE_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001575 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001576 name = "DIM_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001577 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001578 name = "BLUR_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001579 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001580 name = "NOT_FOCUSABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001581 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001582 name = "NOT_TOUCHABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001583 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001584 name = "NOT_TOUCH_MODAL"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001585 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001586 name = "TOUCHABLE_WHEN_WAKING"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001587 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001588 name = "KEEP_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001589 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001590 name = "LAYOUT_IN_SCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001591 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001592 name = "LAYOUT_NO_LIMITS"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001593 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001594 name = "FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001595 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001596 name = "FORCE_NOT_FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001597 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001598 name = "DITHER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001599 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001600 name = "SECURE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001601 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001602 name = "SCALED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001603 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001604 name = "IGNORE_CHEEK_PRESSES"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001605 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001606 name = "LAYOUT_INSET_DECOR"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001607 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001608 name = "ALT_FOCUSABLE_IM"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001609 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001610 name = "WATCH_OUTSIDE_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001611 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001612 name = "SHOW_WHEN_LOCKED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001613 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001614 name = "SHOW_WALLPAPER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001615 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001616 name = "TURN_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001617 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001618 name = "DISMISS_KEYGUARD"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001619 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001620 name = "SPLIT_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001621 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001622 name = "HARDWARE_ACCELERATED"),
1623 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN,
1624 name = "LOCAL_FOCUS_MODE"),
John Spurlockbd957402013-10-03 11:38:39 -04001625 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001626 name = "TRANSLUCENT_STATUS"),
John Spurlockbd957402013-10-03 11:38:39 -04001627 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001628 name = "TRANSLUCENT_NAVIGATION"),
1629 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
1630 name = "LOCAL_FOCUS_MODE"),
1631 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY,
1632 name = "FLAG_SLIPPERY"),
1633 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR,
1634 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"),
Adrian Roos217ccd22014-05-09 14:29:04 +02001635 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001636 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001637 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001638 public int flags;
1639
1640 /**
John Reck61375a82014-09-18 19:27:48 +00001641 * If the window has requested hardware acceleration, but this is not
1642 * allowed in the process it is in, then still render it as if it is
1643 * hardware accelerated. This is used for the starting preview windows
1644 * in the system process, which don't need to have the overhead of
1645 * hardware acceleration (they are just a static rendering), but should
1646 * be rendered as such to match the actual window of the app even if it
1647 * is hardware accelerated.
1648 * Even if the window isn't hardware accelerated, still do its rendering
1649 * as if it was.
1650 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1651 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001652 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001653 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1654 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001655 *
John Reck61375a82014-09-18 19:27:48 +00001656 * @hide
1657 */
1658 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1659
1660 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001661 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001662 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001663 * If certain parts of the UI that really do want to use hardware
1664 * acceleration, this flag can be set to force it. This is basically
1665 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001666 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001667 * @hide
1668 */
1669 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1670
1671 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001672 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001673 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001674 * them (they do not affect the wallpaper scrolling operation) by calling
1675 * {@link
1676 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1677 *
1678 * @hide
1679 */
1680 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1681
Craig Mautner88400d32012-09-30 12:35:45 -07001682 /** In a multiuser system if this flag is set and the owner is a system process then this
1683 * window will appear on all user screens. This overrides the default behavior of window
1684 * types that normally only appear on the owning user's screen. Refer to each window type
1685 * to determine its default behavior.
1686 *
1687 * {@hide} */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001688 @UnsupportedAppUsage
Craig Mautner88400d32012-09-30 12:35:45 -07001689 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1690
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001691 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001692 * Never animate position changes of the window.
1693 *
Robert Carrb48380a2017-04-04 14:56:37 -07001694 * {@hide}
1695 */
1696 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001697 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1698
Adam Lesinski6a591f52013-10-01 18:11:17 -07001699 /** Window flag: special flag to limit the size of the window to be
1700 * original size ([320x480] x density). Used to create window for applications
1701 * running under compatibility mode.
1702 *
1703 * {@hide} */
1704 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1705
1706 /** Window flag: a special option intended for system dialogs. When
1707 * this flag is set, the window will demand focus unconditionally when
1708 * it is created.
1709 * {@hide} */
1710 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1711
John Spurlock3f7cd512013-10-07 12:25:09 -04001712 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001713 * becomes top-most.
1714 * {@hide} */
1715 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1716
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001717 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001718 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1719 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1720 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1721 * {@hide}
1722 */
1723 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1724
1725 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001726 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1727 *
1728 * {@hide}
1729 */
1730 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1731
1732 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001733 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1734 * this flag is set it will be shown again and the bar will have a transparent background.
1735 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1736 *
1737 * {@hide}
1738 */
1739 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1740
1741 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001742 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001743 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001744 * because they are being managed externally through repositionChild.
1745 *
1746 * {@hide}
1747 */
1748 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1749
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001750 /**
1751 * Flag that will make window ignore app visibility and instead depend purely on the decor
1752 * view visibility for determining window visibility. This is used by recents to keep
1753 * drawing after it launches an app.
1754 * @hide
1755 */
1756 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1757
Robert Carra1eb4392015-12-10 12:43:51 -08001758 /**
1759 * Flag to indicate that this window is not expected to be replaced across
1760 * configuration change triggered activity relaunches. In general the WindowManager
1761 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1762 * until the replacement is ready to show in order to prevent visual glitch. However
1763 * some windows, such as PopupWindows expect to be cleared across configuration change,
1764 * and thus should hint to the WindowManager that it should not wait for a replacement.
1765 * @hide
1766 */
1767 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001768
1769 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001770 * Flag to indicate that this child window should always be laid-out in the parent
1771 * frame regardless of the current windowing mode configuration.
1772 * @hide
1773 */
1774 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1775
1776 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001777 * Flag to indicate that this window is always drawing the status bar background, no matter
1778 * what the other flags are.
1779 * @hide
1780 */
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001781 public static final int PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS = 0x00020000;
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001782
1783 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001784 * Flag to indicate that this window needs Sustained Performance Mode if
1785 * the device supports it.
1786 * @hide
1787 */
John Reck60e885f2016-04-21 15:40:45 -07001788 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001789
1790 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001791 * Flag to indicate that any window added by an application process that is of type
1792 * {@link #TYPE_TOAST} or that requires
1793 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1794 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001795 * @hide
1796 */
Philip P. Moltmannd66dd992018-09-17 11:26:04 -07001797 @SystemApi
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001798 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001799 public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001800
1801 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001802 * Indicates that this window is the rounded corners overlay present on some
1803 * devices this means that it will be excluded from: screenshots,
1804 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001805 * @hide
1806 */
Robert Carr132c9f52017-07-31 17:02:30 -07001807 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001808
1809 /**
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001810 * Flag to indicate that this window should be considered a screen decoration similar to the
1811 * nav bar and status bar. This will cause this window to affect the window insets reported
1812 * to other windows when it is visible.
1813 * @hide
1814 */
1815 @RequiresPermission(permission.STATUS_BAR_SERVICE)
1816 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
1817
1818 /**
Tiger Huanga90dea42018-08-03 17:20:17 +08001819 * Flag to indicate that the status bar window is in a state such that it forces showing
1820 * the navigation bar unless the navigation bar window is explicitly set to
1821 * {@link View#GONE}.
1822 * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}.
Tiger Huang34046012018-06-29 15:26:52 +08001823 * @hide
1824 */
Tiger Huanga90dea42018-08-03 17:20:17 +08001825 public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
Tiger Huang34046012018-06-29 15:26:52 +08001826
1827 /**
Peiyong Lin75045382019-03-04 19:22:33 -08001828 * Flag to indicate that the window is color space agnostic, and the color can be
1829 * interpreted to any color space.
1830 * @hide
1831 */
1832 public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000;
1833
1834 /**
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001835 * An internal annotation for flags that can be specified to {@link #softInputMode}.
1836 *
1837 * @hide
1838 */
1839 @SystemApi
1840 @Retention(RetentionPolicy.SOURCE)
1841 @IntDef(flag = true, prefix = { "SYSTEM_FLAG_" }, value = {
1842 SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1843 })
1844 public @interface SystemFlags {}
1845
1846 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001847 * Control flags that are private to the platform.
1848 * @hide
1849 */
Jorim Jaggi484851b2017-09-22 16:03:27 +02001850 @ViewDebug.ExportedProperty(flagMapping = {
1851 @ViewDebug.FlagToString(
1852 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1853 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1854 name = "FAKE_HARDWARE_ACCELERATED"),
1855 @ViewDebug.FlagToString(
1856 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1857 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1858 name = "FORCE_HARDWARE_ACCELERATED"),
1859 @ViewDebug.FlagToString(
1860 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1861 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1862 name = "WANTS_OFFSET_NOTIFICATIONS"),
1863 @ViewDebug.FlagToString(
1864 mask = PRIVATE_FLAG_SHOW_FOR_ALL_USERS,
1865 equals = PRIVATE_FLAG_SHOW_FOR_ALL_USERS,
1866 name = "SHOW_FOR_ALL_USERS"),
1867 @ViewDebug.FlagToString(
1868 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1869 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1870 name = "NO_MOVE_ANIMATION"),
1871 @ViewDebug.FlagToString(
1872 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1873 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1874 name = "COMPATIBLE_WINDOW"),
1875 @ViewDebug.FlagToString(
1876 mask = PRIVATE_FLAG_SYSTEM_ERROR,
1877 equals = PRIVATE_FLAG_SYSTEM_ERROR,
1878 name = "SYSTEM_ERROR"),
1879 @ViewDebug.FlagToString(
1880 mask = PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR,
1881 equals = PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR,
1882 name = "INHERIT_TRANSLUCENT_DECOR"),
1883 @ViewDebug.FlagToString(
1884 mask = PRIVATE_FLAG_KEYGUARD,
1885 equals = PRIVATE_FLAG_KEYGUARD,
1886 name = "KEYGUARD"),
1887 @ViewDebug.FlagToString(
1888 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1889 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1890 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"),
1891 @ViewDebug.FlagToString(
1892 mask = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1893 equals = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1894 name = "FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"),
1895 @ViewDebug.FlagToString(
1896 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1897 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1898 name = "PRESERVE_GEOMETRY"),
1899 @ViewDebug.FlagToString(
1900 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1901 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1902 name = "FORCE_DECOR_VIEW_VISIBILITY"),
1903 @ViewDebug.FlagToString(
1904 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1905 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1906 name = "WILL_NOT_REPLACE_ON_RELAUNCH"),
1907 @ViewDebug.FlagToString(
1908 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1909 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1910 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
1911 @ViewDebug.FlagToString(
Jorim Jaggia6aabac2019-03-11 14:23:16 -07001912 mask = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
1913 equals = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001914 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
1915 @ViewDebug.FlagToString(
1916 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1917 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1918 name = "SUSTAINED_PERFORMANCE_MODE"),
1919 @ViewDebug.FlagToString(
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001920 mask = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1921 equals = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001922 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"),
1923 @ViewDebug.FlagToString(
1924 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1925 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1926 name = "IS_ROUNDED_CORNERS_OVERLAY"),
1927 @ViewDebug.FlagToString(
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001928 mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
1929 equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
Tiger Huang34046012018-06-29 15:26:52 +08001930 name = "IS_SCREEN_DECOR"),
1931 @ViewDebug.FlagToString(
Tiger Huanga90dea42018-08-03 17:20:17 +08001932 mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
1933 equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
Peiyong Lin75045382019-03-04 19:22:33 -08001934 name = "STATUS_FORCE_SHOW_NAVIGATION"),
1935 @ViewDebug.FlagToString(
1936 mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1937 equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1938 name = "COLOR_SPACE_AGNOSTIC")
Jorim Jaggi484851b2017-09-22 16:03:27 +02001939 })
Robert Carrb48380a2017-04-04 14:56:37 -07001940 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001941 public int privateFlags;
1942
1943 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001944 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1945 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1946 * key. For this case, we should look at windows behind it to determine the appropriate
1947 * value.
1948 *
1949 * @hide
1950 */
1951 public static final int NEEDS_MENU_UNSET = 0;
1952
1953 /**
1954 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1955 * menu key.
1956 *
1957 * @hide
1958 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001959 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001960 public static final int NEEDS_MENU_SET_TRUE = 1;
1961
1962 /**
1963 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1964 * needs a menu key.
1965 *
1966 * @hide
1967 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001968 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001969 public static final int NEEDS_MENU_SET_FALSE = 2;
1970
1971 /**
1972 * State variable for a window belonging to an activity that responds to
1973 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1974 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1975 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1976 *
1977 * (Note that Action Bars, when available, are the preferred way to offer additional
1978 * functions otherwise accessed via an options menu.)
1979 *
1980 * {@hide}
1981 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001982 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001983 public int needsMenuKey = NEEDS_MENU_UNSET;
1984
1985 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001986 * Given a particular set of window manager flags, determine whether
1987 * such a window may be a target for an input method when it has
1988 * focus. In particular, this checks the
1989 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1990 * flags and returns true if the combination of the two corresponds
1991 * to a window that needs to be behind the input method so that the
1992 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001993 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001994 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001995 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001996 * @return Returns true if such a window should be behind/interact
1997 * with an input method, false if not.
1998 */
1999 public static boolean mayUseInputMethod(int flags) {
2000 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
2001 case 0:
2002 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
2003 return true;
2004 }
2005 return false;
2006 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002007
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002008 /**
2009 * Mask for {@link #softInputMode} of the bits that determine the
2010 * desired visibility state of the soft input area for this window.
2011 */
2012 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002013
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002014 /**
Yohei Yukawaa7547852018-03-27 15:47:45 -07002015 * Visibility state for {@link #softInputMode}: no state has been specified. The system may
2016 * show or hide the software keyboard for better user experience when the window gains
2017 * focus.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002018 */
2019 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002020
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002021 /**
2022 * Visibility state for {@link #softInputMode}: please don't change the state of
2023 * the soft input area.
2024 */
2025 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002026
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002027 /**
2028 * Visibility state for {@link #softInputMode}: please hide any soft input
2029 * area when normally appropriate (when the user is navigating
2030 * forward to your window).
2031 */
2032 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002033
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002034 /**
2035 * Visibility state for {@link #softInputMode}: please always hide any
2036 * soft input area when this window receives focus.
2037 */
2038 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002039
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002040 /**
2041 * Visibility state for {@link #softInputMode}: please show the soft
2042 * input area when normally appropriate (when the user is navigating
2043 * forward to your window).
Yohei Yukawacf68d522017-12-12 09:33:26 -08002044 *
2045 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2046 * is ignored unless there is a focused view that returns {@code true} from
2047 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002048 */
2049 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002051 /**
2052 * Visibility state for {@link #softInputMode}: please always make the
2053 * soft input area visible when this window receives input focus.
Yohei Yukawacf68d522017-12-12 09:33:26 -08002054 *
2055 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2056 * is ignored unless there is a focused view that returns {@code true} from
2057 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002058 */
2059 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002060
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002061 /**
2062 * Mask for {@link #softInputMode} of the bits that determine the
2063 * way that the window should be adjusted to accommodate the soft
2064 * input window.
2065 */
2066 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002068 /** Adjustment option for {@link #softInputMode}: nothing specified.
2069 * The system will try to pick one or
2070 * the other depending on the contents of the window.
2071 */
2072 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002074 /** Adjustment option for {@link #softInputMode}: set to allow the
2075 * window to be resized when an input
2076 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07002077 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002078 * {@link #SOFT_INPUT_ADJUST_PAN}; if
2079 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07002080 * the other depending on the contents of the window. If the window's
2081 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
2082 * value for {@link #softInputMode} will be ignored; the window will
2083 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002084 */
2085 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002087 /** Adjustment option for {@link #softInputMode}: set to have a window
2088 * pan when an input method is
2089 * shown, so it doesn't need to deal with resizing but just panned
2090 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07002091 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002092 * neither of these are set, then the system will try to pick one or
2093 * the other depending on the contents of the window.
2094 */
2095 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002096
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002097 /** Adjustment option for {@link #softInputMode}: set to have a window
2098 * not adjust for a shown input method. The window will not be resized,
2099 * and it will not be panned to make its focus visible.
2100 */
2101 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
2102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002103 /**
2104 * Bit for {@link #softInputMode}: set when the user has navigated
2105 * forward to the window. This is normally set automatically for
2106 * you by the system, though you may want to set it in certain cases
2107 * when you are displaying a window yourself. This flag will always
2108 * be cleared automatically after the window is displayed.
2109 */
2110 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002111
2112 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002113 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2114 *
2115 * @hide
2116 */
2117 @Retention(RetentionPolicy.SOURCE)
Jeff Sharkeyce8db992017-12-13 20:05:05 -07002118 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = {
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002119 SOFT_INPUT_STATE_UNSPECIFIED,
2120 SOFT_INPUT_STATE_UNCHANGED,
2121 SOFT_INPUT_STATE_HIDDEN,
2122 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
2123 SOFT_INPUT_STATE_VISIBLE,
2124 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
2125 SOFT_INPUT_ADJUST_UNSPECIFIED,
2126 SOFT_INPUT_ADJUST_RESIZE,
2127 SOFT_INPUT_ADJUST_PAN,
2128 SOFT_INPUT_ADJUST_NOTHING,
2129 SOFT_INPUT_IS_FORWARD_NAVIGATION,
2130 })
2131 public @interface SoftInputModeFlags {}
2132
2133 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08002134 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002135 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002136 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002137 * <ul>
2138 * <li> One of the visibility states
2139 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002140 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
2141 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002142 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002143 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
2144 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08002145 * </ul>
2146 *
2147 *
2148 * <p>This flag can be controlled in your theme through the
2149 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002151 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002153
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002154 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002155 * Placement of window within the screen as per {@link Gravity}. Both
2156 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2157 * android.graphics.Rect) Gravity.apply} and
2158 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2159 * Gravity.applyDisplay} are used during window layout, with this value
2160 * given as the desired gravity. For example you can specify
2161 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
2162 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
2163 * to control the behavior of
2164 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2165 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002166 *
2167 * @see Gravity
2168 */
2169 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002171 /**
2172 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002173 * between the container and the widget. See
2174 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2175 * android.graphics.Rect) Gravity.apply} for how this is used. This
2176 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002177 */
2178 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002180 /**
2181 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002182 * between the container and the widget. See
2183 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2184 * android.graphics.Rect) Gravity.apply} for how this is used. This
2185 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002186 */
2187 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002188
2189 /**
2190 * Positive insets between the drawing surface and window content.
2191 *
2192 * @hide
2193 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07002194 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08002195
2196 /**
2197 * Whether the surface insets have been manually set. When set to
2198 * {@code false}, the view root will automatically determine the
2199 * appropriate surface insets.
2200 *
2201 * @see #surfaceInsets
2202 * @hide
2203 */
2204 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002206 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07002207 * Whether the previous surface insets should be used vs. what is currently set. When set
2208 * to {@code true}, the view root will ignore surfaces insets in this object and use what
2209 * it currently has.
2210 *
2211 * @see #surfaceInsets
2212 * @hide
2213 */
2214 public boolean preservePreviousSurfaceInsets = true;
2215
2216 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002217 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08002218 * {@link android.graphics.PixelFormat}. The choice of format
2219 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002220 */
2221 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002223 /**
2224 * A style resource defining the animations to use for this window.
2225 * This must be a system resource; it can not be an application resource
2226 * because the window manager does not have access to applications.
2227 */
2228 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002229
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 /**
2231 * An alpha value to apply to this entire window.
2232 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
2233 */
2234 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002236 /**
2237 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
2238 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
2239 * dim.
2240 */
2241 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002242
2243 /**
2244 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
2245 * indicating that the brightness value is not overridden for this window
2246 * and normal brightness policy should be used.
2247 */
2248 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
2249
2250 /**
2251 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2252 * indicating that the screen or button backlight brightness should be set
2253 * to the lowest value when this window is in front.
2254 */
2255 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
2256
2257 /**
2258 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2259 * indicating that the screen or button backlight brightness should be set
2260 * to the hightest value when this window is in front.
2261 */
2262 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002263
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002264 /**
2265 * This can be used to override the user's preferred brightness of
2266 * the screen. A value of less than 0, the default, means to use the
2267 * preferred screen brightness. 0 to 1 adjusts the brightness from
2268 * dark to full bright.
2269 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002270 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002271
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002272 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002273 * This can be used to override the standard behavior of the button and
2274 * keyboard backlights. A value of less than 0, the default, means to
2275 * use the standard backlight behavior. 0 to 1 adjusts the brightness
2276 * from dark to full bright.
2277 */
2278 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
2279
2280 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07002281 * Unspecified value for {@link #rotationAnimation} indicating
2282 * a lack of preference.
2283 * @hide
2284 */
2285 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
2286
2287 /**
Robert Carr652aae42016-10-17 16:48:14 -07002288 * Value for {@link #rotationAnimation} which specifies that this
2289 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002290 */
2291 public static final int ROTATION_ANIMATION_ROTATE = 0;
2292
2293 /**
Robert Carr652aae42016-10-17 16:48:14 -07002294 * Value for {@link #rotationAnimation} which specifies that this
2295 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002296 */
2297 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
2298
2299 /**
Robert Carr652aae42016-10-17 16:48:14 -07002300 * Value for {@link #rotationAnimation} which specifies that this window
2301 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002302 */
2303 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
2304
2305 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07002306 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
2307 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07002308 * can't be applied without pausing the screen. For example, this is ideal
2309 * for Camera apps which don't want the viewfinder contents to ever rotate
2310 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
2311 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07002312 */
2313 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
2314
2315 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002316 * Define the exit and entry animations used on this window when the device is rotated.
2317 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08002318 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002319 * by other windows. All other situations default to the
2320 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002321 *
Craig Mautner3c174372013-02-21 17:54:37 -08002322 * @see #ROTATION_ANIMATION_ROTATE
2323 * @see #ROTATION_ANIMATION_CROSSFADE
2324 * @see #ROTATION_ANIMATION_JUMPCUT
2325 */
2326 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
2327
2328 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002329 * Identifier for this window. This will usually be filled in for
2330 * you.
2331 */
2332 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002334 /**
2335 * Name of the package owning this window.
2336 */
2337 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 /**
2340 * Specific orientation value for a window.
2341 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002342 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
2343 * If not set, a default value of
2344 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 * will be used.
2346 */
2347 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08002348
2349 /**
Michael Wright3f145a22014-07-22 19:46:03 -07002350 * The preferred refresh rate for the window.
2351 *
2352 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002353 * is on. The selected refresh rate will be applied to the display's default mode.
2354 *
2355 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07002356 *
2357 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002358 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07002359 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002360 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07002361 public float preferredRefreshRate;
2362
2363 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002364 * Id of the preferred display mode for the window.
2365 * <p>
2366 * This must be one of the supported modes obtained for the display(s) the window is on.
2367 * A value of {@code 0} means no preference.
2368 *
2369 * @see Display#getSupportedModes()
2370 * @see Display.Mode#getModeId()
2371 */
2372 public int preferredDisplayModeId;
2373
2374 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002375 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08002376 *
2377 * @see View#STATUS_BAR_VISIBLE
2378 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08002379 */
2380 public int systemUiVisibility;
2381
2382 /**
Joe Onorato14782f72011-01-25 19:53:17 -08002383 * @hide
2384 * The ui visibility as requested by the views in this hierarchy.
2385 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
2386 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002387 @UnsupportedAppUsage
Joe Onorato14782f72011-01-25 19:53:17 -08002388 public int subtreeSystemUiVisibility;
2389
2390 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002391 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002392 *
Joe Onorato664644d2011-01-23 17:53:23 -08002393 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
2394 *
2395 * @hide
2396 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002397 @UnsupportedAppUsage
Joe Onorato664644d2011-01-23 17:53:23 -08002398 public boolean hasSystemUiListeners;
2399
Adrian Roosfa02da62018-01-15 16:01:18 +01002400
2401 /** @hide */
2402 @Retention(RetentionPolicy.SOURCE)
2403 @IntDef(
2404 flag = true,
2405 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
Adrian Roos87526af2018-03-27 16:36:25 +02002406 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
Adrian Roosfa02da62018-01-15 16:01:18 +01002407 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER})
2408 @interface LayoutInDisplayCutoutMode {}
2409
2410 /**
2411 * Controls how the window is laid out if there is a {@link DisplayCutout}.
2412 *
2413 * <p>
2414 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}.
2415 *
2416 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
Adrian Roos87526af2018-03-27 16:36:25 +02002417 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Adrian Roosfa02da62018-01-15 16:01:18 +01002418 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
2419 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002420 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2421 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002422 */
2423 @LayoutInDisplayCutoutMode
2424 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
2425
2426 /**
2427 * The window is allowed to extend into the {@link DisplayCutout} area, only if the
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002428 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is
Adrian Roosfa02da62018-01-15 16:01:18 +01002429 * laid out such that it does not overlap with the {@link DisplayCutout} area.
2430 *
2431 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002432 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or
2433 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait
2434 * if the cutout is at the top edge. Similarly for
2435 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen.
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002436 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the
Adrian Roosfa02da62018-01-15 16:01:18 +01002437 * cutout area.
2438 *
2439 * <p>
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002440 * The usual precautions for not overlapping with the status and navigation bar are
2441 * sufficient for ensuring that no important content overlaps with the DisplayCutout.
Adrian Roosfa02da62018-01-15 16:01:18 +01002442 *
2443 * @see DisplayCutout
2444 * @see WindowInsets
Adrian Roos87526af2018-03-27 16:36:25 +02002445 * @see #layoutInDisplayCutoutMode
2446 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2447 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002448 */
2449 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;
2450
2451 /**
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002452 * @deprecated use {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES}
2453 * @hide
2454 */
2455 @Deprecated
2456 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 1;
2457
2458 /**
2459 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
2460 * edges of the screen.
2461 *
2462 * The window will never extend into a {@link DisplayCutout} area on the long edges of the
2463 * screen.
Adrian Roosfa02da62018-01-15 16:01:18 +01002464 *
2465 * <p>
2466 * The window must make sure that no important content overlaps with the
2467 * {@link DisplayCutout}.
2468 *
Adrian Roosad1da312018-03-27 19:17:50 +02002469 * <p>
2470 * In this mode, the window extends under cutouts on the short edge of the display in both
2471 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/>
2472 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png"
2473 * height="720"
2474 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in
2475 * portrait, no letterbox is applied."/>
2476 *
2477 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png"
2478 * width="720"
2479 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape,
2480 * no letterbox is applied."/>
2481 *
2482 * <p>
2483 * A cutout in the corner is considered to be on the short edge: <br/>
2484 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png"
2485 * height="720"
2486 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in
2487 * portrait, no letterbox is applied."/>
2488 *
2489 * <p>
2490 * On the other hand, should the cutout be on the long edge of the display, a letterbox will
2491 * be applied such that the window does not extend into the cutout on either long edge:
2492 * <br/>
2493 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png"
2494 * height="720"
2495 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait,
2496 * letterbox is applied."/>
2497 *
Adrian Roosfa02da62018-01-15 16:01:18 +01002498 * @see DisplayCutout
2499 * @see WindowInsets#getDisplayCutout()
Adrian Roos87526af2018-03-27 16:36:25 +02002500 * @see #layoutInDisplayCutoutMode
2501 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2502 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002503 */
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002504 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1;
Adrian Roosfa02da62018-01-15 16:01:18 +01002505
2506 /**
2507 * The window is never allowed to overlap with the DisplayCutout area.
2508 *
2509 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002510 * This should be used with windows that transiently set
2511 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION}
2512 * to avoid a relayout of the window when the respective flag is set or cleared.
Adrian Roosfa02da62018-01-15 16:01:18 +01002513 *
2514 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002515 * @see #layoutInDisplayCutoutMode
2516 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2517 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002518 */
2519 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;
2520
2521
Jeff Brown474dcb52011-06-14 20:22:50 -07002522 /**
2523 * When this window has focus, disable touch pad pointer gesture processing.
2524 * The window will receive raw position updates from the touch pad instead
2525 * of pointer movements and synthetic touch events.
2526 *
2527 * @hide
2528 */
2529 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
2530
2531 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07002532 * Does not construct an input channel for this window. The channel will therefore
2533 * be incapable of receiving input.
2534 *
2535 * @hide
2536 */
2537 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
2538
2539 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002540 * When this window has focus, does not call user activity for all input events so
2541 * the application will have to do it itself. Should only be used by
2542 * the keyguard and phone app.
2543 * <p>
2544 * Should only be used by the keyguard and phone app.
2545 * </p>
2546 *
2547 * @hide
2548 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002549 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002550 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
2551
2552 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07002553 * Control special features of the input subsystem.
2554 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002555 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07002556 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002557 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07002558 * @hide
2559 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002560 @UnsupportedAppUsage
Jeff Brown474dcb52011-06-14 20:22:50 -07002561 public int inputFeatures;
2562
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002563 /**
2564 * Sets the number of milliseconds before the user activity timeout occurs
2565 * when this window has focus. A value of -1 uses the standard timeout.
2566 * A value of 0 uses the minimum support display timeout.
2567 * <p>
2568 * This property can only be used to reduce the user specified display timeout;
2569 * it can never make the timeout longer than it normally would be.
2570 * </p><p>
2571 * Should only be used by the keyguard and phone app.
2572 * </p>
2573 *
2574 * @hide
2575 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002576 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002577 public long userActivityTimeout = -1;
2578
Phil Weaver396d5492016-03-22 17:53:50 -07002579 /**
2580 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
2581 * window.
2582 *
2583 * @hide
2584 */
Phil Weaver8583ae82018-02-13 11:01:24 -08002585 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
Phil Weaver396d5492016-03-22 17:53:50 -07002586
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002587 /**
2588 * The window title isn't kept in sync with what is displayed in the title bar, so we
2589 * separately track the currently shown title to provide to accessibility.
2590 *
2591 * @hide
2592 */
Alan Viverette39259dd2017-05-25 11:10:46 -04002593 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002594 public CharSequence accessibilityTitle;
2595
Robert Carr70f0d222016-04-10 16:33:08 -07002596 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002597 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07002598 * by the window manager. Useful for transient notifications like toasts
2599 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002600 * is hidden. Must be specified at window creation time. Note that apps
2601 * are not prepared to handle their windows being removed without their
2602 * explicit request and may try to interact with the removed window
2603 * resulting in undefined behavior and crashes. Therefore, we do hide
2604 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07002605 *
2606 * @hide
2607 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002608 @UnsupportedAppUsage
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002609 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07002610
Romain Guy48327452017-01-23 17:03:35 -08002611 /**
2612 * The color mode requested by this window. The target display may
2613 * not be able to honor the request. When the color mode is not set
2614 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
2615 * pixel format specified in {@link #format}.
2616 *
2617 * @hide
2618 */
2619 @ActivityInfo.ColorMode
Jorim Jaggi484851b2017-09-22 16:03:27 +02002620 private int mColorMode = COLOR_MODE_DEFAULT;
Romain Guy48327452017-01-23 17:03:35 -08002621
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08002623 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002624 type = TYPE_APPLICATION;
2625 format = PixelFormat.OPAQUE;
2626 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002628 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08002629 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002630 type = _type;
2631 format = PixelFormat.OPAQUE;
2632 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002633
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002634 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08002635 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002636 type = _type;
2637 flags = _flags;
2638 format = PixelFormat.OPAQUE;
2639 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002641 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002642 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 type = _type;
2644 flags = _flags;
2645 format = _format;
2646 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002647
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002648 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2649 super(w, h);
2650 type = _type;
2651 flags = _flags;
2652 format = _format;
2653 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002654
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2656 int _flags, int _format) {
2657 super(w, h);
2658 x = xpos;
2659 y = ypos;
2660 type = _type;
2661 flags = _flags;
2662 format = _format;
2663 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002665 public final void setTitle(CharSequence title) {
2666 if (null == title)
2667 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002668
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002669 mTitle = TextUtils.stringOrSpannedString(title);
2670 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002671
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002672 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002673 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002674 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002675
Wale Ogunwale246c2092016-04-07 14:12:44 -07002676 /**
2677 * Sets the surface insets based on the elevation (visual z position) of the input view.
2678 * @hide
2679 */
2680 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
2681 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07002682 // Partial workaround for b/28318973. Every inset change causes a freeform window
2683 // to jump a little for a few frames. If we never allow surface insets to decrease,
2684 // they will stabilize quickly (often from the very beginning, as most windows start
2685 // as focused).
2686 // TODO(b/22668382) to fix this properly.
2687 if (surfaceInset == 0) {
2688 // OK to have 0 (this is the case for non-freeform windows).
2689 surfaceInsets.set(0, 0, 0, 0);
2690 } else {
2691 surfaceInsets.set(
2692 Math.max(surfaceInset, surfaceInsets.left),
2693 Math.max(surfaceInset, surfaceInsets.top),
2694 Math.max(surfaceInset, surfaceInsets.right),
2695 Math.max(surfaceInset, surfaceInsets.bottom));
2696 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002697 hasManualSurfaceInsets = manual;
2698 preservePreviousSurfaceInsets = preservePrevious;
2699 }
2700
Romain Guy48327452017-01-23 17:03:35 -08002701 /**
2702 * <p>Set the color mode of the window. Setting the color mode might
2703 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
2704 *
2705 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2706 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
2707 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
2708 *
2709 * @see #getColorMode()
2710 */
2711 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
2712 mColorMode = colorMode;
2713 }
2714
2715 /**
2716 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2717 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
2718 *
2719 * @see #setColorMode(int)
2720 */
2721 @ActivityInfo.ColorMode
2722 public int getColorMode() {
2723 return mColorMode;
2724 }
2725
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002726 /** @hide */
2727 @SystemApi
2728 public final void setUserActivityTimeout(long timeout) {
2729 userActivityTimeout = timeout;
2730 }
2731
2732 /** @hide */
2733 @SystemApi
2734 public final long getUserActivityTimeout() {
2735 return userActivityTimeout;
2736 }
2737
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 public int describeContents() {
2739 return 0;
2740 }
2741
2742 public void writeToParcel(Parcel out, int parcelableFlags) {
2743 out.writeInt(width);
2744 out.writeInt(height);
2745 out.writeInt(x);
2746 out.writeInt(y);
2747 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002748 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002749 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002750 out.writeInt(softInputMode);
Adrian Roosfa02da62018-01-15 16:01:18 +01002751 out.writeInt(layoutInDisplayCutoutMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 out.writeInt(gravity);
2753 out.writeFloat(horizontalMargin);
2754 out.writeFloat(verticalMargin);
2755 out.writeInt(format);
2756 out.writeInt(windowAnimations);
2757 out.writeFloat(alpha);
2758 out.writeFloat(dimAmount);
2759 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002760 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08002761 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762 out.writeStrongBinder(token);
2763 out.writeString(packageName);
2764 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
2765 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07002766 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002767 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08002768 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08002769 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08002770 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07002771 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002772 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07002773 out.writeInt(surfaceInsets.left);
2774 out.writeInt(surfaceInsets.top);
2775 out.writeInt(surfaceInsets.right);
2776 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08002777 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07002778 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002779 out.writeInt(needsMenuKey);
Phil Weaver8583ae82018-02-13 11:01:24 -08002780 out.writeLong(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002781 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07002782 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002783 out.writeLong(hideTimeoutMilliseconds);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002785
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07002786 public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 = new Parcelable.Creator<LayoutParams>() {
2788 public LayoutParams createFromParcel(Parcel in) {
2789 return new LayoutParams(in);
2790 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002791
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002792 public LayoutParams[] newArray(int size) {
2793 return new LayoutParams[size];
2794 }
2795 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002796
2797
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002798 public LayoutParams(Parcel in) {
2799 width = in.readInt();
2800 height = in.readInt();
2801 x = in.readInt();
2802 y = in.readInt();
2803 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002804 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002805 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 softInputMode = in.readInt();
Adrian Roosfa02da62018-01-15 16:01:18 +01002807 layoutInDisplayCutoutMode = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 gravity = in.readInt();
2809 horizontalMargin = in.readFloat();
2810 verticalMargin = in.readFloat();
2811 format = in.readInt();
2812 windowAnimations = in.readInt();
2813 alpha = in.readFloat();
2814 dimAmount = in.readFloat();
2815 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002816 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08002817 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 token = in.readStrongBinder();
2819 packageName = in.readString();
2820 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
2821 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07002822 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002823 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002824 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08002825 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002826 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07002827 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002828 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07002829 surfaceInsets.left = in.readInt();
2830 surfaceInsets.top = in.readInt();
2831 surfaceInsets.right = in.readInt();
2832 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08002833 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07002834 preservePreviousSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002835 needsMenuKey = in.readInt();
Phil Weaver8583ae82018-02-13 11:01:24 -08002836 accessibilityIdOfAnchor = in.readLong();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002837 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07002838 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002839 hideTimeoutMilliseconds = in.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002840 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002841
Romain Guy72998072009-06-22 11:09:20 -07002842 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843 public static final int LAYOUT_CHANGED = 1<<0;
2844 public static final int TYPE_CHANGED = 1<<1;
2845 public static final int FLAGS_CHANGED = 1<<2;
2846 public static final int FORMAT_CHANGED = 1<<3;
2847 public static final int ANIMATION_CHANGED = 1<<4;
2848 public static final int DIM_AMOUNT_CHANGED = 1<<5;
2849 public static final int TITLE_CHANGED = 1<<6;
2850 public static final int ALPHA_CHANGED = 1<<7;
2851 public static final int MEMORY_TYPE_CHANGED = 1<<8;
2852 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
2853 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
2854 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08002855 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002856 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002857 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08002858 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002859 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08002860 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002861 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07002862 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002863 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002864 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002865 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07002866 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002867 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002868 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04002869 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
2870 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07002871 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002872 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07002873 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
2874 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002875 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
2876 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002877 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
2878 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07002879 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
2880 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04002881 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002882 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
2883 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07002884 public static final int COLOR_MODE_CHANGED = 1 << 26;
2885 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07002886 public static final int EVERYTHING_CHANGED = 0xffffffff;
2887
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002888 // internal buffer to backup/restore parameters under compatibility mode.
2889 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002890
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002891 public final int copyFrom(LayoutParams o) {
2892 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002893
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002894 if (width != o.width) {
2895 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07002896 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002897 }
2898 if (height != o.height) {
2899 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07002900 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002901 }
2902 if (x != o.x) {
2903 x = o.x;
2904 changes |= LAYOUT_CHANGED;
2905 }
2906 if (y != o.y) {
2907 y = o.y;
2908 changes |= LAYOUT_CHANGED;
2909 }
2910 if (horizontalWeight != o.horizontalWeight) {
2911 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002912 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002913 }
2914 if (verticalWeight != o.verticalWeight) {
2915 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002916 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002917 }
2918 if (horizontalMargin != o.horizontalMargin) {
2919 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002920 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 }
2922 if (verticalMargin != o.verticalMargin) {
2923 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002924 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002925 }
2926 if (type != o.type) {
2927 type = o.type;
2928 changes |= TYPE_CHANGED;
2929 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002930 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04002931 final int diff = flags ^ o.flags;
2932 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
2933 changes |= TRANSLUCENT_FLAGS_CHANGED;
2934 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07002936 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002937 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002938 if (privateFlags != o.privateFlags) {
2939 privateFlags = o.privateFlags;
2940 changes |= PRIVATE_FLAGS_CHANGED;
2941 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002942 if (softInputMode != o.softInputMode) {
2943 softInputMode = o.softInputMode;
2944 changes |= SOFT_INPUT_MODE_CHANGED;
2945 }
Adrian Roosfa02da62018-01-15 16:01:18 +01002946 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) {
2947 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode;
2948 changes |= LAYOUT_CHANGED;
2949 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002950 if (gravity != o.gravity) {
2951 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07002952 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002953 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 if (format != o.format) {
2955 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07002956 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002957 }
2958 if (windowAnimations != o.windowAnimations) {
2959 windowAnimations = o.windowAnimations;
2960 changes |= ANIMATION_CHANGED;
2961 }
2962 if (token == null) {
2963 // NOTE: token only copied if the recipient doesn't
2964 // already have one.
2965 token = o.token;
2966 }
2967 if (packageName == null) {
2968 // NOTE: packageName only copied if the recipient doesn't
2969 // already have one.
2970 packageName = o.packageName;
2971 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08002972 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002973 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002974 mTitle = o.mTitle;
2975 changes |= TITLE_CHANGED;
2976 }
2977 if (alpha != o.alpha) {
2978 alpha = o.alpha;
2979 changes |= ALPHA_CHANGED;
2980 }
2981 if (dimAmount != o.dimAmount) {
2982 dimAmount = o.dimAmount;
2983 changes |= DIM_AMOUNT_CHANGED;
2984 }
2985 if (screenBrightness != o.screenBrightness) {
2986 screenBrightness = o.screenBrightness;
2987 changes |= SCREEN_BRIGHTNESS_CHANGED;
2988 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002989 if (buttonBrightness != o.buttonBrightness) {
2990 buttonBrightness = o.buttonBrightness;
2991 changes |= BUTTON_BRIGHTNESS_CHANGED;
2992 }
Craig Mautner3c174372013-02-21 17:54:37 -08002993 if (rotationAnimation != o.rotationAnimation) {
2994 rotationAnimation = o.rotationAnimation;
2995 changes |= ROTATION_ANIMATION_CHANGED;
2996 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002997
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002998 if (screenOrientation != o.screenOrientation) {
2999 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07003000 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 }
Romain Guy529b60a2010-08-03 18:05:47 -07003002
Michael Wright3f145a22014-07-22 19:46:03 -07003003 if (preferredRefreshRate != o.preferredRefreshRate) {
3004 preferredRefreshRate = o.preferredRefreshRate;
3005 changes |= PREFERRED_REFRESH_RATE_CHANGED;
3006 }
3007
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003008 if (preferredDisplayModeId != o.preferredDisplayModeId) {
3009 preferredDisplayModeId = o.preferredDisplayModeId;
3010 changes |= PREFERRED_DISPLAY_MODE_ID;
3011 }
3012
Joe Onorato14782f72011-01-25 19:53:17 -08003013 if (systemUiVisibility != o.systemUiVisibility
3014 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08003015 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08003016 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08003017 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
3018 }
3019
3020 if (hasSystemUiListeners != o.hasSystemUiListeners) {
3021 hasSystemUiListeners = o.hasSystemUiListeners;
3022 changes |= SYSTEM_UI_LISTENER_CHANGED;
3023 }
3024
Jeff Brown474dcb52011-06-14 20:22:50 -07003025 if (inputFeatures != o.inputFeatures) {
3026 inputFeatures = o.inputFeatures;
3027 changes |= INPUT_FEATURES_CHANGED;
3028 }
3029
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003030 if (userActivityTimeout != o.userActivityTimeout) {
3031 userActivityTimeout = o.userActivityTimeout;
3032 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
3033 }
3034
Alan Viverette49a22e82014-07-12 20:01:27 -07003035 if (!surfaceInsets.equals(o.surfaceInsets)) {
3036 surfaceInsets.set(o.surfaceInsets);
3037 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003038 }
3039
Alan Viverette5435a302015-01-29 10:25:34 -08003040 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
3041 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
3042 changes |= SURFACE_INSETS_CHANGED;
3043 }
3044
Wale Ogunwale246c2092016-04-07 14:12:44 -07003045 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
3046 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
3047 changes |= SURFACE_INSETS_CHANGED;
3048 }
3049
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003050 if (needsMenuKey != o.needsMenuKey) {
3051 needsMenuKey = o.needsMenuKey;
3052 changes |= NEEDS_MENU_KEY_CHANGED;
3053 }
3054
Phil Weaver396d5492016-03-22 17:53:50 -07003055 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
3056 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
3057 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
3058 }
3059
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003060 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
3061 && o.accessibilityTitle != null) {
3062 // NOTE: accessibilityTitle only copied if the originator set one.
3063 accessibilityTitle = o.accessibilityTitle;
3064 changes |= ACCESSIBILITY_TITLE_CHANGED;
3065 }
3066
Romain Guy26a2b972017-04-17 09:39:51 -07003067 if (mColorMode != o.mColorMode) {
3068 mColorMode = o.mColorMode;
3069 changes |= COLOR_MODE_CHANGED;
3070 }
3071
Robert Carr70f0d222016-04-10 16:33:08 -07003072 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003073 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07003074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003075 return changes;
3076 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003078 @Override
3079 public String debug(String output) {
3080 output += "Contents of " + this + ":";
3081 Log.d("Debug", output);
3082 output = super.debug("");
3083 Log.d("Debug", output);
3084 Log.d("Debug", "");
3085 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
3086 return "";
3087 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003088
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003089 @Override
3090 public String toString() {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003091 return toString("");
3092 }
3093
3094 /**
3095 * @hide
3096 */
Felipe Lemeda9ea342018-03-22 15:19:51 -07003097 public void dumpDimensions(StringBuilder sb) {
3098 sb.append('(');
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003099 sb.append(x);
3100 sb.append(',');
3101 sb.append(y);
3102 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08003103 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
3104 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08003106 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
3107 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003108 sb.append(")");
Felipe Lemeda9ea342018-03-22 15:19:51 -07003109 }
3110
3111 /**
3112 * @hide
3113 */
3114 public String toString(String prefix) {
3115 StringBuilder sb = new StringBuilder(256);
3116 sb.append('{');
3117 dumpDimensions(sb);
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003118 if (horizontalMargin != 0) {
3119 sb.append(" hm=");
3120 sb.append(horizontalMargin);
3121 }
3122 if (verticalMargin != 0) {
3123 sb.append(" vm=");
3124 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003125 }
3126 if (gravity != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003127 sb.append(" gr=");
3128 sb.append(Gravity.toString(gravity));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003129 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003130 if (softInputMode != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003131 sb.append(" sim={");
3132 sb.append(softInputModeToString(softInputMode));
3133 sb.append('}');
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003134 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003135 if (layoutInDisplayCutoutMode != 0) {
3136 sb.append(" layoutInDisplayCutoutMode=");
3137 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode));
3138 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003139 sb.append(" ty=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003140 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003141 if (format != PixelFormat.OPAQUE) {
3142 sb.append(" fmt=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003143 sb.append(PixelFormat.formatToString(format));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003144 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 if (windowAnimations != 0) {
3146 sb.append(" wanim=0x");
3147 sb.append(Integer.toHexString(windowAnimations));
3148 }
3149 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
3150 sb.append(" or=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003151 sb.append(ActivityInfo.screenOrientationToString(screenOrientation));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003153 if (alpha != 1.0f) {
3154 sb.append(" alpha=");
3155 sb.append(alpha);
3156 }
3157 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3158 sb.append(" sbrt=");
3159 sb.append(screenBrightness);
3160 }
3161 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3162 sb.append(" bbrt=");
3163 sb.append(buttonBrightness);
3164 }
Craig Mautner3c174372013-02-21 17:54:37 -08003165 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
3166 sb.append(" rotAnim=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003167 sb.append(rotationAnimationToString(rotationAnimation));
Craig Mautner3c174372013-02-21 17:54:37 -08003168 }
Michael Wright3f145a22014-07-22 19:46:03 -07003169 if (preferredRefreshRate != 0) {
3170 sb.append(" preferredRefreshRate=");
3171 sb.append(preferredRefreshRate);
3172 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003173 if (preferredDisplayModeId != 0) {
3174 sb.append(" preferredDisplayMode=");
3175 sb.append(preferredDisplayModeId);
3176 }
Joe Onorato664644d2011-01-23 17:53:23 -08003177 if (hasSystemUiListeners) {
3178 sb.append(" sysuil=");
3179 sb.append(hasSystemUiListeners);
3180 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003181 if (inputFeatures != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003182 sb.append(" if=").append(inputFeatureToString(inputFeatures));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003183 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003184 if (userActivityTimeout >= 0) {
3185 sb.append(" userActivityTimeout=").append(userActivityTimeout);
3186 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07003187 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07003188 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
3189 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07003190 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08003191 if (hasManualSurfaceInsets) {
3192 sb.append(" (manual)");
3193 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003194 if (!preservePreviousSurfaceInsets) {
3195 sb.append(" (!preservePreviousSurfaceInsets)");
3196 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07003197 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003198 if (needsMenuKey == NEEDS_MENU_SET_TRUE) {
3199 sb.append(" needsMenuKey");
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003200 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003201 if (mColorMode != COLOR_MODE_DEFAULT) {
3202 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode));
3203 }
3204 sb.append(System.lineSeparator());
3205 sb.append(prefix).append(" fl=").append(
3206 ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
3207 if (privateFlags != 0) {
3208 sb.append(System.lineSeparator());
3209 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString(
3210 LayoutParams.class, "privateFlags", privateFlags));
3211 }
3212 if (systemUiVisibility != 0) {
3213 sb.append(System.lineSeparator());
3214 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString(
3215 View.class, "mSystemUiVisibility", systemUiVisibility));
3216 }
3217 if (subtreeSystemUiVisibility != 0) {
3218 sb.append(System.lineSeparator());
3219 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString(
3220 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility));
3221 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 sb.append('}');
3223 return sb.toString();
3224 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003225
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003226 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07003227 * @hide
3228 */
3229 public void writeToProto(ProtoOutputStream proto, long fieldId) {
3230 final long token = proto.start(fieldId);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003231 proto.write(TYPE, type);
3232 proto.write(X, x);
3233 proto.write(Y, y);
3234 proto.write(WIDTH, width);
3235 proto.write(HEIGHT, height);
3236 proto.write(HORIZONTAL_MARGIN, horizontalMargin);
3237 proto.write(VERTICAL_MARGIN, verticalMargin);
3238 proto.write(GRAVITY, gravity);
3239 proto.write(SOFT_INPUT_MODE, softInputMode);
3240 proto.write(FORMAT, format);
3241 proto.write(WINDOW_ANIMATIONS, windowAnimations);
3242 proto.write(ALPHA, alpha);
3243 proto.write(SCREEN_BRIGHTNESS, screenBrightness);
3244 proto.write(BUTTON_BRIGHTNESS, buttonBrightness);
3245 proto.write(ROTATION_ANIMATION, rotationAnimation);
3246 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate);
3247 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId);
3248 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners);
3249 proto.write(INPUT_FEATURE_FLAGS, inputFeatures);
3250 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout);
3251 proto.write(NEEDS_MENU_KEY, needsMenuKey);
3252 proto.write(COLOR_MODE, mColorMode);
3253 proto.write(FLAGS, flags);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003254 proto.write(PRIVATE_FLAGS, privateFlags);
3255 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility);
3256 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility);
Steven Timotiusaf03df62017-07-18 16:56:43 -07003257 proto.end(token);
3258 }
3259
3260 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003261 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003262 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003263 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003264 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003265 x = (int) (x * scale + 0.5f);
3266 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003267 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003268 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003269 }
3270 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003271 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003272 }
3273 }
3274
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003275 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003276 * Backup the layout parameters used in compatibility mode.
3277 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003278 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003279 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003280 void backup() {
3281 int[] backup = mCompatibilityParamsBackup;
3282 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003283 // we backup 4 elements, x, y, width, height
3284 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003285 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003286 backup[0] = x;
3287 backup[1] = y;
3288 backup[2] = width;
3289 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003290 }
3291
3292 /**
3293 * Restore the layout params' coordinates, size and gravity
3294 * @see LayoutParams#backup()
3295 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003296 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003297 void restore() {
3298 int[] backup = mCompatibilityParamsBackup;
3299 if (backup != null) {
3300 x = backup[0];
3301 y = backup[1];
3302 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003303 height = backup[3];
3304 }
3305 }
3306
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003307 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07003308
3309 /** @hide */
3310 @Override
3311 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
3312 super.encodeProperties(encoder);
3313
3314 encoder.addProperty("x", x);
3315 encoder.addProperty("y", y);
3316 encoder.addProperty("horizontalWeight", horizontalWeight);
3317 encoder.addProperty("verticalWeight", verticalWeight);
3318 encoder.addProperty("type", type);
3319 encoder.addProperty("flags", flags);
3320 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02003321
3322 /**
3323 * @hide
3324 * @return True if the layout parameters will cause the window to cover the full screen;
3325 * false otherwise.
3326 */
3327 public boolean isFullscreen() {
3328 return x == 0 && y == 0
3329 && width == WindowManager.LayoutParams.MATCH_PARENT
3330 && height == WindowManager.LayoutParams.MATCH_PARENT;
3331 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003332
Adrian Roosfa02da62018-01-15 16:01:18 +01003333 private static String layoutInDisplayCutoutModeToString(
3334 @LayoutInDisplayCutoutMode int mode) {
3335 switch (mode) {
3336 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT:
3337 return "default";
3338 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS:
3339 return "always";
3340 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER:
3341 return "never";
3342 default:
3343 return "unknown(" + mode + ")";
3344 }
3345 }
3346
Jorim Jaggi484851b2017-09-22 16:03:27 +02003347 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) {
3348 final StringBuilder result = new StringBuilder();
3349 final int state = softInputMode & SOFT_INPUT_MASK_STATE;
3350 if (state != 0) {
3351 result.append("state=");
3352 switch (state) {
3353 case SOFT_INPUT_STATE_UNCHANGED:
3354 result.append("unchanged");
3355 break;
3356 case SOFT_INPUT_STATE_HIDDEN:
3357 result.append("hidden");
3358 break;
3359 case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
3360 result.append("always_hidden");
3361 break;
3362 case SOFT_INPUT_STATE_VISIBLE:
3363 result.append("visible");
3364 break;
3365 case SOFT_INPUT_STATE_ALWAYS_VISIBLE:
3366 result.append("always_visible");
3367 break;
3368 default:
3369 result.append(state);
3370 break;
3371 }
3372 result.append(' ');
3373 }
3374 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST;
3375 if (adjust != 0) {
3376 result.append("adjust=");
3377 switch (adjust) {
3378 case SOFT_INPUT_ADJUST_RESIZE:
3379 result.append("resize");
3380 break;
3381 case SOFT_INPUT_ADJUST_PAN:
3382 result.append("pan");
3383 break;
3384 case SOFT_INPUT_ADJUST_NOTHING:
3385 result.append("nothing");
3386 break;
3387 default:
3388 result.append(adjust);
3389 break;
3390 }
3391 result.append(' ');
3392 }
3393 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
3394 result.append("forwardNavigation").append(' ');
3395 }
3396 result.deleteCharAt(result.length() - 1);
3397 return result.toString();
3398 }
3399
3400 private static String rotationAnimationToString(int rotationAnimation) {
3401 switch (rotationAnimation) {
3402 case ROTATION_ANIMATION_UNSPECIFIED:
3403 return "UNSPECIFIED";
3404 case ROTATION_ANIMATION_ROTATE:
3405 return "ROTATE";
3406 case ROTATION_ANIMATION_CROSSFADE:
3407 return "CROSSFADE";
3408 case ROTATION_ANIMATION_JUMPCUT:
3409 return "JUMPCUT";
3410 case ROTATION_ANIMATION_SEAMLESS:
3411 return "SEAMLESS";
3412 default:
3413 return Integer.toString(rotationAnimation);
3414 }
3415 }
3416
3417 private static String inputFeatureToString(int inputFeature) {
3418 switch (inputFeature) {
3419 case INPUT_FEATURE_DISABLE_POINTER_GESTURES:
3420 return "DISABLE_POINTER_GESTURES";
3421 case INPUT_FEATURE_NO_INPUT_CHANNEL:
3422 return "NO_INPUT_CHANNEL";
3423 case INPUT_FEATURE_DISABLE_USER_ACTIVITY:
3424 return "DISABLE_USER_ACTIVITY";
3425 default:
3426 return Integer.toString(inputFeature);
3427 }
3428 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003429 }
3430}