blob: bd38327d2c93e2cbe9295a8b79dd167a95b0f923 [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 /**
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100264 * @hide
265 */
266 @IntDef(prefix = { "TRANSIT_" }, value = {
267 TRANSIT_UNSET,
268 TRANSIT_NONE,
269 TRANSIT_ACTIVITY_OPEN,
270 TRANSIT_ACTIVITY_CLOSE,
271 TRANSIT_TASK_OPEN,
272 TRANSIT_TASK_CLOSE,
273 TRANSIT_TASK_TO_FRONT,
274 TRANSIT_TASK_TO_BACK,
275 TRANSIT_WALLPAPER_CLOSE,
276 TRANSIT_WALLPAPER_OPEN,
277 TRANSIT_WALLPAPER_INTRA_OPEN,
278 TRANSIT_WALLPAPER_INTRA_CLOSE,
279 TRANSIT_TASK_OPEN_BEHIND,
280 TRANSIT_TASK_IN_PLACE,
281 TRANSIT_ACTIVITY_RELAUNCH,
282 TRANSIT_DOCK_TASK_FROM_RECENTS,
283 TRANSIT_KEYGUARD_GOING_AWAY,
284 TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
285 TRANSIT_KEYGUARD_OCCLUDE,
Jorim Jaggi98a9d202018-03-26 16:17:07 +0200286 TRANSIT_KEYGUARD_UNOCCLUDE,
287 TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
Jorim Jaggi9c52ebb2018-06-01 14:45:24 +0200288 TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
Evan Rosky2289ba12018-11-19 18:28:18 -0800289 TRANSIT_CRASHING_ACTIVITY_CLOSE,
290 TRANSIT_TASK_CHANGE_WINDOWING_MODE
Jorim Jaggif84e2f62018-01-16 14:17:59 +0100291 })
292 @Retention(RetentionPolicy.SOURCE)
293 @interface TransitionType {}
294
295 /**
296 * Transition flag: Keyguard is going away, but keeping the notification shade open
297 * @hide
298 */
299 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE = 0x1;
300
301 /**
302 * Transition flag: Keyguard is going away, but doesn't want an animation for it
303 * @hide
304 */
305 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION = 0x2;
306
307 /**
308 * Transition flag: Keyguard is going away while it was showing the system wallpaper.
309 * @hide
310 */
311 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER = 0x4;
312
313 /**
314 * @hide
315 */
316 @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = {
317 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE,
318 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION,
319 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER,
320 })
321 @Retention(RetentionPolicy.SOURCE)
322 @interface TransitionFlags {}
323
324 /**
Chilun8753ad32018-10-09 15:56:45 +0800325 * Remove content mode: Indicates remove content mode is currently not defined.
326 * @hide
327 */
328 int REMOVE_CONTENT_MODE_UNDEFINED = 0;
329
330 /**
331 * Remove content mode: Indicates that when display is removed, all its activities will be moved
332 * to the primary display and the topmost activity should become focused.
333 * @hide
334 */
335 int REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY = 1;
336
337 /**
338 * Remove content mode: Indicates that when display is removed, all its stacks and tasks will be
339 * removed, all activities will be destroyed according to the usual lifecycle.
340 * @hide
341 */
342 int REMOVE_CONTENT_MODE_DESTROY = 2;
343
344 /**
345 * @hide
346 */
347 @IntDef(prefix = { "REMOVE_CONTENT_MODE_" }, value = {
348 REMOVE_CONTENT_MODE_UNDEFINED,
349 REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY,
350 REMOVE_CONTENT_MODE_DESTROY,
351 })
352 @interface RemoveContentMode {}
353
354 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100356 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800357 * is invalid.
358 */
359 public static class BadTokenException extends RuntimeException {
360 public BadTokenException() {
361 }
362
363 public BadTokenException(String name) {
364 super(name);
365 }
366 }
367
368 /**
Craig Mautner6018aee2012-10-23 14:27:49 -0700369 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
370 * be found. See {@link android.app.Presentation} for more information on secondary displays.
371 */
372 public static class InvalidDisplayException extends RuntimeException {
373 public InvalidDisplayException() {
374 }
375
376 public InvalidDisplayException(String name) {
377 super(name);
378 }
379 }
380
381 /**
Jeff Browna492c3a2012-08-23 19:48:44 -0700382 * Returns the {@link Display} upon which this {@link WindowManager} instance
383 * will create new windows.
384 * <p>
385 * Despite the name of this method, the display that is returned is not
386 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
387 * The returned display could instead be a secondary display that this
388 * window manager instance is managing. Think of it as the display that
389 * this {@link WindowManager} instance uses by default.
390 * </p><p>
391 * To create windows on a different display, you need to obtain a
392 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
393 * class documentation for more information.)
394 * </p>
395 *
396 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 */
398 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700399
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 /**
401 * Special variation of {@link #removeView} that immediately invokes
402 * the given view hierarchy's {@link View#onDetachedFromWindow()
403 * View.onDetachedFromWindow()} methods before returning. This is not
404 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700405 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 * @param view The view to be removed.
407 */
408 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700409
Clara Bayarri75e09792015-07-29 16:20:40 +0100410 /**
411 * Used to asynchronously request Keyboard Shortcuts from the focused window.
412 *
413 * @hide
414 */
415 public interface KeyboardShortcutsReceiver {
416 /**
417 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
418 *
419 * @param result The keyboard shortcuts to be displayed.
420 */
421 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
422 }
423
424 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800425 * Message for taking fullscreen screenshot
426 * @hide
427 */
428 final int TAKE_SCREENSHOT_FULLSCREEN = 1;
429
430 /**
431 * Message for taking screenshot of selected region.
432 * @hide
433 */
434 final int TAKE_SCREENSHOT_SELECTED_REGION = 2;
435
436 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100437 * @hide
438 */
439 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
440
441 /**
442 * Request for keyboard shortcuts to be retrieved asynchronously.
443 *
444 * @param receiver The callback to be triggered when the result is ready.
445 *
446 * @hide
447 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000448 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100449
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400450 /**
451 * Return the touch region for the current IME window, or an empty region if there is none.
452 *
453 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
454 * region or there was an error.
455 *
456 * @hide
457 */
458 @SystemApi
459 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
460 public Region getCurrentImeTouchRegion();
461
Chilun8753ad32018-10-09 15:56:45 +0800462 /**
463 * Sets that the display should show its content when non-secure keyguard is shown.
464 *
465 * @param displayId Display ID.
466 * @param shouldShow Indicates that the display should show its content when non-secure keyguard
467 * is shown.
468 * @see KeyguardManager#isDeviceSecure()
469 * @see KeyguardManager#isDeviceLocked()
470 * @hide
471 */
472 @TestApi
473 default void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
474 }
475
476 /**
477 * Sets that the display should show system decors.
478 * <p>
479 * System decors include status bar, navigation bar, launcher.
480 * </p>
481 *
482 * @param displayId The id of the display.
483 * @param shouldShow Indicates that the display should show system decors.
Andrii Kuliandd989612019-02-21 12:13:28 -0800484 * @see #shouldShowSystemDecors(int)
Chilun8753ad32018-10-09 15:56:45 +0800485 * @hide
486 */
487 @TestApi
488 default void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
489 }
490
491 /**
Andrii Kuliandd989612019-02-21 12:13:28 -0800492 * Checks if the display supports showing system decors.
493 * <p>
494 * System decors include status bar, navigation bar, launcher.
495 * </p>
496 *
497 * @param displayId The id of the display.
498 * @see #setShouldShowSystemDecors(int, boolean)
499 * @hide
500 */
501 @TestApi
502 default boolean shouldShowSystemDecors(int displayId) {
503 return false;
504 }
505
506 /**
Chilun8753ad32018-10-09 15:56:45 +0800507 * Sets that the display should show IME.
508 *
509 * @param displayId Display ID.
510 * @param shouldShow Indicates that the display should show IME.
511 * @see KeyguardManager#isDeviceSecure()
512 * @see KeyguardManager#isDeviceLocked()
513 * @hide
514 */
515 @TestApi
516 default void setShouldShowIme(int displayId, boolean shouldShow) {
517 }
518
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800519 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 /**
521 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700522 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
523 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 */
Romain Guy529b60a2010-08-03 18:05:47 -0700525 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700527
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800528 /**
529 * Y position for this window. With the default gravity it is ignored.
530 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
531 * an offset from the given edge.
532 */
Romain Guy529b60a2010-08-03 18:05:47 -0700533 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 public int y;
535
536 /**
537 * Indicates how much of the extra space will be allocated horizontally
538 * to the view associated with these LayoutParams. Specify 0 if the view
539 * should not be stretched. Otherwise the extra pixels will be pro-rated
540 * among all views whose weight is greater than 0.
541 */
Romain Guy529b60a2010-08-03 18:05:47 -0700542 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 public float horizontalWeight;
544
545 /**
546 * Indicates how much of the extra space will be allocated vertically
547 * to the view associated with these LayoutParams. Specify 0 if the view
548 * should not be stretched. Otherwise the extra pixels will be pro-rated
549 * among all views whose weight is greater than 0.
550 */
Romain Guy529b60a2010-08-03 18:05:47 -0700551 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700553
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 /**
555 * The general type of window. There are three main classes of
556 * window types:
557 * <ul>
558 * <li> <strong>Application windows</strong> (ranging from
559 * {@link #FIRST_APPLICATION_WINDOW} to
560 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
561 * windows. For these types of windows, the {@link #token} must be
562 * set to the token of the activity they are a part of (this will
563 * normally be done for you if {@link #token} is null).
564 * <li> <strong>Sub-windows</strong> (ranging from
565 * {@link #FIRST_SUB_WINDOW} to
566 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
567 * window. For these types of windows, the {@link #token} must be
568 * the token of the window it is attached to.
569 * <li> <strong>System windows</strong> (ranging from
570 * {@link #FIRST_SYSTEM_WINDOW} to
571 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
572 * use by the system for specific purposes. They should not normally
573 * be used by applications, and a special permission is required
574 * to use them.
575 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700576 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800577 * @see #TYPE_BASE_APPLICATION
578 * @see #TYPE_APPLICATION
579 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700580 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 * @see #TYPE_APPLICATION_PANEL
582 * @see #TYPE_APPLICATION_MEDIA
583 * @see #TYPE_APPLICATION_SUB_PANEL
584 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
585 * @see #TYPE_STATUS_BAR
586 * @see #TYPE_SEARCH_BAR
587 * @see #TYPE_PHONE
588 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 * @see #TYPE_TOAST
590 * @see #TYPE_SYSTEM_OVERLAY
591 * @see #TYPE_PRIORITY_PHONE
592 * @see #TYPE_STATUS_BAR_PANEL
593 * @see #TYPE_SYSTEM_DIALOG
594 * @see #TYPE_KEYGUARD_DIALOG
595 * @see #TYPE_SYSTEM_ERROR
596 * @see #TYPE_INPUT_METHOD
597 * @see #TYPE_INPUT_METHOD_DIALOG
598 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700599 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700600 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200601 to = "BASE_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700602 @ViewDebug.IntToString(from = TYPE_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200603 to = "APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700604 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200605 to = "APPLICATION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700606 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200607 to = "DRAWN_APPLICATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700608 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200609 to = "APPLICATION_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700610 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200611 to = "APPLICATION_MEDIA"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700612 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200613 to = "APPLICATION_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700614 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200615 to = "APPLICATION_ABOVE_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700616 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200617 to = "APPLICATION_ATTACHED_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700618 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200619 to = "APPLICATION_MEDIA_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700620 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200621 to = "STATUS_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700622 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200623 to = "SEARCH_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700624 @ViewDebug.IntToString(from = TYPE_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200625 to = "PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700626 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200627 to = "SYSTEM_ALERT"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700628 @ViewDebug.IntToString(from = TYPE_TOAST,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200629 to = "TOAST"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700630 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200631 to = "SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700632 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200633 to = "PRIORITY_PHONE"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700634 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200635 to = "SYSTEM_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700636 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200637 to = "KEYGUARD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700638 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200639 to = "SYSTEM_ERROR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700640 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200641 to = "INPUT_METHOD"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700642 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200643 to = "INPUT_METHOD_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700644 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200645 to = "WALLPAPER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700646 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200647 to = "STATUS_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700648 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200649 to = "SECURE_SYSTEM_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700650 @ViewDebug.IntToString(from = TYPE_DRAG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200651 to = "DRAG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700652 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200653 to = "STATUS_BAR_SUB_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700654 @ViewDebug.IntToString(from = TYPE_POINTER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200655 to = "POINTER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700656 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200657 to = "NAVIGATION_BAR"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700658 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200659 to = "VOLUME_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700660 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200661 to = "BOOT_PROGRESS"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700662 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200663 to = "INPUT_CONSUMER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700664 @ViewDebug.IntToString(from = TYPE_DREAM,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200665 to = "DREAM"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700666 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200667 to = "NAVIGATION_BAR_PANEL"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700668 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200669 to = "DISPLAY_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700670 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200671 to = "MAGNIFICATION_OVERLAY"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700672 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200673 to = "PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700674 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200675 to = "PRIVATE_PRESENTATION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700676 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200677 to = "VOICE_INTERACTION"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700678 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200679 to = "VOICE_INTERACTION_STARTING"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700680 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200681 to = "DOCK_DIVIDER"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700682 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200683 to = "QS_DIALOG"),
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700684 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200685 to = "SCREENSHOT"),
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800686 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
Jorim Jaggi484851b2017-09-22 16:03:27 +0200687 to = "APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700688 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800691 /**
692 * Start of window types that represent normal application windows.
693 */
694 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700695
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 /**
697 * Window type: an application window that serves as the "base" window
698 * of the overall application; all other application windows will
699 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700700 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 */
702 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700703
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 /**
705 * Window type: a normal application window. The {@link #token} must be
706 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700707 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800708 */
709 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 /**
712 * Window type: special application window that is displayed while the
713 * application is starting. Not for use by applications themselves;
714 * this is used by the system to display something until the
715 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700716 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 */
718 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700721 * Window type: a variation on TYPE_APPLICATION that ensures the window
722 * manager will wait for this window to be drawn before the app is shown.
723 * In multiuser systems shows only on the owning user's window.
724 */
725 public static final int TYPE_DRAWN_APPLICATION = 4;
726
727 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 * End of types of application windows.
729 */
730 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700731
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800732 /**
733 * Start of types of sub-windows. The {@link #token} of these windows
734 * must be set to the window they are attached to. These types of
735 * windows are kept next to their attached window in Z-order, and their
736 * coordinate space is relative to their attached window.
737 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700738 public static final int FIRST_SUB_WINDOW = 1000;
739
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800740 /**
741 * Window type: a panel on top of an application window. These windows
742 * appear on top of their attached window.
743 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700744 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
745
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 /**
John Spurlock33291d82013-03-13 14:45:14 -0400747 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748 * are displayed behind their attached window.
749 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700750 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
751
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 /**
753 * Window type: a sub-panel on top of an application window. These
754 * windows are displayed on top their attached window and any
755 * {@link #TYPE_APPLICATION_PANEL} panels.
756 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700757 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758
759 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
760 * of the window happens as that of a top-level window, <em>not</em>
761 * as a child of its container.
762 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700763 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800765 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700766 * Window type: window for showing overlays on top of media windows.
767 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
768 * application window. They should be translucent to be useful. This
769 * is a big ugly hack so:
770 * @hide
771 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100772 @UnsupportedAppUsage
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700773 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
774
775 /**
776 * Window type: a above sub-panel on top of an application window and it's
777 * sub-panel windows. These windows are displayed on top of their attached window
778 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700779 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700780 */
781 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
782
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700783 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 * End of types of sub-windows.
785 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700786 public static final int LAST_SUB_WINDOW = 1999;
787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 /**
789 * Start of system-specific window types. These are not normally
790 * created by applications.
791 */
792 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700793
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 /**
795 * Window type: the status bar. There can be only one status bar
796 * window; it is placed at the top of the screen, and all other
797 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700798 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800799 */
800 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700801
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800802 /**
803 * Window type: the search bar. There can be only one search bar
804 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700805 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800806 */
807 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700808
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800809 /**
810 * Window type: phone. These are non-application windows providing
811 * user interaction with the phone (in particular incoming calls).
812 * These windows are normally placed above all applications, but behind
813 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700814 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800815 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800817 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800818 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700819
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800820 /**
821 * Window type: system window, such as low power alert. These windows
822 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700823 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800824 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800826 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100828
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 /**
830 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700831 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200832 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800833 */
834 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100835
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800836 /**
837 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700838 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800839 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800840 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800841 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800842 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700843
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800844 /**
845 * Window type: system overlay windows, which need to be displayed
846 * on top of everything else. These windows must not take input
847 * focus, or they will interfere with the keyguard.
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_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700853
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800854 /**
855 * Window type: priority phone UI, which needs to be displayed even if
856 * the keyguard is active. These windows must not take input
857 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700858 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800859 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800861 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800862 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700863
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 /**
865 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700866 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700869
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800870 /**
871 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700872 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 */
874 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700875
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800876 /**
877 * Window type: internal system error windows, appear on top of
878 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700879 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800880 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800882 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800883 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700884
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800885 /**
886 * Window type: internal input methods windows, which appear above
887 * the normal UI. Application windows may be resized or panned to keep
888 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700889 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 */
891 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
892
893 /**
894 * Window type: internal input methods dialog windows, which appear above
895 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700896 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800897 */
898 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
899
900 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700901 * Window type: wallpaper window, placed behind any window that wants
902 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700903 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700904 */
905 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
906
907 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800908 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700909 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800910 */
911 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700912
913 /**
914 * Window type: secure system overlay windows, which need to be displayed
915 * on top of everything else. These windows must not take input
916 * focus, or they will interfere with the keyguard.
917 *
918 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
919 * system itself is allowed to create these overlays. Applications cannot
920 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700921 *
922 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700923 * @hide
924 */
Mathew Inwooda570dee2018-08-17 14:56:00 +0100925 @UnsupportedAppUsage
Jeff Brown3b2b3542010-10-15 00:54:27 -0700926 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
927
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800928 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700929 * Window type: the drag-and-drop pseudowindow. There is only one
930 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700931 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700932 * @hide
933 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700934 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700935
936 /**
Robert Carr8360a782017-11-22 12:47:58 -0800937 * Window type: panel that slides out from over the status bar
938 * In multiuser systems shows on all users' windows. These windows
939 * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL}
940 * windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800941 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800942 */
943 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
944
Jeff Brown83c09682010-12-23 17:50:18 -0800945 /**
946 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700947 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800948 * @hide
949 */
950 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800951
952 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400953 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700954 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400955 * @hide
956 */
957 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
958
959 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700960 * Window type: The volume level overlay/dialog shown when the user
961 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700962 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700963 * @hide
964 */
965 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
966
967 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700968 * Window type: The boot progress dialog, goes on top of everything
969 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700970 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700971 * @hide
972 */
973 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
974
975 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700976 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700977 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700978 * @hide
979 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700980 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -0700981
982 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500983 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700984 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500985 * @hide
986 */
987 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
988
989 /**
Jim Millere898ac52012-04-06 17:10:57 -0700990 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700991 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700992 * @hide
993 */
994 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
995
996 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700997 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700998 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700999 * @hide
1000 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001001 @UnsupportedAppUsage
Jeff Brownbd6e1502012-08-28 03:27:37 -07001002 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
1003
1004 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001005 * Window type: Magnification overlay window. Used to highlight the magnified
1006 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -07001007 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001008 * @hide
1009 */
1010 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
1011
1012 /**
keunyounga446bf02013-06-21 19:07:57 -07001013 * Window type: Window for Presentation on top of private
1014 * virtual display.
1015 */
1016 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
1017
1018 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -07001019 * Window type: Windows in the voice interaction layer.
1020 * @hide
1021 */
1022 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
1023
1024 /**
Phil Weaver40ded282016-01-25 15:49:02 -08001025 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -07001026 * android.accessibilityservice.AccessibilityService} for interception of
1027 * user interactions without changing the windows an accessibility service
1028 * can introspect. In particular, an accessibility service can introspect
1029 * only windows that a sighted user can interact with which is they can touch
1030 * these windows or can type into these windows. For example, if there
1031 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -08001032 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -07001033 * they are covered by a touchable window.
1034 */
1035 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
1036
1037 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -07001038 * Window type: Starting window for voice interaction layer.
1039 * @hide
1040 */
1041 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
1042
1043 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -07001044 * Window for displaying a handle used for resizing docked stacks. This window is owned
1045 * by the system process.
1046 * @hide
1047 */
1048 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
1049
1050 /**
Jason Monk8f7f3182015-11-18 16:35:14 -05001051 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
1052 * by Quick Settings Tiles.
1053 * @hide
1054 */
1055 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
1056
1057 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -08001058 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is
Muyuan Li36ca72c2016-08-06 20:24:06 -07001059 * reserved for screenshot region selection. These windows must not take input focus.
Muyuan Li6ca619f2016-03-08 13:30:42 -08001060 * @hide
1061 */
1062 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
1063
1064 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -07001065 * Window type: Window for Presentation on an external display.
1066 * @see android.app.Presentation
1067 * @hide
1068 */
1069 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
1070
1071 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001072 * Window type: Application overlay windows are displayed above all activity windows
1073 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
1074 * but below critical system windows like the status bar or IME.
1075 * <p>
1076 * The system may change the position, size, or visibility of these windows at anytime
1077 * to reduce visual clutter to the user and also manage resources.
1078 * <p>
1079 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
1080 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -08001081 * The system will adjust the importance of processes with this window type to reduce the
1082 * chance of the low-memory-killer killing them.
1083 * <p>
1084 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001085 */
1086 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
1087
1088 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001089 * End of types of system windows.
1090 */
1091 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001092
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001093 /**
Albert Chaulke4338f82017-04-19 15:54:08 -04001094 * @hide
1095 * Used internally when there is no suitable type available.
1096 */
1097 public static final int INVALID_WINDOW_TYPE = -1;
1098
1099 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -08001100 * Return true if the window type is an alert window.
1101 *
1102 * @param type The window type.
1103 * @return If the window type is an alert window.
1104 * @hide
1105 */
1106 public static boolean isSystemAlertWindowType(int type) {
1107 switch (type) {
1108 case TYPE_PHONE:
1109 case TYPE_PRIORITY_PHONE:
1110 case TYPE_SYSTEM_ALERT:
1111 case TYPE_SYSTEM_ERROR:
1112 case TYPE_SYSTEM_OVERLAY:
1113 case TYPE_APPLICATION_OVERLAY:
1114 return true;
1115 }
1116 return false;
1117 }
1118
Mathias Agopiand2112302010-12-07 19:38:17 -08001119 /** @deprecated this is ignored, this value is set automatically when needed. */
1120 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -08001122 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001123 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -08001125 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -07001126 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001127 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -08001128 /** @deprecated this is ignored, this value is set automatically when needed. */
1129 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001131
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001133 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001134 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001135 @Deprecated
1136 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001137
Mike Lockwoodef731622010-01-27 17:51:34 -05001138 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001139 * the lock screen to activate while the screen is on.
1140 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -08001141 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -05001142 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
1143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 /** Window flag: everything behind this window will be dimmed.
1145 * Use {@link #dimAmount} to control the amount of dim. */
1146 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001147
1148 /** Window flag: blur everything behind this window.
1149 * @deprecated Blurring is no longer supported. */
1150 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001152
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153 /** Window flag: this window won't ever get key input focus, so the
1154 * user can not send key or other button events to it. Those will
1155 * instead go to whatever focusable window is behind it. This flag
1156 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
1157 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001158 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 * <p>Setting this flag also implies that the window will not need to
1160 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001161 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001162 * independently of any active input method (typically this means it
1163 * gets Z-ordered on top of the input method, so it can use the full
1164 * screen for its content and cover the input method if needed. You
1165 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
1166 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001167
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 /** Window flag: this window can never receive touch events. */
1169 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001170
John Spurlock33291d82013-03-13 14:45:14 -04001171 /** Window flag: even when this window is focusable (its
1172 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 * outside of the window to be sent to the windows behind it. Otherwise
1174 * it will consume all pointer events itself, regardless of whether they
1175 * are inside of the window. */
1176 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001177
John Spurlock33291d82013-03-13 14:45:14 -04001178 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001179 * screen is pressed, you will receive this first touch event. Usually
1180 * the first touch event is consumed by the system since the user can
1181 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -07001182 *
1183 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001185 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001187
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 /** Window flag: as long as this window is visible to the user, keep
1189 * the device's screen turned on and bright. */
1190 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001191
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001192 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -04001193 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 * window must correctly position its contents to take the screen
1195 * decoration into account. This flag is normally set for you
Adrian Roosfa02da62018-01-15 16:01:18 +01001196 * by Window as described in {@link Window#setFlags}.
1197 *
1198 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed
1199 * such that it avoids the {@link DisplayCutout} area if necessary according to the
1200 * {@link #layoutInDisplayCutoutMode}.
1201 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 /** Window flag: allow window to extend outside of the screen. */
1205 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001206
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001207 /**
John Spurlock33291d82013-03-13 14:45:14 -04001208 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 * this window is displayed. This allows the window to use the entire
1210 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -07001211 * an app window with this flag set is on the top layer. A fullscreen window
1212 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
1213 * {@link #softInputMode} field; the window will stay fullscreen
1214 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001215 *
1216 * <p>This flag can be controlled in your theme through the
1217 * {@link android.R.attr#windowFullscreen} attribute; this attribute
1218 * is automatically set for you in the standard fullscreen themes
1219 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
1220 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
1221 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
1222 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
1223 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
1224 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
1225 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
1226 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001228
John Spurlock33291d82013-03-13 14:45:14 -04001229 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
1230 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001232
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001233 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -07001234 * the screen.
1235 * @deprecated This flag is no longer used. */
1236 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001238
John Spurlock33291d82013-03-13 14:45:14 -04001239 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -07001240 * it from appearing in screenshots or from being viewed on non-secure
1241 * displays.
1242 *
1243 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
1244 * secure surfaces and secure displays.
1245 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248 /** Window flag: a special mode where the layout parameters are used
1249 * to perform scaling of the surface when it is composited to the
1250 * screen. */
1251 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 /** Window flag: intended for windows that will often be used when the user is
1254 * holding the screen against their face, it will aggressively filter the event
1255 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001256 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001258 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 * until the finger is released. */
1260 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001261
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001262 /** Window flag: a special option only for use in combination with
1263 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
1264 * screen your window may appear on top of or behind screen decorations
1265 * such as the status bar. By also including this flag, the window
1266 * manager will report the inset rectangle needed to ensure your
1267 * content is not covered by screen decorations. This flag is normally
1268 * set for you by Window as described in {@link Window#setFlags}.*/
1269 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
1272 * respect to how this window interacts with the current method. That
1273 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
1274 * window will behave as if it needs to interact with the input method
1275 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
1276 * not set and this flag is set, then the window will behave as if it
1277 * doesn't need to interact with the input method and can be placed
1278 * to use more space and cover the input method.
1279 */
1280 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001281
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
1283 * can set this flag to receive a single special MotionEvent with
1284 * the action
1285 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
1286 * touches that occur outside of your window. Note that you will not
1287 * receive the full down/move/up gesture, only the location of the
1288 * first down as an ACTION_OUTSIDE.
1289 */
1290 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001291
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001292 /** Window flag: special flag to let windows be shown when the screen
1293 * is locked. This will let application windows take precedence over
1294 * key guard or any other lock screens. Can be used with
1295 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001296 * directly before showing the key guard window. Can be used with
1297 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
1298 * non-secure keyguards. This flag only applies to the top-most
1299 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -07001300 * @deprecated Use {@link android.R.attr#showWhenLocked} or
1301 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
1302 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001303 */
chaviw59b98852017-06-13 12:05:44 -07001304 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -07001305 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
1306
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001307 /** Window flag: ask that the system wallpaper be shown behind
1308 * your window. The window surface must be translucent to be able
1309 * to actually see the wallpaper behind it; this flag just ensures
1310 * that the wallpaper surface will be there if this window actually
1311 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001312 *
1313 * <p>This flag can be controlled in your theme through the
1314 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
1315 * is automatically set for you in the standard wallpaper themes
1316 * such as {@link android.R.style#Theme_Wallpaper},
1317 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
1318 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
1319 * {@link android.R.style#Theme_Holo_Wallpaper},
1320 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
1321 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
1322 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001323 */
1324 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001325
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001326 /** Window flag: when set as a window is being added or made
1327 * visible, once the window has been shown then the system will
1328 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -07001329 * up the device) to turn the screen on.
1330 * @deprecated Use {@link android.R.attr#turnScreenOn} or
1331 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
1332 * unintentional double life-cycle event.
1333 */
1334 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -07001335 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001336
Jeff Sharkey67f9d502017-08-05 13:49:13 -06001337 /**
1338 * Window flag: when set the window will cause the keyguard to be
1339 * dismissed, only if it is not a secure lock keyguard. Because such a
1340 * keyguard is not needed for security, it will never re-appear if the
1341 * user navigates to another window (in contrast to
1342 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1343 * secure and non-secure keyguards but ensure they reappear when the
1344 * user moves to another UI that doesn't hide them). If the keyguard is
1345 * currently active and is secure (requires an unlock credential) than
1346 * the user will still need to confirm it before seeing this window,
1347 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1348 *
1349 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1350 * {@link KeyguardManager#requestDismissKeyguard} instead.
1351 * Since keyguard was dismissed all the time as long as an
1352 * activity with this flag on its window was focused,
1353 * keyguard couldn't guard against unintentional touches on
1354 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001355 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001356 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001357 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001358
Jeff Brown01ce2e92010-09-26 22:20:12 -07001359 /** Window flag: when set the window will accept for touch events
1360 * outside of its bounds to be sent to other windows that also
1361 * support split touch. When this flag is not set, the first pointer
1362 * that goes down determines the window to which all subsequent touches
1363 * go until all pointers go up. When this flag is set, each pointer
1364 * (not necessarily the first) that goes down determines the window
1365 * to which all subsequent touches of that pointer will go until that
1366 * pointer goes up thereby enabling touches with multiple pointers
1367 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001368 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001369 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001370
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001371 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001372 * <p>Indicates whether this window should be hardware accelerated.
1373 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001374 *
Romain Guy72f0a272011-01-09 16:01:46 -08001375 * <p>This flag can be controlled programmatically <em>only</em> to enable
1376 * hardware acceleration. To enable hardware acceleration for a given
1377 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001378 *
Romain Guy72f0a272011-01-09 16:01:46 -08001379 * <pre>
1380 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1381 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1382 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1383 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001384 *
Romain Guy72f0a272011-01-09 16:01:46 -08001385 * <p>It is important to remember that this flag <strong>must</strong>
1386 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001387 *
Romain Guy72f0a272011-01-09 16:01:46 -08001388 * <p>This flag cannot be used to disable hardware acceleration after it
1389 * was enabled in your manifest using
1390 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1391 * and programmatically disable hardware acceleration (for automated testing
1392 * for instance), make sure it is turned off in your manifest and enable it
1393 * on your activity or dialog when you need it instead, using the method
1394 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001395 *
Romain Guy72f0a272011-01-09 16:01:46 -08001396 * <p>This flag is automatically set by the system if the
1397 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1398 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001399 */
1400 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001401
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001402 /**
1403 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001404 * overscan area, if there is one. The window should still correctly
1405 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001406 *
1407 * <p>This flag can be controlled in your theme through the
1408 * {@link android.R.attr#windowOverscan} attribute; this attribute
1409 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001410 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001411 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1412 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1413 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1414 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1415 *
1416 * <p>When this flag is enabled for a window, its normal content may be obscured
1417 * to some degree by the overscan region of the display. To ensure key parts of
1418 * that content are visible to the user, you can use
1419 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1420 * to set the point in the view hierarchy where the appropriate offsets should
1421 * be applied. (This can be done either by directly calling this function, using
1422 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1423 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1424 * View.fitSystemWindows(Rect)} method).</p>
1425 *
1426 * <p>This mechanism for positioning content elements is identical to its equivalent
1427 * use with layout and {@link View#setSystemUiVisibility(int)
1428 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1429 * position its UI elements with this overscan flag is set:</p>
1430 *
1431 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -08001432 */
1433 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1434
John Spurlockbd957402013-10-03 11:38:39 -04001435 /**
1436 * Window flag: request a translucent status bar with minimal system-provided
1437 * background protection.
1438 *
1439 * <p>This flag can be controlled in your theme through the
1440 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1441 * is automatically set for you in the standard translucent decor themes
1442 * such as
1443 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1444 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1445 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1446 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1447 *
1448 * <p>When this flag is enabled for a window, it automatically sets
1449 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1450 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
1451 */
1452 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1453
1454 /**
1455 * Window flag: request a translucent navigation bar with minimal system-provided
1456 * background protection.
1457 *
1458 * <p>This flag can be controlled in your theme through the
1459 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1460 * is automatically set for you in the standard translucent decor themes
1461 * such as
1462 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1463 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1464 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1465 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1466 *
1467 * <p>When this flag is enabled for a window, it automatically sets
1468 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1469 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
1470 */
1471 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1472
Adam Lesinski6a591f52013-10-01 18:11:17 -07001473 /**
1474 * Flag for a window in local focus mode.
1475 * Window in local focus mode can control focus independent of window manager using
1476 * {@link Window#setLocalFocus(boolean, boolean)}.
1477 * Usually window in this mode will not get touch/key events from window manager, but will
1478 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1479 */
1480 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1481
Jeff Brown98db5fa2011-06-08 15:37:10 -07001482 /** Window flag: Enable touches to slide out of a window into neighboring
1483 * windows in mid-gesture instead of being captured for the duration of
1484 * the gesture.
1485 *
1486 * This flag changes the behavior of touch focus for this window only.
1487 * Touches can slide out of the window but they cannot necessarily slide
1488 * back in (unless the other window with touch focus permits it).
1489 *
1490 * {@hide}
1491 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001492 @UnsupportedAppUsage
Adam Lesinski6a591f52013-10-01 18:11:17 -07001493 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001494
Daniel Sandlere02d8082010-10-08 15:13:22 -04001495 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001496 * Window flag: When requesting layout with an attached window, the attached window may
1497 * overlap with the screen decorations of the parent window such as the navigation bar. By
1498 * including this flag, the window manager will layout the attached window within the decor
1499 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001500 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001501 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001502
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001503 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001504 * Flag indicating that this Window is responsible for drawing the background for the
1505 * system bars. If set, the system bars are drawn with a transparent background and the
1506 * corresponding areas in this window are filled with the colors specified in
1507 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1508 */
1509 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1510
1511 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001512 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001513 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001514 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1515 * @see #FLAG_DIM_BEHIND
1516 * @see #FLAG_NOT_FOCUSABLE
1517 * @see #FLAG_NOT_TOUCHABLE
1518 * @see #FLAG_NOT_TOUCH_MODAL
1519 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1520 * @see #FLAG_KEEP_SCREEN_ON
1521 * @see #FLAG_LAYOUT_IN_SCREEN
1522 * @see #FLAG_LAYOUT_NO_LIMITS
1523 * @see #FLAG_FULLSCREEN
1524 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001525 * @see #FLAG_SECURE
1526 * @see #FLAG_SCALED
1527 * @see #FLAG_IGNORE_CHEEK_PRESSES
1528 * @see #FLAG_LAYOUT_INSET_DECOR
1529 * @see #FLAG_ALT_FOCUSABLE_IM
1530 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1531 * @see #FLAG_SHOW_WHEN_LOCKED
1532 * @see #FLAG_SHOW_WALLPAPER
1533 * @see #FLAG_TURN_SCREEN_ON
1534 * @see #FLAG_DISMISS_KEYGUARD
1535 * @see #FLAG_SPLIT_TOUCH
1536 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001537 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001538 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001539 */
1540 @ViewDebug.ExportedProperty(flagMapping = {
1541 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001542 name = "ALLOW_LOCK_WHILE_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001543 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001544 name = "DIM_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001545 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001546 name = "BLUR_BEHIND"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001547 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001548 name = "NOT_FOCUSABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001549 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001550 name = "NOT_TOUCHABLE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001551 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001552 name = "NOT_TOUCH_MODAL"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001553 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001554 name = "TOUCHABLE_WHEN_WAKING"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001555 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001556 name = "KEEP_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001557 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001558 name = "LAYOUT_IN_SCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001559 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001560 name = "LAYOUT_NO_LIMITS"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001561 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001562 name = "FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001563 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001564 name = "FORCE_NOT_FULLSCREEN"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001565 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001566 name = "DITHER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001567 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001568 name = "SECURE"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001569 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001570 name = "SCALED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001571 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001572 name = "IGNORE_CHEEK_PRESSES"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001573 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001574 name = "LAYOUT_INSET_DECOR"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001575 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001576 name = "ALT_FOCUSABLE_IM"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001577 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001578 name = "WATCH_OUTSIDE_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001579 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001580 name = "SHOW_WHEN_LOCKED"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001581 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001582 name = "SHOW_WALLPAPER"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001583 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001584 name = "TURN_SCREEN_ON"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001585 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001586 name = "DISMISS_KEYGUARD"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001587 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001588 name = "SPLIT_TOUCH"),
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001589 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001590 name = "HARDWARE_ACCELERATED"),
1591 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN,
1592 name = "LOCAL_FOCUS_MODE"),
John Spurlockbd957402013-10-03 11:38:39 -04001593 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001594 name = "TRANSLUCENT_STATUS"),
John Spurlockbd957402013-10-03 11:38:39 -04001595 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001596 name = "TRANSLUCENT_NAVIGATION"),
1597 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
1598 name = "LOCAL_FOCUS_MODE"),
1599 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY,
1600 name = "FLAG_SLIPPERY"),
1601 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR,
1602 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"),
Adrian Roos217ccd22014-05-09 14:29:04 +02001603 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001604 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001605 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001606 public int flags;
1607
1608 /**
John Reck61375a82014-09-18 19:27:48 +00001609 * If the window has requested hardware acceleration, but this is not
1610 * allowed in the process it is in, then still render it as if it is
1611 * hardware accelerated. This is used for the starting preview windows
1612 * in the system process, which don't need to have the overhead of
1613 * hardware acceleration (they are just a static rendering), but should
1614 * be rendered as such to match the actual window of the app even if it
1615 * is hardware accelerated.
1616 * Even if the window isn't hardware accelerated, still do its rendering
1617 * as if it was.
1618 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1619 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001620 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001621 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1622 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001623 *
John Reck61375a82014-09-18 19:27:48 +00001624 * @hide
1625 */
1626 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1627
1628 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001629 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001630 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001631 * If certain parts of the UI that really do want to use hardware
1632 * acceleration, this flag can be set to force it. This is basically
1633 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001634 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001635 * @hide
1636 */
1637 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1638
1639 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001640 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001641 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001642 * them (they do not affect the wallpaper scrolling operation) by calling
1643 * {@link
1644 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1645 *
1646 * @hide
1647 */
1648 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1649
Craig Mautner88400d32012-09-30 12:35:45 -07001650 /** In a multiuser system if this flag is set and the owner is a system process then this
1651 * window will appear on all user screens. This overrides the default behavior of window
1652 * types that normally only appear on the owning user's screen. Refer to each window type
1653 * to determine its default behavior.
1654 *
1655 * {@hide} */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001656 @UnsupportedAppUsage
Craig Mautner88400d32012-09-30 12:35:45 -07001657 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1658
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001659 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001660 * Never animate position changes of the window.
1661 *
Robert Carrb48380a2017-04-04 14:56:37 -07001662 * {@hide}
1663 */
1664 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001665 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1666
Adam Lesinski6a591f52013-10-01 18:11:17 -07001667 /** Window flag: special flag to limit the size of the window to be
1668 * original size ([320x480] x density). Used to create window for applications
1669 * running under compatibility mode.
1670 *
1671 * {@hide} */
1672 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1673
1674 /** Window flag: a special option intended for system dialogs. When
1675 * this flag is set, the window will demand focus unconditionally when
1676 * it is created.
1677 * {@hide} */
1678 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1679
John Spurlock3f7cd512013-10-07 12:25:09 -04001680 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001681 * becomes top-most.
1682 * {@hide} */
1683 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1684
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001685 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001686 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1687 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1688 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1689 * {@hide}
1690 */
1691 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1692
1693 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001694 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1695 *
1696 * {@hide}
1697 */
1698 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1699
1700 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001701 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1702 * this flag is set it will be shown again and the bar will have a transparent background.
1703 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1704 *
1705 * {@hide}
1706 */
1707 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1708
1709 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001710 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001711 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001712 * because they are being managed externally through repositionChild.
1713 *
1714 * {@hide}
1715 */
1716 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1717
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001718 /**
1719 * Flag that will make window ignore app visibility and instead depend purely on the decor
1720 * view visibility for determining window visibility. This is used by recents to keep
1721 * drawing after it launches an app.
1722 * @hide
1723 */
1724 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1725
Robert Carra1eb4392015-12-10 12:43:51 -08001726 /**
1727 * Flag to indicate that this window is not expected to be replaced across
1728 * configuration change triggered activity relaunches. In general the WindowManager
1729 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1730 * until the replacement is ready to show in order to prevent visual glitch. However
1731 * some windows, such as PopupWindows expect to be cleared across configuration change,
1732 * and thus should hint to the WindowManager that it should not wait for a replacement.
1733 * @hide
1734 */
1735 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001736
1737 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001738 * Flag to indicate that this child window should always be laid-out in the parent
1739 * frame regardless of the current windowing mode configuration.
1740 * @hide
1741 */
1742 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1743
1744 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001745 * Flag to indicate that this window is always drawing the status bar background, no matter
1746 * what the other flags are.
1747 * @hide
1748 */
1749 public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000;
1750
1751 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001752 * Flag to indicate that this window needs Sustained Performance Mode if
1753 * the device supports it.
1754 * @hide
1755 */
John Reck60e885f2016-04-21 15:40:45 -07001756 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001757
1758 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001759 * Flag to indicate that any window added by an application process that is of type
1760 * {@link #TYPE_TOAST} or that requires
1761 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1762 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001763 * @hide
1764 */
Philip P. Moltmannd66dd992018-09-17 11:26:04 -07001765 @SystemApi
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001766 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001767 public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001768
1769 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001770 * Indicates that this window is the rounded corners overlay present on some
1771 * devices this means that it will be excluded from: screenshots,
1772 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001773 * @hide
1774 */
Robert Carr132c9f52017-07-31 17:02:30 -07001775 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001776
1777 /**
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001778 * Flag to indicate that this window should be considered a screen decoration similar to the
1779 * nav bar and status bar. This will cause this window to affect the window insets reported
1780 * to other windows when it is visible.
1781 * @hide
1782 */
1783 @RequiresPermission(permission.STATUS_BAR_SERVICE)
1784 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
1785
1786 /**
Tiger Huanga90dea42018-08-03 17:20:17 +08001787 * Flag to indicate that the status bar window is in a state such that it forces showing
1788 * the navigation bar unless the navigation bar window is explicitly set to
1789 * {@link View#GONE}.
1790 * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}.
Tiger Huang34046012018-06-29 15:26:52 +08001791 * @hide
1792 */
Tiger Huanga90dea42018-08-03 17:20:17 +08001793 public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
Tiger Huang34046012018-06-29 15:26:52 +08001794
1795 /**
Peiyong Lin75045382019-03-04 19:22:33 -08001796 * Flag to indicate that the window is color space agnostic, and the color can be
1797 * interpreted to any color space.
1798 * @hide
1799 */
1800 public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000;
1801
1802 /**
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001803 * An internal annotation for flags that can be specified to {@link #softInputMode}.
1804 *
1805 * @hide
1806 */
1807 @SystemApi
1808 @Retention(RetentionPolicy.SOURCE)
1809 @IntDef(flag = true, prefix = { "SYSTEM_FLAG_" }, value = {
1810 SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1811 })
1812 public @interface SystemFlags {}
1813
1814 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001815 * Control flags that are private to the platform.
1816 * @hide
1817 */
Jorim Jaggi484851b2017-09-22 16:03:27 +02001818 @ViewDebug.ExportedProperty(flagMapping = {
1819 @ViewDebug.FlagToString(
1820 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1821 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
1822 name = "FAKE_HARDWARE_ACCELERATED"),
1823 @ViewDebug.FlagToString(
1824 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1825 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
1826 name = "FORCE_HARDWARE_ACCELERATED"),
1827 @ViewDebug.FlagToString(
1828 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1829 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
1830 name = "WANTS_OFFSET_NOTIFICATIONS"),
1831 @ViewDebug.FlagToString(
1832 mask = PRIVATE_FLAG_SHOW_FOR_ALL_USERS,
1833 equals = PRIVATE_FLAG_SHOW_FOR_ALL_USERS,
1834 name = "SHOW_FOR_ALL_USERS"),
1835 @ViewDebug.FlagToString(
1836 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1837 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
1838 name = "NO_MOVE_ANIMATION"),
1839 @ViewDebug.FlagToString(
1840 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1841 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
1842 name = "COMPATIBLE_WINDOW"),
1843 @ViewDebug.FlagToString(
1844 mask = PRIVATE_FLAG_SYSTEM_ERROR,
1845 equals = PRIVATE_FLAG_SYSTEM_ERROR,
1846 name = "SYSTEM_ERROR"),
1847 @ViewDebug.FlagToString(
1848 mask = PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR,
1849 equals = PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR,
1850 name = "INHERIT_TRANSLUCENT_DECOR"),
1851 @ViewDebug.FlagToString(
1852 mask = PRIVATE_FLAG_KEYGUARD,
1853 equals = PRIVATE_FLAG_KEYGUARD,
1854 name = "KEYGUARD"),
1855 @ViewDebug.FlagToString(
1856 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1857 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
1858 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"),
1859 @ViewDebug.FlagToString(
1860 mask = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1861 equals = PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT,
1862 name = "FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"),
1863 @ViewDebug.FlagToString(
1864 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1865 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY,
1866 name = "PRESERVE_GEOMETRY"),
1867 @ViewDebug.FlagToString(
1868 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1869 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY,
1870 name = "FORCE_DECOR_VIEW_VISIBILITY"),
1871 @ViewDebug.FlagToString(
1872 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1873 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH,
1874 name = "WILL_NOT_REPLACE_ON_RELAUNCH"),
1875 @ViewDebug.FlagToString(
1876 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1877 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
1878 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
1879 @ViewDebug.FlagToString(
1880 mask = PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND,
1881 equals = PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND,
1882 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
1883 @ViewDebug.FlagToString(
1884 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1885 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
1886 name = "SUSTAINED_PERFORMANCE_MODE"),
1887 @ViewDebug.FlagToString(
Philip P. Moltmann66ce2382018-10-09 13:46:11 -07001888 mask = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
1889 equals = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS,
Jorim Jaggi484851b2017-09-22 16:03:27 +02001890 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"),
1891 @ViewDebug.FlagToString(
1892 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1893 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
1894 name = "IS_ROUNDED_CORNERS_OVERLAY"),
1895 @ViewDebug.FlagToString(
Wale Ogunwalec0b0f932017-11-01 12:51:43 -07001896 mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
1897 equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
Tiger Huang34046012018-06-29 15:26:52 +08001898 name = "IS_SCREEN_DECOR"),
1899 @ViewDebug.FlagToString(
Tiger Huanga90dea42018-08-03 17:20:17 +08001900 mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
1901 equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
Peiyong Lin75045382019-03-04 19:22:33 -08001902 name = "STATUS_FORCE_SHOW_NAVIGATION"),
1903 @ViewDebug.FlagToString(
1904 mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1905 equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
1906 name = "COLOR_SPACE_AGNOSTIC")
Jorim Jaggi484851b2017-09-22 16:03:27 +02001907 })
Robert Carrb48380a2017-04-04 14:56:37 -07001908 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001909 public int privateFlags;
1910
1911 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001912 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1913 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1914 * key. For this case, we should look at windows behind it to determine the appropriate
1915 * value.
1916 *
1917 * @hide
1918 */
1919 public static final int NEEDS_MENU_UNSET = 0;
1920
1921 /**
1922 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1923 * menu key.
1924 *
1925 * @hide
1926 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001927 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001928 public static final int NEEDS_MENU_SET_TRUE = 1;
1929
1930 /**
1931 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1932 * needs a menu key.
1933 *
1934 * @hide
1935 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001936 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001937 public static final int NEEDS_MENU_SET_FALSE = 2;
1938
1939 /**
1940 * State variable for a window belonging to an activity that responds to
1941 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1942 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1943 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1944 *
1945 * (Note that Action Bars, when available, are the preferred way to offer additional
1946 * functions otherwise accessed via an options menu.)
1947 *
1948 * {@hide}
1949 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01001950 @UnsupportedAppUsage
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001951 public int needsMenuKey = NEEDS_MENU_UNSET;
1952
1953 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 * Given a particular set of window manager flags, determine whether
1955 * such a window may be a target for an input method when it has
1956 * focus. In particular, this checks the
1957 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1958 * flags and returns true if the combination of the two corresponds
1959 * to a window that needs to be behind the input method so that the
1960 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001961 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001962 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001963 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001964 * @return Returns true if such a window should be behind/interact
1965 * with an input method, false if not.
1966 */
1967 public static boolean mayUseInputMethod(int flags) {
1968 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1969 case 0:
1970 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1971 return true;
1972 }
1973 return false;
1974 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001975
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001976 /**
1977 * Mask for {@link #softInputMode} of the bits that determine the
1978 * desired visibility state of the soft input area for this window.
1979 */
1980 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001981
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001982 /**
Yohei Yukawaa7547852018-03-27 15:47:45 -07001983 * Visibility state for {@link #softInputMode}: no state has been specified. The system may
1984 * show or hide the software keyboard for better user experience when the window gains
1985 * focus.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001986 */
1987 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001988
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001989 /**
1990 * Visibility state for {@link #softInputMode}: please don't change the state of
1991 * the soft input area.
1992 */
1993 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001994
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001995 /**
1996 * Visibility state for {@link #softInputMode}: please hide any soft input
1997 * area when normally appropriate (when the user is navigating
1998 * forward to your window).
1999 */
2000 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002001
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002002 /**
2003 * Visibility state for {@link #softInputMode}: please always hide any
2004 * soft input area when this window receives focus.
2005 */
2006 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002007
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002008 /**
2009 * Visibility state for {@link #softInputMode}: please show the soft
2010 * input area when normally appropriate (when the user is navigating
2011 * forward to your window).
Yohei Yukawacf68d522017-12-12 09:33:26 -08002012 *
2013 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2014 * is ignored unless there is a focused view that returns {@code true} from
2015 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002016 */
2017 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002018
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002019 /**
2020 * Visibility state for {@link #softInputMode}: please always make the
2021 * soft input area visible when this window receives input focus.
Yohei Yukawacf68d522017-12-12 09:33:26 -08002022 *
2023 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag
2024 * is ignored unless there is a focused view that returns {@code true} from
2025 * {@link View#isInEditMode()} when the window is focused.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002026 */
2027 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002028
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002029 /**
2030 * Mask for {@link #softInputMode} of the bits that determine the
2031 * way that the window should be adjusted to accommodate the soft
2032 * input window.
2033 */
2034 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002035
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002036 /** Adjustment option for {@link #softInputMode}: nothing specified.
2037 * The system will try to pick one or
2038 * the other depending on the contents of the window.
2039 */
2040 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002041
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002042 /** Adjustment option for {@link #softInputMode}: set to allow the
2043 * window to be resized when an input
2044 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07002045 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002046 * {@link #SOFT_INPUT_ADJUST_PAN}; if
2047 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07002048 * the other depending on the contents of the window. If the window's
2049 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
2050 * value for {@link #softInputMode} will be ignored; the window will
2051 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002052 */
2053 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002055 /** Adjustment option for {@link #softInputMode}: set to have a window
2056 * pan when an input method is
2057 * shown, so it doesn't need to deal with resizing but just panned
2058 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07002059 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002060 * neither of these are set, then the system will try to pick one or
2061 * the other depending on the contents of the window.
2062 */
2063 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002064
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002065 /** Adjustment option for {@link #softInputMode}: set to have a window
2066 * not adjust for a shown input method. The window will not be resized,
2067 * and it will not be panned to make its focus visible.
2068 */
2069 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
2070
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002071 /**
2072 * Bit for {@link #softInputMode}: set when the user has navigated
2073 * forward to the window. This is normally set automatically for
2074 * you by the system, though you may want to set it in certain cases
2075 * when you are displaying a window yourself. This flag will always
2076 * be cleared automatically after the window is displayed.
2077 */
2078 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002079
2080 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002081 * An internal annotation for flags that can be specified to {@link #softInputMode}.
2082 *
2083 * @hide
2084 */
2085 @Retention(RetentionPolicy.SOURCE)
Jeff Sharkeyce8db992017-12-13 20:05:05 -07002086 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = {
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002087 SOFT_INPUT_STATE_UNSPECIFIED,
2088 SOFT_INPUT_STATE_UNCHANGED,
2089 SOFT_INPUT_STATE_HIDDEN,
2090 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
2091 SOFT_INPUT_STATE_VISIBLE,
2092 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
2093 SOFT_INPUT_ADJUST_UNSPECIFIED,
2094 SOFT_INPUT_ADJUST_RESIZE,
2095 SOFT_INPUT_ADJUST_PAN,
2096 SOFT_INPUT_ADJUST_NOTHING,
2097 SOFT_INPUT_IS_FORWARD_NAVIGATION,
2098 })
2099 public @interface SoftInputModeFlags {}
2100
2101 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08002102 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002103 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002104 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002105 * <ul>
2106 * <li> One of the visibility states
2107 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002108 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
2109 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002110 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002111 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
2112 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08002113 * </ul>
2114 *
2115 *
2116 * <p>This flag can be controlled in your theme through the
2117 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002118 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08002119 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002120 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002122 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002123 * Placement of window within the screen as per {@link Gravity}. Both
2124 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2125 * android.graphics.Rect) Gravity.apply} and
2126 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2127 * Gravity.applyDisplay} are used during window layout, with this value
2128 * given as the desired gravity. For example you can specify
2129 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
2130 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
2131 * to control the behavior of
2132 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
2133 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002134 *
2135 * @see Gravity
2136 */
2137 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002138
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002139 /**
2140 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002141 * between the container and the widget. See
2142 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2143 * android.graphics.Rect) Gravity.apply} for how this is used. This
2144 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002145 */
2146 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002147
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002148 /**
2149 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002150 * between the container and the widget. See
2151 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
2152 * android.graphics.Rect) Gravity.apply} for how this is used. This
2153 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002154 */
2155 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002156
2157 /**
2158 * Positive insets between the drawing surface and window content.
2159 *
2160 * @hide
2161 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07002162 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08002163
2164 /**
2165 * Whether the surface insets have been manually set. When set to
2166 * {@code false}, the view root will automatically determine the
2167 * appropriate surface insets.
2168 *
2169 * @see #surfaceInsets
2170 * @hide
2171 */
2172 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002173
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07002175 * Whether the previous surface insets should be used vs. what is currently set. When set
2176 * to {@code true}, the view root will ignore surfaces insets in this object and use what
2177 * it currently has.
2178 *
2179 * @see #surfaceInsets
2180 * @hide
2181 */
2182 public boolean preservePreviousSurfaceInsets = true;
2183
2184 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002185 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08002186 * {@link android.graphics.PixelFormat}. The choice of format
2187 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002188 */
2189 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002190
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002191 /**
2192 * A style resource defining the animations to use for this window.
2193 * This must be a system resource; it can not be an application resource
2194 * because the window manager does not have access to applications.
2195 */
2196 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002197
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002198 /**
2199 * An alpha value to apply to this entire window.
2200 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
2201 */
2202 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002204 /**
2205 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
2206 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
2207 * dim.
2208 */
2209 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07002210
2211 /**
2212 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
2213 * indicating that the brightness value is not overridden for this window
2214 * and normal brightness policy should be used.
2215 */
2216 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
2217
2218 /**
2219 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2220 * indicating that the screen or button backlight brightness should be set
2221 * to the lowest value when this window is in front.
2222 */
2223 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
2224
2225 /**
2226 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
2227 * indicating that the screen or button backlight brightness should be set
2228 * to the hightest value when this window is in front.
2229 */
2230 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002231
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002232 /**
2233 * This can be used to override the user's preferred brightness of
2234 * the screen. A value of less than 0, the default, means to use the
2235 * preferred screen brightness. 0 to 1 adjusts the brightness from
2236 * dark to full bright.
2237 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002238 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002240 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002241 * This can be used to override the standard behavior of the button and
2242 * keyboard backlights. A value of less than 0, the default, means to
2243 * use the standard backlight behavior. 0 to 1 adjusts the brightness
2244 * from dark to full bright.
2245 */
2246 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
2247
2248 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07002249 * Unspecified value for {@link #rotationAnimation} indicating
2250 * a lack of preference.
2251 * @hide
2252 */
2253 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
2254
2255 /**
Robert Carr652aae42016-10-17 16:48:14 -07002256 * Value for {@link #rotationAnimation} which specifies that this
2257 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002258 */
2259 public static final int ROTATION_ANIMATION_ROTATE = 0;
2260
2261 /**
Robert Carr652aae42016-10-17 16:48:14 -07002262 * Value for {@link #rotationAnimation} which specifies that this
2263 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002264 */
2265 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
2266
2267 /**
Robert Carr652aae42016-10-17 16:48:14 -07002268 * Value for {@link #rotationAnimation} which specifies that this window
2269 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08002270 */
2271 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
2272
2273 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07002274 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
2275 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07002276 * can't be applied without pausing the screen. For example, this is ideal
2277 * for Camera apps which don't want the viewfinder contents to ever rotate
2278 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
2279 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07002280 */
2281 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
2282
2283 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002284 * Define the exit and entry animations used on this window when the device is rotated.
2285 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08002286 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002287 * by other windows. All other situations default to the
2288 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002289 *
Craig Mautner3c174372013-02-21 17:54:37 -08002290 * @see #ROTATION_ANIMATION_ROTATE
2291 * @see #ROTATION_ANIMATION_CROSSFADE
2292 * @see #ROTATION_ANIMATION_JUMPCUT
2293 */
2294 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
2295
2296 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002297 * Identifier for this window. This will usually be filled in for
2298 * you.
2299 */
2300 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002301
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002302 /**
2303 * Name of the package owning this window.
2304 */
2305 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 /**
2308 * Specific orientation value for a window.
2309 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002310 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
2311 * If not set, a default value of
2312 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002313 * will be used.
2314 */
2315 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08002316
2317 /**
Michael Wright3f145a22014-07-22 19:46:03 -07002318 * The preferred refresh rate for the window.
2319 *
2320 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002321 * is on. The selected refresh rate will be applied to the display's default mode.
2322 *
2323 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07002324 *
2325 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002326 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07002327 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002328 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07002329 public float preferredRefreshRate;
2330
2331 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002332 * Id of the preferred display mode for the window.
2333 * <p>
2334 * This must be one of the supported modes obtained for the display(s) the window is on.
2335 * A value of {@code 0} means no preference.
2336 *
2337 * @see Display#getSupportedModes()
2338 * @see Display.Mode#getModeId()
2339 */
2340 public int preferredDisplayModeId;
2341
2342 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002343 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08002344 *
2345 * @see View#STATUS_BAR_VISIBLE
2346 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08002347 */
2348 public int systemUiVisibility;
2349
2350 /**
Joe Onorato14782f72011-01-25 19:53:17 -08002351 * @hide
2352 * The ui visibility as requested by the views in this hierarchy.
2353 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
2354 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002355 @UnsupportedAppUsage
Joe Onorato14782f72011-01-25 19:53:17 -08002356 public int subtreeSystemUiVisibility;
2357
2358 /**
Joe Onorato664644d2011-01-23 17:53:23 -08002359 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002360 *
Joe Onorato664644d2011-01-23 17:53:23 -08002361 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
2362 *
2363 * @hide
2364 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002365 @UnsupportedAppUsage
Joe Onorato664644d2011-01-23 17:53:23 -08002366 public boolean hasSystemUiListeners;
2367
Adrian Roosfa02da62018-01-15 16:01:18 +01002368
2369 /** @hide */
2370 @Retention(RetentionPolicy.SOURCE)
2371 @IntDef(
2372 flag = true,
2373 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
Adrian Roos87526af2018-03-27 16:36:25 +02002374 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
Adrian Roosfa02da62018-01-15 16:01:18 +01002375 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER})
2376 @interface LayoutInDisplayCutoutMode {}
2377
2378 /**
2379 * Controls how the window is laid out if there is a {@link DisplayCutout}.
2380 *
2381 * <p>
2382 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}.
2383 *
2384 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
Adrian Roos87526af2018-03-27 16:36:25 +02002385 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Adrian Roosfa02da62018-01-15 16:01:18 +01002386 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
2387 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002388 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2389 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002390 */
2391 @LayoutInDisplayCutoutMode
2392 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
2393
2394 /**
2395 * The window is allowed to extend into the {@link DisplayCutout} area, only if the
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002396 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is
Adrian Roosfa02da62018-01-15 16:01:18 +01002397 * laid out such that it does not overlap with the {@link DisplayCutout} area.
2398 *
2399 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002400 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or
2401 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait
2402 * if the cutout is at the top edge. Similarly for
2403 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen.
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002404 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the
Adrian Roosfa02da62018-01-15 16:01:18 +01002405 * cutout area.
2406 *
2407 * <p>
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002408 * The usual precautions for not overlapping with the status and navigation bar are
2409 * sufficient for ensuring that no important content overlaps with the DisplayCutout.
Adrian Roosfa02da62018-01-15 16:01:18 +01002410 *
2411 * @see DisplayCutout
2412 * @see WindowInsets
Adrian Roos87526af2018-03-27 16:36:25 +02002413 * @see #layoutInDisplayCutoutMode
2414 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2415 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002416 */
2417 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;
2418
2419 /**
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002420 * @deprecated use {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES}
2421 * @hide
2422 */
2423 @Deprecated
2424 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 1;
2425
2426 /**
2427 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
2428 * edges of the screen.
2429 *
2430 * The window will never extend into a {@link DisplayCutout} area on the long edges of the
2431 * screen.
Adrian Roosfa02da62018-01-15 16:01:18 +01002432 *
2433 * <p>
2434 * The window must make sure that no important content overlaps with the
2435 * {@link DisplayCutout}.
2436 *
Adrian Roosad1da312018-03-27 19:17:50 +02002437 * <p>
2438 * In this mode, the window extends under cutouts on the short edge of the display in both
2439 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/>
2440 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png"
2441 * height="720"
2442 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in
2443 * portrait, no letterbox is applied."/>
2444 *
2445 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png"
2446 * width="720"
2447 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape,
2448 * no letterbox is applied."/>
2449 *
2450 * <p>
2451 * A cutout in the corner is considered to be on the short edge: <br/>
2452 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png"
2453 * height="720"
2454 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in
2455 * portrait, no letterbox is applied."/>
2456 *
2457 * <p>
2458 * On the other hand, should the cutout be on the long edge of the display, a letterbox will
2459 * be applied such that the window does not extend into the cutout on either long edge:
2460 * <br/>
2461 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png"
2462 * height="720"
2463 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait,
2464 * letterbox is applied."/>
2465 *
Adrian Roosfa02da62018-01-15 16:01:18 +01002466 * @see DisplayCutout
2467 * @see WindowInsets#getDisplayCutout()
Adrian Roos87526af2018-03-27 16:36:25 +02002468 * @see #layoutInDisplayCutoutMode
2469 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2470 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002471 */
Adrian Roos6a4fa0e2018-03-05 19:50:16 +01002472 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1;
Adrian Roosfa02da62018-01-15 16:01:18 +01002473
2474 /**
2475 * The window is never allowed to overlap with the DisplayCutout area.
2476 *
2477 * <p>
Adrian Roos87526af2018-03-27 16:36:25 +02002478 * This should be used with windows that transiently set
2479 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION}
2480 * to avoid a relayout of the window when the respective flag is set or cleared.
Adrian Roosfa02da62018-01-15 16:01:18 +01002481 *
2482 * @see DisplayCutout
Adrian Roos87526af2018-03-27 16:36:25 +02002483 * @see #layoutInDisplayCutoutMode
2484 * @see android.R.attr#windowLayoutInDisplayCutoutMode
2485 * android:windowLayoutInDisplayCutoutMode
Adrian Roosfa02da62018-01-15 16:01:18 +01002486 */
2487 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;
2488
2489
Jeff Brown474dcb52011-06-14 20:22:50 -07002490 /**
2491 * When this window has focus, disable touch pad pointer gesture processing.
2492 * The window will receive raw position updates from the touch pad instead
2493 * of pointer movements and synthetic touch events.
2494 *
2495 * @hide
2496 */
2497 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
2498
2499 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07002500 * Does not construct an input channel for this window. The channel will therefore
2501 * be incapable of receiving input.
2502 *
2503 * @hide
2504 */
2505 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
2506
2507 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002508 * When this window has focus, does not call user activity for all input events so
2509 * the application will have to do it itself. Should only be used by
2510 * the keyguard and phone app.
2511 * <p>
2512 * Should only be used by the keyguard and phone app.
2513 * </p>
2514 *
2515 * @hide
2516 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002517 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002518 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
2519
2520 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07002521 * Control special features of the input subsystem.
2522 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07002523 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07002524 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002525 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07002526 * @hide
2527 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002528 @UnsupportedAppUsage
Jeff Brown474dcb52011-06-14 20:22:50 -07002529 public int inputFeatures;
2530
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002531 /**
2532 * Sets the number of milliseconds before the user activity timeout occurs
2533 * when this window has focus. A value of -1 uses the standard timeout.
2534 * A value of 0 uses the minimum support display timeout.
2535 * <p>
2536 * This property can only be used to reduce the user specified display timeout;
2537 * it can never make the timeout longer than it normally would be.
2538 * </p><p>
2539 * Should only be used by the keyguard and phone app.
2540 * </p>
2541 *
2542 * @hide
2543 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002544 @UnsupportedAppUsage
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002545 public long userActivityTimeout = -1;
2546
Phil Weaver396d5492016-03-22 17:53:50 -07002547 /**
2548 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
2549 * window.
2550 *
2551 * @hide
2552 */
Phil Weaver8583ae82018-02-13 11:01:24 -08002553 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID;
Phil Weaver396d5492016-03-22 17:53:50 -07002554
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002555 /**
2556 * The window title isn't kept in sync with what is displayed in the title bar, so we
2557 * separately track the currently shown title to provide to accessibility.
2558 *
2559 * @hide
2560 */
Alan Viverette39259dd2017-05-25 11:10:46 -04002561 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002562 public CharSequence accessibilityTitle;
2563
Robert Carr70f0d222016-04-10 16:33:08 -07002564 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002565 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07002566 * by the window manager. Useful for transient notifications like toasts
2567 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002568 * is hidden. Must be specified at window creation time. Note that apps
2569 * are not prepared to handle their windows being removed without their
2570 * explicit request and may try to interact with the removed window
2571 * resulting in undefined behavior and crashes. Therefore, we do hide
2572 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07002573 *
2574 * @hide
2575 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01002576 @UnsupportedAppUsage
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002577 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07002578
Romain Guy48327452017-01-23 17:03:35 -08002579 /**
2580 * The color mode requested by this window. The target display may
2581 * not be able to honor the request. When the color mode is not set
2582 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
2583 * pixel format specified in {@link #format}.
2584 *
2585 * @hide
2586 */
2587 @ActivityInfo.ColorMode
Jorim Jaggi484851b2017-09-22 16:03:27 +02002588 private int mColorMode = COLOR_MODE_DEFAULT;
Romain Guy48327452017-01-23 17:03:35 -08002589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002590 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08002591 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002592 type = TYPE_APPLICATION;
2593 format = PixelFormat.OPAQUE;
2594 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002595
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002596 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08002597 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002598 type = _type;
2599 format = PixelFormat.OPAQUE;
2600 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002601
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002602 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08002603 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002604 type = _type;
2605 flags = _flags;
2606 format = PixelFormat.OPAQUE;
2607 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002609 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002610 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002611 type = _type;
2612 flags = _flags;
2613 format = _format;
2614 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002615
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2617 super(w, h);
2618 type = _type;
2619 flags = _flags;
2620 format = _format;
2621 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002623 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2624 int _flags, int _format) {
2625 super(w, h);
2626 x = xpos;
2627 y = ypos;
2628 type = _type;
2629 flags = _flags;
2630 format = _format;
2631 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002633 public final void setTitle(CharSequence title) {
2634 if (null == title)
2635 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002636
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 mTitle = TextUtils.stringOrSpannedString(title);
2638 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002641 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002642 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002643
Wale Ogunwale246c2092016-04-07 14:12:44 -07002644 /**
2645 * Sets the surface insets based on the elevation (visual z position) of the input view.
2646 * @hide
2647 */
2648 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
2649 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07002650 // Partial workaround for b/28318973. Every inset change causes a freeform window
2651 // to jump a little for a few frames. If we never allow surface insets to decrease,
2652 // they will stabilize quickly (often from the very beginning, as most windows start
2653 // as focused).
2654 // TODO(b/22668382) to fix this properly.
2655 if (surfaceInset == 0) {
2656 // OK to have 0 (this is the case for non-freeform windows).
2657 surfaceInsets.set(0, 0, 0, 0);
2658 } else {
2659 surfaceInsets.set(
2660 Math.max(surfaceInset, surfaceInsets.left),
2661 Math.max(surfaceInset, surfaceInsets.top),
2662 Math.max(surfaceInset, surfaceInsets.right),
2663 Math.max(surfaceInset, surfaceInsets.bottom));
2664 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002665 hasManualSurfaceInsets = manual;
2666 preservePreviousSurfaceInsets = preservePrevious;
2667 }
2668
Romain Guy48327452017-01-23 17:03:35 -08002669 /**
2670 * <p>Set the color mode of the window. Setting the color mode might
2671 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
2672 *
2673 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2674 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
2675 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
2676 *
2677 * @see #getColorMode()
2678 */
2679 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
2680 mColorMode = colorMode;
2681 }
2682
2683 /**
2684 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2685 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
2686 *
2687 * @see #setColorMode(int)
2688 */
2689 @ActivityInfo.ColorMode
2690 public int getColorMode() {
2691 return mColorMode;
2692 }
2693
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002694 /** @hide */
2695 @SystemApi
2696 public final void setUserActivityTimeout(long timeout) {
2697 userActivityTimeout = timeout;
2698 }
2699
2700 /** @hide */
2701 @SystemApi
2702 public final long getUserActivityTimeout() {
2703 return userActivityTimeout;
2704 }
2705
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002706 public int describeContents() {
2707 return 0;
2708 }
2709
2710 public void writeToParcel(Parcel out, int parcelableFlags) {
2711 out.writeInt(width);
2712 out.writeInt(height);
2713 out.writeInt(x);
2714 out.writeInt(y);
2715 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002716 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002717 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 out.writeInt(softInputMode);
Adrian Roosfa02da62018-01-15 16:01:18 +01002719 out.writeInt(layoutInDisplayCutoutMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002720 out.writeInt(gravity);
2721 out.writeFloat(horizontalMargin);
2722 out.writeFloat(verticalMargin);
2723 out.writeInt(format);
2724 out.writeInt(windowAnimations);
2725 out.writeFloat(alpha);
2726 out.writeFloat(dimAmount);
2727 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002728 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08002729 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002730 out.writeStrongBinder(token);
2731 out.writeString(packageName);
2732 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
2733 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07002734 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002735 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08002736 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08002737 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08002738 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07002739 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002740 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07002741 out.writeInt(surfaceInsets.left);
2742 out.writeInt(surfaceInsets.top);
2743 out.writeInt(surfaceInsets.right);
2744 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08002745 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07002746 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002747 out.writeInt(needsMenuKey);
Phil Weaver8583ae82018-02-13 11:01:24 -08002748 out.writeLong(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002749 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07002750 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002751 out.writeLong(hideTimeoutMilliseconds);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002753
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07002754 public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 = new Parcelable.Creator<LayoutParams>() {
2756 public LayoutParams createFromParcel(Parcel in) {
2757 return new LayoutParams(in);
2758 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002759
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002760 public LayoutParams[] newArray(int size) {
2761 return new LayoutParams[size];
2762 }
2763 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002764
2765
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002766 public LayoutParams(Parcel in) {
2767 width = in.readInt();
2768 height = in.readInt();
2769 x = in.readInt();
2770 y = in.readInt();
2771 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002772 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002773 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002774 softInputMode = in.readInt();
Adrian Roosfa02da62018-01-15 16:01:18 +01002775 layoutInDisplayCutoutMode = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002776 gravity = in.readInt();
2777 horizontalMargin = in.readFloat();
2778 verticalMargin = in.readFloat();
2779 format = in.readInt();
2780 windowAnimations = in.readInt();
2781 alpha = in.readFloat();
2782 dimAmount = in.readFloat();
2783 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002784 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08002785 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 token = in.readStrongBinder();
2787 packageName = in.readString();
2788 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
2789 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07002790 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002791 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002792 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08002793 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002794 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07002795 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002796 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07002797 surfaceInsets.left = in.readInt();
2798 surfaceInsets.top = in.readInt();
2799 surfaceInsets.right = in.readInt();
2800 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08002801 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07002802 preservePreviousSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002803 needsMenuKey = in.readInt();
Phil Weaver8583ae82018-02-13 11:01:24 -08002804 accessibilityIdOfAnchor = in.readLong();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002805 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07002806 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002807 hideTimeoutMilliseconds = in.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002809
Romain Guy72998072009-06-22 11:09:20 -07002810 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002811 public static final int LAYOUT_CHANGED = 1<<0;
2812 public static final int TYPE_CHANGED = 1<<1;
2813 public static final int FLAGS_CHANGED = 1<<2;
2814 public static final int FORMAT_CHANGED = 1<<3;
2815 public static final int ANIMATION_CHANGED = 1<<4;
2816 public static final int DIM_AMOUNT_CHANGED = 1<<5;
2817 public static final int TITLE_CHANGED = 1<<6;
2818 public static final int ALPHA_CHANGED = 1<<7;
2819 public static final int MEMORY_TYPE_CHANGED = 1<<8;
2820 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
2821 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
2822 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08002823 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002824 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002825 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08002826 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002827 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08002828 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002829 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07002830 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002831 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002832 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002833 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07002834 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002835 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002836 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04002837 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
2838 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07002839 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002840 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07002841 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
2842 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002843 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
2844 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002845 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
2846 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07002847 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
2848 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04002849 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002850 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
2851 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07002852 public static final int COLOR_MODE_CHANGED = 1 << 26;
2853 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07002854 public static final int EVERYTHING_CHANGED = 0xffffffff;
2855
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002856 // internal buffer to backup/restore parameters under compatibility mode.
2857 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002859 public final int copyFrom(LayoutParams o) {
2860 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002861
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 if (width != o.width) {
2863 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07002864 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002865 }
2866 if (height != o.height) {
2867 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07002868 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 }
2870 if (x != o.x) {
2871 x = o.x;
2872 changes |= LAYOUT_CHANGED;
2873 }
2874 if (y != o.y) {
2875 y = o.y;
2876 changes |= LAYOUT_CHANGED;
2877 }
2878 if (horizontalWeight != o.horizontalWeight) {
2879 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002880 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002881 }
2882 if (verticalWeight != o.verticalWeight) {
2883 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002884 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002885 }
2886 if (horizontalMargin != o.horizontalMargin) {
2887 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002888 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002889 }
2890 if (verticalMargin != o.verticalMargin) {
2891 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002892 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002893 }
2894 if (type != o.type) {
2895 type = o.type;
2896 changes |= TYPE_CHANGED;
2897 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002898 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04002899 final int diff = flags ^ o.flags;
2900 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
2901 changes |= TRANSLUCENT_FLAGS_CHANGED;
2902 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002903 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07002904 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002905 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002906 if (privateFlags != o.privateFlags) {
2907 privateFlags = o.privateFlags;
2908 changes |= PRIVATE_FLAGS_CHANGED;
2909 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 if (softInputMode != o.softInputMode) {
2911 softInputMode = o.softInputMode;
2912 changes |= SOFT_INPUT_MODE_CHANGED;
2913 }
Adrian Roosfa02da62018-01-15 16:01:18 +01002914 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) {
2915 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode;
2916 changes |= LAYOUT_CHANGED;
2917 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002918 if (gravity != o.gravity) {
2919 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07002920 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002922 if (format != o.format) {
2923 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07002924 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002925 }
2926 if (windowAnimations != o.windowAnimations) {
2927 windowAnimations = o.windowAnimations;
2928 changes |= ANIMATION_CHANGED;
2929 }
2930 if (token == null) {
2931 // NOTE: token only copied if the recipient doesn't
2932 // already have one.
2933 token = o.token;
2934 }
2935 if (packageName == null) {
2936 // NOTE: packageName only copied if the recipient doesn't
2937 // already have one.
2938 packageName = o.packageName;
2939 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08002940 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002941 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002942 mTitle = o.mTitle;
2943 changes |= TITLE_CHANGED;
2944 }
2945 if (alpha != o.alpha) {
2946 alpha = o.alpha;
2947 changes |= ALPHA_CHANGED;
2948 }
2949 if (dimAmount != o.dimAmount) {
2950 dimAmount = o.dimAmount;
2951 changes |= DIM_AMOUNT_CHANGED;
2952 }
2953 if (screenBrightness != o.screenBrightness) {
2954 screenBrightness = o.screenBrightness;
2955 changes |= SCREEN_BRIGHTNESS_CHANGED;
2956 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002957 if (buttonBrightness != o.buttonBrightness) {
2958 buttonBrightness = o.buttonBrightness;
2959 changes |= BUTTON_BRIGHTNESS_CHANGED;
2960 }
Craig Mautner3c174372013-02-21 17:54:37 -08002961 if (rotationAnimation != o.rotationAnimation) {
2962 rotationAnimation = o.rotationAnimation;
2963 changes |= ROTATION_ANIMATION_CHANGED;
2964 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002965
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 if (screenOrientation != o.screenOrientation) {
2967 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07002968 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 }
Romain Guy529b60a2010-08-03 18:05:47 -07002970
Michael Wright3f145a22014-07-22 19:46:03 -07002971 if (preferredRefreshRate != o.preferredRefreshRate) {
2972 preferredRefreshRate = o.preferredRefreshRate;
2973 changes |= PREFERRED_REFRESH_RATE_CHANGED;
2974 }
2975
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002976 if (preferredDisplayModeId != o.preferredDisplayModeId) {
2977 preferredDisplayModeId = o.preferredDisplayModeId;
2978 changes |= PREFERRED_DISPLAY_MODE_ID;
2979 }
2980
Joe Onorato14782f72011-01-25 19:53:17 -08002981 if (systemUiVisibility != o.systemUiVisibility
2982 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08002983 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08002984 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08002985 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
2986 }
2987
2988 if (hasSystemUiListeners != o.hasSystemUiListeners) {
2989 hasSystemUiListeners = o.hasSystemUiListeners;
2990 changes |= SYSTEM_UI_LISTENER_CHANGED;
2991 }
2992
Jeff Brown474dcb52011-06-14 20:22:50 -07002993 if (inputFeatures != o.inputFeatures) {
2994 inputFeatures = o.inputFeatures;
2995 changes |= INPUT_FEATURES_CHANGED;
2996 }
2997
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002998 if (userActivityTimeout != o.userActivityTimeout) {
2999 userActivityTimeout = o.userActivityTimeout;
3000 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
3001 }
3002
Alan Viverette49a22e82014-07-12 20:01:27 -07003003 if (!surfaceInsets.equals(o.surfaceInsets)) {
3004 surfaceInsets.set(o.surfaceInsets);
3005 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07003006 }
3007
Alan Viverette5435a302015-01-29 10:25:34 -08003008 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
3009 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
3010 changes |= SURFACE_INSETS_CHANGED;
3011 }
3012
Wale Ogunwale246c2092016-04-07 14:12:44 -07003013 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
3014 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
3015 changes |= SURFACE_INSETS_CHANGED;
3016 }
3017
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003018 if (needsMenuKey != o.needsMenuKey) {
3019 needsMenuKey = o.needsMenuKey;
3020 changes |= NEEDS_MENU_KEY_CHANGED;
3021 }
3022
Phil Weaver396d5492016-03-22 17:53:50 -07003023 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
3024 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
3025 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
3026 }
3027
Phil Weaver9be3c7b2016-04-07 15:15:41 -07003028 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
3029 && o.accessibilityTitle != null) {
3030 // NOTE: accessibilityTitle only copied if the originator set one.
3031 accessibilityTitle = o.accessibilityTitle;
3032 changes |= ACCESSIBILITY_TITLE_CHANGED;
3033 }
3034
Romain Guy26a2b972017-04-17 09:39:51 -07003035 if (mColorMode != o.mColorMode) {
3036 mColorMode = o.mColorMode;
3037 changes |= COLOR_MODE_CHANGED;
3038 }
3039
Robert Carr70f0d222016-04-10 16:33:08 -07003040 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07003041 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07003042
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 return changes;
3044 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003046 @Override
3047 public String debug(String output) {
3048 output += "Contents of " + this + ":";
3049 Log.d("Debug", output);
3050 output = super.debug("");
3051 Log.d("Debug", output);
3052 Log.d("Debug", "");
3053 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
3054 return "";
3055 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003057 @Override
3058 public String toString() {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003059 return toString("");
3060 }
3061
3062 /**
3063 * @hide
3064 */
Felipe Lemeda9ea342018-03-22 15:19:51 -07003065 public void dumpDimensions(StringBuilder sb) {
3066 sb.append('(');
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 sb.append(x);
3068 sb.append(',');
3069 sb.append(y);
3070 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08003071 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
3072 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08003074 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
3075 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003076 sb.append(")");
Felipe Lemeda9ea342018-03-22 15:19:51 -07003077 }
3078
3079 /**
3080 * @hide
3081 */
3082 public String toString(String prefix) {
3083 StringBuilder sb = new StringBuilder(256);
3084 sb.append('{');
3085 dumpDimensions(sb);
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003086 if (horizontalMargin != 0) {
3087 sb.append(" hm=");
3088 sb.append(horizontalMargin);
3089 }
3090 if (verticalMargin != 0) {
3091 sb.append(" vm=");
3092 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003093 }
3094 if (gravity != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003095 sb.append(" gr=");
3096 sb.append(Gravity.toString(gravity));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003097 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003098 if (softInputMode != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003099 sb.append(" sim={");
3100 sb.append(softInputModeToString(softInputMode));
3101 sb.append('}');
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003102 }
Adrian Roosfa02da62018-01-15 16:01:18 +01003103 if (layoutInDisplayCutoutMode != 0) {
3104 sb.append(" layoutInDisplayCutoutMode=");
3105 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode));
3106 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003107 sb.append(" ty=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003108 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003109 if (format != PixelFormat.OPAQUE) {
3110 sb.append(" fmt=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003111 sb.append(PixelFormat.formatToString(format));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003112 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003113 if (windowAnimations != 0) {
3114 sb.append(" wanim=0x");
3115 sb.append(Integer.toHexString(windowAnimations));
3116 }
3117 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
3118 sb.append(" or=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003119 sb.append(ActivityInfo.screenOrientationToString(screenOrientation));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003120 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07003121 if (alpha != 1.0f) {
3122 sb.append(" alpha=");
3123 sb.append(alpha);
3124 }
3125 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3126 sb.append(" sbrt=");
3127 sb.append(screenBrightness);
3128 }
3129 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
3130 sb.append(" bbrt=");
3131 sb.append(buttonBrightness);
3132 }
Craig Mautner3c174372013-02-21 17:54:37 -08003133 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
3134 sb.append(" rotAnim=");
Jorim Jaggi484851b2017-09-22 16:03:27 +02003135 sb.append(rotationAnimationToString(rotationAnimation));
Craig Mautner3c174372013-02-21 17:54:37 -08003136 }
Michael Wright3f145a22014-07-22 19:46:03 -07003137 if (preferredRefreshRate != 0) {
3138 sb.append(" preferredRefreshRate=");
3139 sb.append(preferredRefreshRate);
3140 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07003141 if (preferredDisplayModeId != 0) {
3142 sb.append(" preferredDisplayMode=");
3143 sb.append(preferredDisplayModeId);
3144 }
Joe Onorato664644d2011-01-23 17:53:23 -08003145 if (hasSystemUiListeners) {
3146 sb.append(" sysuil=");
3147 sb.append(hasSystemUiListeners);
3148 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003149 if (inputFeatures != 0) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02003150 sb.append(" if=").append(inputFeatureToString(inputFeatures));
Dianne Hackborna44abeb2011-08-08 19:24:01 -07003151 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07003152 if (userActivityTimeout >= 0) {
3153 sb.append(" userActivityTimeout=").append(userActivityTimeout);
3154 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07003155 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07003156 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
3157 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07003158 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08003159 if (hasManualSurfaceInsets) {
3160 sb.append(" (manual)");
3161 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07003162 if (!preservePreviousSurfaceInsets) {
3163 sb.append(" (!preservePreviousSurfaceInsets)");
3164 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07003165 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003166 if (needsMenuKey == NEEDS_MENU_SET_TRUE) {
3167 sb.append(" needsMenuKey");
Wale Ogunwale393b1c12014-10-18 16:22:01 -07003168 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003169 if (mColorMode != COLOR_MODE_DEFAULT) {
3170 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode));
3171 }
3172 sb.append(System.lineSeparator());
3173 sb.append(prefix).append(" fl=").append(
3174 ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
3175 if (privateFlags != 0) {
3176 sb.append(System.lineSeparator());
3177 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString(
3178 LayoutParams.class, "privateFlags", privateFlags));
3179 }
3180 if (systemUiVisibility != 0) {
3181 sb.append(System.lineSeparator());
3182 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString(
3183 View.class, "mSystemUiVisibility", systemUiVisibility));
3184 }
3185 if (subtreeSystemUiVisibility != 0) {
3186 sb.append(System.lineSeparator());
3187 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString(
3188 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility));
3189 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 sb.append('}');
3191 return sb.toString();
3192 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003193
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003194 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07003195 * @hide
3196 */
3197 public void writeToProto(ProtoOutputStream proto, long fieldId) {
3198 final long token = proto.start(fieldId);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003199 proto.write(TYPE, type);
3200 proto.write(X, x);
3201 proto.write(Y, y);
3202 proto.write(WIDTH, width);
3203 proto.write(HEIGHT, height);
3204 proto.write(HORIZONTAL_MARGIN, horizontalMargin);
3205 proto.write(VERTICAL_MARGIN, verticalMargin);
3206 proto.write(GRAVITY, gravity);
3207 proto.write(SOFT_INPUT_MODE, softInputMode);
3208 proto.write(FORMAT, format);
3209 proto.write(WINDOW_ANIMATIONS, windowAnimations);
3210 proto.write(ALPHA, alpha);
3211 proto.write(SCREEN_BRIGHTNESS, screenBrightness);
3212 proto.write(BUTTON_BRIGHTNESS, buttonBrightness);
3213 proto.write(ROTATION_ANIMATION, rotationAnimation);
3214 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate);
3215 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId);
3216 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners);
3217 proto.write(INPUT_FEATURE_FLAGS, inputFeatures);
3218 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout);
3219 proto.write(NEEDS_MENU_KEY, needsMenuKey);
3220 proto.write(COLOR_MODE, mColorMode);
3221 proto.write(FLAGS, flags);
Vishnu Nair1d0fa072018-01-04 07:53:00 -08003222 proto.write(PRIVATE_FLAGS, privateFlags);
3223 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility);
3224 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility);
Steven Timotiusaf03df62017-07-18 16:56:43 -07003225 proto.end(token);
3226 }
3227
3228 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003229 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003230 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003231 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003232 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003233 x = (int) (x * scale + 0.5f);
3234 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003235 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003236 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003237 }
3238 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07003239 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07003240 }
3241 }
3242
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003243 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003244 * Backup the layout parameters used in compatibility mode.
3245 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003246 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003247 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003248 void backup() {
3249 int[] backup = mCompatibilityParamsBackup;
3250 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07003251 // we backup 4 elements, x, y, width, height
3252 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003253 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003254 backup[0] = x;
3255 backup[1] = y;
3256 backup[2] = width;
3257 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003258 }
3259
3260 /**
3261 * Restore the layout params' coordinates, size and gravity
3262 * @see LayoutParams#backup()
3263 */
Mathew Inwooda570dee2018-08-17 14:56:00 +01003264 @UnsupportedAppUsage
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07003265 void restore() {
3266 int[] backup = mCompatibilityParamsBackup;
3267 if (backup != null) {
3268 x = backup[0];
3269 y = backup[1];
3270 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07003271 height = backup[3];
3272 }
3273 }
3274
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08003275 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07003276
3277 /** @hide */
3278 @Override
3279 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
3280 super.encodeProperties(encoder);
3281
3282 encoder.addProperty("x", x);
3283 encoder.addProperty("y", y);
3284 encoder.addProperty("horizontalWeight", horizontalWeight);
3285 encoder.addProperty("verticalWeight", verticalWeight);
3286 encoder.addProperty("type", type);
3287 encoder.addProperty("flags", flags);
3288 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02003289
3290 /**
3291 * @hide
3292 * @return True if the layout parameters will cause the window to cover the full screen;
3293 * false otherwise.
3294 */
3295 public boolean isFullscreen() {
3296 return x == 0 && y == 0
3297 && width == WindowManager.LayoutParams.MATCH_PARENT
3298 && height == WindowManager.LayoutParams.MATCH_PARENT;
3299 }
Jorim Jaggi484851b2017-09-22 16:03:27 +02003300
Adrian Roosfa02da62018-01-15 16:01:18 +01003301 private static String layoutInDisplayCutoutModeToString(
3302 @LayoutInDisplayCutoutMode int mode) {
3303 switch (mode) {
3304 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT:
3305 return "default";
3306 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS:
3307 return "always";
3308 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER:
3309 return "never";
3310 default:
3311 return "unknown(" + mode + ")";
3312 }
3313 }
3314
Jorim Jaggi484851b2017-09-22 16:03:27 +02003315 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) {
3316 final StringBuilder result = new StringBuilder();
3317 final int state = softInputMode & SOFT_INPUT_MASK_STATE;
3318 if (state != 0) {
3319 result.append("state=");
3320 switch (state) {
3321 case SOFT_INPUT_STATE_UNCHANGED:
3322 result.append("unchanged");
3323 break;
3324 case SOFT_INPUT_STATE_HIDDEN:
3325 result.append("hidden");
3326 break;
3327 case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
3328 result.append("always_hidden");
3329 break;
3330 case SOFT_INPUT_STATE_VISIBLE:
3331 result.append("visible");
3332 break;
3333 case SOFT_INPUT_STATE_ALWAYS_VISIBLE:
3334 result.append("always_visible");
3335 break;
3336 default:
3337 result.append(state);
3338 break;
3339 }
3340 result.append(' ');
3341 }
3342 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST;
3343 if (adjust != 0) {
3344 result.append("adjust=");
3345 switch (adjust) {
3346 case SOFT_INPUT_ADJUST_RESIZE:
3347 result.append("resize");
3348 break;
3349 case SOFT_INPUT_ADJUST_PAN:
3350 result.append("pan");
3351 break;
3352 case SOFT_INPUT_ADJUST_NOTHING:
3353 result.append("nothing");
3354 break;
3355 default:
3356 result.append(adjust);
3357 break;
3358 }
3359 result.append(' ');
3360 }
3361 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
3362 result.append("forwardNavigation").append(' ');
3363 }
3364 result.deleteCharAt(result.length() - 1);
3365 return result.toString();
3366 }
3367
3368 private static String rotationAnimationToString(int rotationAnimation) {
3369 switch (rotationAnimation) {
3370 case ROTATION_ANIMATION_UNSPECIFIED:
3371 return "UNSPECIFIED";
3372 case ROTATION_ANIMATION_ROTATE:
3373 return "ROTATE";
3374 case ROTATION_ANIMATION_CROSSFADE:
3375 return "CROSSFADE";
3376 case ROTATION_ANIMATION_JUMPCUT:
3377 return "JUMPCUT";
3378 case ROTATION_ANIMATION_SEAMLESS:
3379 return "SEAMLESS";
3380 default:
3381 return Integer.toString(rotationAnimation);
3382 }
3383 }
3384
3385 private static String inputFeatureToString(int inputFeature) {
3386 switch (inputFeature) {
3387 case INPUT_FEATURE_DISABLE_POINTER_GESTURES:
3388 return "DISABLE_POINTER_GESTURES";
3389 case INPUT_FEATURE_NO_INPUT_CHANNEL:
3390 return "NO_INPUT_CHANNEL";
3391 case INPUT_FEATURE_DISABLE_USER_ACTIVITY:
3392 return "DISABLE_USER_ACTIVITY";
3393 default:
3394 return Integer.toString(inputFeature);
3395 }
3396 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 }
3398}