1 /* 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 17 package android.view; 18 19 import static android.content.pm.ActivityInfo.COLOR_MODE_DEFAULT; 20 import static android.view.WindowInsets.Side.BOTTOM; 21 import static android.view.WindowInsets.Side.LEFT; 22 import static android.view.WindowInsets.Side.RIGHT; 23 import static android.view.WindowInsets.Side.TOP; 24 import static android.view.WindowInsets.Type.CAPTION_BAR; 25 import static android.view.WindowInsets.Type.IME; 26 import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES; 27 import static android.view.WindowInsets.Type.NAVIGATION_BARS; 28 import static android.view.WindowInsets.Type.STATUS_BARS; 29 import static android.view.WindowInsets.Type.SYSTEM_GESTURES; 30 import static android.view.WindowInsets.Type.TAPPABLE_ELEMENT; 31 import static android.view.WindowInsets.Type.WINDOW_DECOR; 32 import static android.view.WindowLayoutParamsProto.ALPHA; 33 import static android.view.WindowLayoutParamsProto.APPEARANCE; 34 import static android.view.WindowLayoutParamsProto.BEHAVIOR; 35 import static android.view.WindowLayoutParamsProto.BUTTON_BRIGHTNESS; 36 import static android.view.WindowLayoutParamsProto.COLOR_MODE; 37 import static android.view.WindowLayoutParamsProto.FIT_IGNORE_VISIBILITY; 38 import static android.view.WindowLayoutParamsProto.FIT_INSETS_SIDES; 39 import static android.view.WindowLayoutParamsProto.FIT_INSETS_TYPES; 40 import static android.view.WindowLayoutParamsProto.FLAGS; 41 import static android.view.WindowLayoutParamsProto.FORMAT; 42 import static android.view.WindowLayoutParamsProto.GRAVITY; 43 import static android.view.WindowLayoutParamsProto.HAS_SYSTEM_UI_LISTENERS; 44 import static android.view.WindowLayoutParamsProto.HEIGHT; 45 import static android.view.WindowLayoutParamsProto.HORIZONTAL_MARGIN; 46 import static android.view.WindowLayoutParamsProto.INPUT_FEATURE_FLAGS; 47 import static android.view.WindowLayoutParamsProto.PREFERRED_REFRESH_RATE; 48 import static android.view.WindowLayoutParamsProto.PRIVATE_FLAGS; 49 import static android.view.WindowLayoutParamsProto.ROTATION_ANIMATION; 50 import static android.view.WindowLayoutParamsProto.SCREEN_BRIGHTNESS; 51 import static android.view.WindowLayoutParamsProto.SOFT_INPUT_MODE; 52 import static android.view.WindowLayoutParamsProto.SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS; 53 import static android.view.WindowLayoutParamsProto.SYSTEM_UI_VISIBILITY_FLAGS; 54 import static android.view.WindowLayoutParamsProto.TYPE; 55 import static android.view.WindowLayoutParamsProto.USER_ACTIVITY_TIMEOUT; 56 import static android.view.WindowLayoutParamsProto.VERTICAL_MARGIN; 57 import static android.view.WindowLayoutParamsProto.WIDTH; 58 import static android.view.WindowLayoutParamsProto.WINDOW_ANIMATIONS; 59 import static android.view.WindowLayoutParamsProto.X; 60 import static android.view.WindowLayoutParamsProto.Y; 61 62 import android.Manifest.permission; 63 import android.annotation.IntDef; 64 import android.annotation.NonNull; 65 import android.annotation.RequiresPermission; 66 import android.annotation.SystemApi; 67 import android.annotation.SystemService; 68 import android.annotation.TestApi; 69 import android.app.KeyguardManager; 70 import android.app.Presentation; 71 import android.compat.annotation.UnsupportedAppUsage; 72 import android.content.Context; 73 import android.content.pm.ActivityInfo; 74 import android.graphics.PixelFormat; 75 import android.graphics.Rect; 76 import android.graphics.Region; 77 import android.os.IBinder; 78 import android.os.Parcel; 79 import android.os.Parcelable; 80 import android.text.TextUtils; 81 import android.util.Log; 82 import android.util.proto.ProtoOutputStream; 83 import android.view.View.OnApplyWindowInsetsListener; 84 import android.view.WindowInsets.Side; 85 import android.view.WindowInsets.Side.InsetsSide; 86 import android.view.WindowInsets.Type; 87 import android.view.WindowInsets.Type.InsetsType; 88 import android.view.accessibility.AccessibilityNodeInfo; 89 90 import java.lang.annotation.Retention; 91 import java.lang.annotation.RetentionPolicy; 92 import java.util.Arrays; 93 import java.util.List; 94 import java.util.Objects; 95 96 /** 97 * The interface that apps use to talk to the window manager. 98 * </p><p> 99 * Each window manager instance is bound to a particular {@link Display}. 100 * To obtain a {@link WindowManager} for a different display, use 101 * {@link Context#createDisplayContext} to obtain a {@link Context} for that 102 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> 103 * to get the WindowManager. 104 * </p><p> 105 * The simplest way to show a window on another display is to create a 106 * {@link Presentation}. The presentation will automatically obtain a 107 * {@link WindowManager} and {@link Context} for that display. 108 * </p> 109 */ 110 @SystemService(Context.WINDOW_SERVICE) 111 public interface WindowManager extends ViewManager { 112 113 /** @hide */ 114 int DOCKED_INVALID = -1; 115 /** @hide */ 116 int DOCKED_LEFT = 1; 117 /** @hide */ 118 int DOCKED_TOP = 2; 119 /** @hide */ 120 int DOCKED_RIGHT = 3; 121 /** @hide */ 122 int DOCKED_BOTTOM = 4; 123 124 /** @hide */ 125 String INPUT_CONSUMER_PIP = "pip_input_consumer"; 126 /** @hide */ 127 String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer"; 128 /** @hide */ 129 String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer"; 130 /** @hide */ 131 String INPUT_CONSUMER_RECENTS_ANIMATION = "recents_animation_input_consumer"; 132 133 /** 134 * Not set up for a transition. 135 * @hide 136 */ 137 int TRANSIT_UNSET = -1; 138 139 /** 140 * No animation for transition. 141 * @hide 142 */ 143 int TRANSIT_NONE = 0; 144 145 /** 146 * A window in a new activity is being opened on top of an existing one in the same task. 147 * @hide 148 */ 149 int TRANSIT_ACTIVITY_OPEN = 6; 150 151 /** 152 * The window in the top-most activity is being closed to reveal the previous activity in the 153 * same task. 154 * @hide 155 */ 156 int TRANSIT_ACTIVITY_CLOSE = 7; 157 158 /** 159 * A window in a new task is being opened on top of an existing one in another activity's task. 160 * @hide 161 */ 162 int TRANSIT_TASK_OPEN = 8; 163 164 /** 165 * A window in the top-most activity is being closed to reveal the previous activity in a 166 * different task. 167 * @hide 168 */ 169 int TRANSIT_TASK_CLOSE = 9; 170 171 /** 172 * A window in an existing task is being displayed on top of an existing one in another 173 * activity's task. 174 * @hide 175 */ 176 int TRANSIT_TASK_TO_FRONT = 10; 177 178 /** 179 * A window in an existing task is being put below all other tasks. 180 * @hide 181 */ 182 int TRANSIT_TASK_TO_BACK = 11; 183 184 /** 185 * A window in a new activity that doesn't have a wallpaper is being opened on top of one that 186 * does, effectively closing the wallpaper. 187 * @hide 188 */ 189 int TRANSIT_WALLPAPER_CLOSE = 12; 190 191 /** 192 * A window in a new activity that does have a wallpaper is being opened on one that didn't, 193 * effectively opening the wallpaper. 194 * @hide 195 */ 196 int TRANSIT_WALLPAPER_OPEN = 13; 197 198 /** 199 * A window in a new activity is being opened on top of an existing one, and both are on top 200 * of the wallpaper. 201 * @hide 202 */ 203 int TRANSIT_WALLPAPER_INTRA_OPEN = 14; 204 205 /** 206 * The window in the top-most activity is being closed to reveal the previous activity, and 207 * both are on top of the wallpaper. 208 * @hide 209 */ 210 int TRANSIT_WALLPAPER_INTRA_CLOSE = 15; 211 212 /** 213 * A window in a new task is being opened behind an existing one in another activity's task. 214 * The new window will show briefly and then be gone. 215 * @hide 216 */ 217 int TRANSIT_TASK_OPEN_BEHIND = 16; 218 219 /** 220 * An activity is being relaunched (e.g. due to configuration change). 221 * @hide 222 */ 223 int TRANSIT_ACTIVITY_RELAUNCH = 18; 224 225 /** 226 * A task is being docked from recents. 227 * @hide 228 */ 229 int TRANSIT_DOCK_TASK_FROM_RECENTS = 19; 230 231 /** 232 * Keyguard is going away. 233 * @hide 234 */ 235 int TRANSIT_KEYGUARD_GOING_AWAY = 20; 236 237 /** 238 * Keyguard is going away with showing an activity behind that requests wallpaper. 239 * @hide 240 */ 241 int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21; 242 243 /** 244 * Keyguard is being occluded. 245 * @hide 246 */ 247 int TRANSIT_KEYGUARD_OCCLUDE = 22; 248 249 /** 250 * Keyguard is being unoccluded. 251 * @hide 252 */ 253 int TRANSIT_KEYGUARD_UNOCCLUDE = 23; 254 255 /** 256 * A translucent activity is being opened. 257 * @hide 258 */ 259 int TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24; 260 261 /** 262 * A translucent activity is being closed. 263 * @hide 264 */ 265 int TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25; 266 267 /** 268 * A crashing activity is being closed. 269 * @hide 270 */ 271 int TRANSIT_CRASHING_ACTIVITY_CLOSE = 26; 272 273 /** 274 * A task is changing windowing modes 275 * @hide 276 */ 277 int TRANSIT_TASK_CHANGE_WINDOWING_MODE = 27; 278 279 /** 280 * A display which can only contain one task is being shown because the first activity is 281 * started or it's being turned on. 282 * @hide 283 */ 284 int TRANSIT_SHOW_SINGLE_TASK_DISPLAY = 28; 285 286 /** 287 * @hide 288 */ 289 @IntDef(prefix = { "TRANSIT_" }, value = { 290 TRANSIT_UNSET, 291 TRANSIT_NONE, 292 TRANSIT_ACTIVITY_OPEN, 293 TRANSIT_ACTIVITY_CLOSE, 294 TRANSIT_TASK_OPEN, 295 TRANSIT_TASK_CLOSE, 296 TRANSIT_TASK_TO_FRONT, 297 TRANSIT_TASK_TO_BACK, 298 TRANSIT_WALLPAPER_CLOSE, 299 TRANSIT_WALLPAPER_OPEN, 300 TRANSIT_WALLPAPER_INTRA_OPEN, 301 TRANSIT_WALLPAPER_INTRA_CLOSE, 302 TRANSIT_TASK_OPEN_BEHIND, 303 TRANSIT_ACTIVITY_RELAUNCH, 304 TRANSIT_DOCK_TASK_FROM_RECENTS, 305 TRANSIT_KEYGUARD_GOING_AWAY, 306 TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, 307 TRANSIT_KEYGUARD_OCCLUDE, 308 TRANSIT_KEYGUARD_UNOCCLUDE, 309 TRANSIT_TRANSLUCENT_ACTIVITY_OPEN, 310 TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE, 311 TRANSIT_CRASHING_ACTIVITY_CLOSE, 312 TRANSIT_TASK_CHANGE_WINDOWING_MODE, 313 TRANSIT_SHOW_SINGLE_TASK_DISPLAY 314 }) 315 @Retention(RetentionPolicy.SOURCE) 316 @interface TransitionType {} 317 318 /** 319 * Transition flag: Keyguard is going away, but keeping the notification shade open 320 * @hide 321 */ 322 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE = 0x1; 323 324 /** 325 * Transition flag: Keyguard is going away, but doesn't want an animation for it 326 * @hide 327 */ 328 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION = 0x2; 329 330 /** 331 * Transition flag: Keyguard is going away while it was showing the system wallpaper. 332 * @hide 333 */ 334 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER = 0x4; 335 336 /** 337 * Transition flag: Keyguard is going away with subtle animation. 338 * @hide 339 */ 340 int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION = 0x8; 341 342 /** 343 * @hide 344 */ 345 @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = { 346 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE, 347 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION, 348 TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER, 349 }) 350 @Retention(RetentionPolicy.SOURCE) 351 @interface TransitionFlags {} 352 353 /** 354 * Remove content mode: Indicates remove content mode is currently not defined. 355 * @hide 356 */ 357 int REMOVE_CONTENT_MODE_UNDEFINED = 0; 358 359 /** 360 * Remove content mode: Indicates that when display is removed, all its activities will be moved 361 * to the primary display and the topmost activity should become focused. 362 * @hide 363 */ 364 int REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY = 1; 365 366 /** 367 * Remove content mode: Indicates that when display is removed, all its stacks and tasks will be 368 * removed, all activities will be destroyed according to the usual lifecycle. 369 * @hide 370 */ 371 int REMOVE_CONTENT_MODE_DESTROY = 2; 372 373 /** 374 * @hide 375 */ 376 @IntDef(prefix = { "REMOVE_CONTENT_MODE_" }, value = { 377 REMOVE_CONTENT_MODE_UNDEFINED, 378 REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY, 379 REMOVE_CONTENT_MODE_DESTROY, 380 }) 381 @interface RemoveContentMode {} 382 383 /** 384 * Exception that is thrown when trying to add view whose 385 * {@link LayoutParams} {@link LayoutParams#token} 386 * is invalid. 387 */ 388 public static class BadTokenException extends RuntimeException { BadTokenException()389 public BadTokenException() { 390 } 391 BadTokenException(String name)392 public BadTokenException(String name) { 393 super(name); 394 } 395 } 396 397 /** 398 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot 399 * be found. See {@link android.app.Presentation} for more information on secondary displays. 400 */ 401 public static class InvalidDisplayException extends RuntimeException { InvalidDisplayException()402 public InvalidDisplayException() { 403 } 404 InvalidDisplayException(String name)405 public InvalidDisplayException(String name) { 406 super(name); 407 } 408 } 409 410 /** 411 * Returns the {@link Display} upon which this {@link WindowManager} instance 412 * will create new windows. 413 * <p> 414 * Despite the name of this method, the display that is returned is not 415 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}). 416 * The returned display could instead be a secondary display that this 417 * window manager instance is managing. Think of it as the display that 418 * this {@link WindowManager} instance uses by default. 419 * </p><p> 420 * To create windows on a different display, you need to obtain a 421 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager} 422 * class documentation for more information.) 423 * </p> 424 * 425 * @return The display that this window manager is managing. 426 * @deprecated Use {@link Context#getDisplay()} instead. 427 */ 428 @Deprecated getDefaultDisplay()429 public Display getDefaultDisplay(); 430 431 /** 432 * Special variation of {@link #removeView} that immediately invokes 433 * the given view hierarchy's {@link View#onDetachedFromWindow() 434 * View.onDetachedFromWindow()} methods before returning. This is not 435 * for normal applications; using it correctly requires great care. 436 * 437 * @param view The view to be removed. 438 */ removeViewImmediate(View view)439 public void removeViewImmediate(View view); 440 441 /** 442 * Returns the {@link WindowMetrics} according to the current system state. 443 * <p> 444 * The metrics describe the size of the area the window would occupy with 445 * {@link LayoutParams#MATCH_PARENT MATCH_PARENT} width and height, and the {@link WindowInsets} 446 * such a window would have. 447 * <p> 448 * The value of this is based on the <b>current</b> windowing state of the system. 449 * 450 * For example, for activities in multi-window mode, the metrics returned are based on the 451 * current bounds that the user has selected for the {@link android.app.Activity Activity}'s 452 * task. 453 * 454 * @see #getMaximumWindowMetrics() 455 * @see WindowMetrics 456 */ getCurrentWindowMetrics()457 default @NonNull WindowMetrics getCurrentWindowMetrics() { 458 throw new UnsupportedOperationException(); 459 } 460 461 /** 462 * Returns the largest {@link WindowMetrics} an app may expect in the current system state. 463 * <p> 464 * The metrics describe the size of the largest potential area the window might occupy with 465 * {@link LayoutParams#MATCH_PARENT MATCH_PARENT} width and height, and the {@link WindowInsets} 466 * such a window would have. 467 * <p> 468 * The value of this is based on the largest <b>potential</b> windowing state of the system. 469 * 470 * For example, for activities in multi-window mode, the metrics returned are based on the 471 * what the bounds would be if the user expanded the {@link android.app.Activity Activity}'s 472 * task to cover the entire screen. 473 * 474 * Note that this might still be smaller than the size of the physical display if certain areas 475 * of the display are not available to windows created in this {@link Context}. 476 * 477 * @see #getMaximumWindowMetrics() 478 * @see WindowMetrics 479 */ getMaximumWindowMetrics()480 default @NonNull WindowMetrics getMaximumWindowMetrics() { 481 throw new UnsupportedOperationException(); 482 } 483 484 /** 485 * Used to asynchronously request Keyboard Shortcuts from the focused window. 486 * 487 * @hide 488 */ 489 public interface KeyboardShortcutsReceiver { 490 /** 491 * Callback used when the focused window keyboard shortcuts are ready to be displayed. 492 * 493 * @param result The keyboard shortcuts to be displayed. 494 */ onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result)495 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result); 496 } 497 498 /** 499 * Message for taking fullscreen screenshot 500 * @hide 501 */ 502 int TAKE_SCREENSHOT_FULLSCREEN = 1; 503 504 /** 505 * Message for taking screenshot of selected region. 506 * @hide 507 */ 508 int TAKE_SCREENSHOT_SELECTED_REGION = 2; 509 510 /** 511 * Message for handling a screenshot flow with an image provided by the caller. 512 * @hide 513 */ 514 int TAKE_SCREENSHOT_PROVIDED_IMAGE = 3; 515 516 /** 517 * Enum listing the possible sources from which a screenshot was originated. Used for logging. 518 * 519 * @hide 520 */ 521 @IntDef({ScreenshotSource.SCREENSHOT_GLOBAL_ACTIONS, 522 ScreenshotSource.SCREENSHOT_KEY_CHORD, 523 ScreenshotSource.SCREENSHOT_KEY_OTHER, 524 ScreenshotSource.SCREENSHOT_OVERVIEW, 525 ScreenshotSource.SCREENSHOT_ACCESSIBILITY_ACTIONS, 526 ScreenshotSource.SCREENSHOT_OTHER}) 527 @interface ScreenshotSource { 528 int SCREENSHOT_GLOBAL_ACTIONS = 0; 529 int SCREENSHOT_KEY_CHORD = 1; 530 int SCREENSHOT_KEY_OTHER = 2; 531 int SCREENSHOT_OVERVIEW = 3; 532 int SCREENSHOT_ACCESSIBILITY_ACTIONS = 4; 533 int SCREENSHOT_OTHER = 5; 534 } 535 536 /** 537 * @hide 538 */ 539 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array"; 540 541 /** 542 * Request for keyboard shortcuts to be retrieved asynchronously. 543 * 544 * @param receiver The callback to be triggered when the result is ready. 545 * 546 * @hide 547 */ requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId)548 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId); 549 550 /** 551 * Return the touch region for the current IME window, or an empty region if there is none. 552 * 553 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no 554 * region or there was an error. 555 * 556 * @hide 557 */ 558 @SystemApi 559 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS) getCurrentImeTouchRegion()560 public Region getCurrentImeTouchRegion(); 561 562 /** 563 * Sets that the display should show its content when non-secure keyguard is shown. 564 * 565 * @param displayId Display ID. 566 * @param shouldShow Indicates that the display should show its content when non-secure keyguard 567 * is shown. 568 * @see KeyguardManager#isDeviceSecure() 569 * @see KeyguardManager#isDeviceLocked() 570 * @hide 571 */ 572 @TestApi setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow)573 default void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) { 574 } 575 576 /** 577 * Sets that the display should show system decors. 578 * <p> 579 * System decors include status bar, navigation bar, launcher. 580 * </p> 581 * 582 * @param displayId The id of the display. 583 * @param shouldShow Indicates that the display should show system decors. 584 * @see #shouldShowSystemDecors(int) 585 * @hide 586 */ 587 @TestApi setShouldShowSystemDecors(int displayId, boolean shouldShow)588 default void setShouldShowSystemDecors(int displayId, boolean shouldShow) { 589 } 590 591 /** 592 * Checks if the display supports showing system decors. 593 * <p> 594 * System decors include status bar, navigation bar, launcher. 595 * </p> 596 * 597 * @param displayId The id of the display. 598 * @see #setShouldShowSystemDecors(int, boolean) 599 * @hide 600 */ 601 @TestApi shouldShowSystemDecors(int displayId)602 default boolean shouldShowSystemDecors(int displayId) { 603 return false; 604 } 605 606 /** 607 * Sets that the display should show IME. 608 * 609 * @param displayId Display ID. 610 * @param shouldShow Indicates that the display should show IME. 611 * @hide 612 */ 613 @TestApi setShouldShowIme(int displayId, boolean shouldShow)614 default void setShouldShowIme(int displayId, boolean shouldShow) { 615 } 616 617 /** 618 * Indicates that the display should show IME. 619 * 620 * @param displayId The id of the display. 621 * @return {@code true} if the display should show IME when an input field becomes 622 * focused on it. 623 * @hide 624 */ 625 @TestApi shouldShowIme(int displayId)626 default boolean shouldShowIme(int displayId) { 627 return false; 628 } 629 630 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable { 631 /** 632 * X position for this window. With the default gravity it is ignored. 633 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or 634 * {@link Gravity#END} it provides an offset from the given edge. 635 */ 636 @ViewDebug.ExportedProperty 637 public int x; 638 639 /** 640 * Y position for this window. With the default gravity it is ignored. 641 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides 642 * an offset from the given edge. 643 */ 644 @ViewDebug.ExportedProperty 645 public int y; 646 647 /** 648 * Indicates how much of the extra space will be allocated horizontally 649 * to the view associated with these LayoutParams. Specify 0 if the view 650 * should not be stretched. Otherwise the extra pixels will be pro-rated 651 * among all views whose weight is greater than 0. 652 */ 653 @ViewDebug.ExportedProperty 654 public float horizontalWeight; 655 656 /** 657 * Indicates how much of the extra space will be allocated vertically 658 * to the view associated with these LayoutParams. Specify 0 if the view 659 * should not be stretched. Otherwise the extra pixels will be pro-rated 660 * among all views whose weight is greater than 0. 661 */ 662 @ViewDebug.ExportedProperty 663 public float verticalWeight; 664 665 /** 666 * The general type of window. There are three main classes of 667 * window types: 668 * <ul> 669 * <li> <strong>Application windows</strong> (ranging from 670 * {@link #FIRST_APPLICATION_WINDOW} to 671 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application 672 * windows. For these types of windows, the {@link #token} must be 673 * set to the token of the activity they are a part of (this will 674 * normally be done for you if {@link #token} is null). 675 * <li> <strong>Sub-windows</strong> (ranging from 676 * {@link #FIRST_SUB_WINDOW} to 677 * {@link #LAST_SUB_WINDOW}) are associated with another top-level 678 * window. For these types of windows, the {@link #token} must be 679 * the token of the window it is attached to. 680 * <li> <strong>System windows</strong> (ranging from 681 * {@link #FIRST_SYSTEM_WINDOW} to 682 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for 683 * use by the system for specific purposes. They should not normally 684 * be used by applications, and a special permission is required 685 * to use them. 686 * </ul> 687 * 688 * @see #TYPE_BASE_APPLICATION 689 * @see #TYPE_APPLICATION 690 * @see #TYPE_APPLICATION_STARTING 691 * @see #TYPE_DRAWN_APPLICATION 692 * @see #TYPE_APPLICATION_PANEL 693 * @see #TYPE_APPLICATION_MEDIA 694 * @see #TYPE_APPLICATION_SUB_PANEL 695 * @see #TYPE_APPLICATION_ATTACHED_DIALOG 696 * @see #TYPE_STATUS_BAR 697 * @see #TYPE_SEARCH_BAR 698 * @see #TYPE_PHONE 699 * @see #TYPE_SYSTEM_ALERT 700 * @see #TYPE_TOAST 701 * @see #TYPE_SYSTEM_OVERLAY 702 * @see #TYPE_PRIORITY_PHONE 703 * @see #TYPE_SYSTEM_DIALOG 704 * @see #TYPE_KEYGUARD_DIALOG 705 * @see #TYPE_SYSTEM_ERROR 706 * @see #TYPE_INPUT_METHOD 707 * @see #TYPE_INPUT_METHOD_DIALOG 708 */ 709 @ViewDebug.ExportedProperty(mapping = { 710 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, 711 to = "BASE_APPLICATION"), 712 @ViewDebug.IntToString(from = TYPE_APPLICATION, 713 to = "APPLICATION"), 714 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, 715 to = "APPLICATION_STARTING"), 716 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION, 717 to = "DRAWN_APPLICATION"), 718 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, 719 to = "APPLICATION_PANEL"), 720 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, 721 to = "APPLICATION_MEDIA"), 722 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, 723 to = "APPLICATION_SUB_PANEL"), 724 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL, 725 to = "APPLICATION_ABOVE_SUB_PANEL"), 726 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, 727 to = "APPLICATION_ATTACHED_DIALOG"), 728 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, 729 to = "APPLICATION_MEDIA_OVERLAY"), 730 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, 731 to = "STATUS_BAR"), 732 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, 733 to = "SEARCH_BAR"), 734 @ViewDebug.IntToString(from = TYPE_PHONE, 735 to = "PHONE"), 736 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, 737 to = "SYSTEM_ALERT"), 738 @ViewDebug.IntToString(from = TYPE_TOAST, 739 to = "TOAST"), 740 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, 741 to = "SYSTEM_OVERLAY"), 742 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, 743 to = "PRIORITY_PHONE"), 744 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, 745 to = "SYSTEM_DIALOG"), 746 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, 747 to = "KEYGUARD_DIALOG"), 748 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, 749 to = "SYSTEM_ERROR"), 750 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, 751 to = "INPUT_METHOD"), 752 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, 753 to = "INPUT_METHOD_DIALOG"), 754 @ViewDebug.IntToString(from = TYPE_WALLPAPER, 755 to = "WALLPAPER"), 756 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, 757 to = "STATUS_BAR_PANEL"), 758 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, 759 to = "SECURE_SYSTEM_OVERLAY"), 760 @ViewDebug.IntToString(from = TYPE_DRAG, 761 to = "DRAG"), 762 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, 763 to = "STATUS_BAR_SUB_PANEL"), 764 @ViewDebug.IntToString(from = TYPE_POINTER, 765 to = "POINTER"), 766 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, 767 to = "NAVIGATION_BAR"), 768 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, 769 to = "VOLUME_OVERLAY"), 770 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, 771 to = "BOOT_PROGRESS"), 772 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER, 773 to = "INPUT_CONSUMER"), 774 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, 775 to = "NAVIGATION_BAR_PANEL"), 776 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, 777 to = "DISPLAY_OVERLAY"), 778 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, 779 to = "MAGNIFICATION_OVERLAY"), 780 @ViewDebug.IntToString(from = TYPE_PRESENTATION, 781 to = "PRESENTATION"), 782 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, 783 to = "PRIVATE_PRESENTATION"), 784 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, 785 to = "VOICE_INTERACTION"), 786 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, 787 to = "VOICE_INTERACTION_STARTING"), 788 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, 789 to = "DOCK_DIVIDER"), 790 @ViewDebug.IntToString(from = TYPE_QS_DIALOG, 791 to = "QS_DIALOG"), 792 @ViewDebug.IntToString(from = TYPE_SCREENSHOT, 793 to = "SCREENSHOT"), 794 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY, 795 to = "APPLICATION_OVERLAY") 796 }) 797 @WindowType 798 public int type; 799 800 /** 801 * Start of window types that represent normal application windows. 802 */ 803 public static final int FIRST_APPLICATION_WINDOW = 1; 804 805 /** 806 * Window type: an application window that serves as the "base" window 807 * of the overall application; all other application windows will 808 * appear on top of it. 809 * In multiuser systems shows only on the owning user's window. 810 */ 811 public static final int TYPE_BASE_APPLICATION = 1; 812 813 /** 814 * Window type: a normal application window. The {@link #token} must be 815 * an Activity token identifying who the window belongs to. 816 * In multiuser systems shows only on the owning user's window. 817 */ 818 public static final int TYPE_APPLICATION = 2; 819 820 /** 821 * Window type: special application window that is displayed while the 822 * application is starting. Not for use by applications themselves; 823 * this is used by the system to display something until the 824 * application can show its own windows. 825 * In multiuser systems shows on all users' windows. 826 */ 827 public static final int TYPE_APPLICATION_STARTING = 3; 828 829 /** 830 * Window type: a variation on TYPE_APPLICATION that ensures the window 831 * manager will wait for this window to be drawn before the app is shown. 832 * In multiuser systems shows only on the owning user's window. 833 */ 834 public static final int TYPE_DRAWN_APPLICATION = 4; 835 836 /** 837 * End of types of application windows. 838 */ 839 public static final int LAST_APPLICATION_WINDOW = 99; 840 841 /** 842 * Start of types of sub-windows. The {@link #token} of these windows 843 * must be set to the window they are attached to. These types of 844 * windows are kept next to their attached window in Z-order, and their 845 * coordinate space is relative to their attached window. 846 */ 847 public static final int FIRST_SUB_WINDOW = 1000; 848 849 /** 850 * Window type: a panel on top of an application window. These windows 851 * appear on top of their attached window. 852 */ 853 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW; 854 855 /** 856 * Window type: window for showing media (such as video). These windows 857 * are displayed behind their attached window. 858 */ 859 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1; 860 861 /** 862 * Window type: a sub-panel on top of an application window. These 863 * windows are displayed on top their attached window and any 864 * {@link #TYPE_APPLICATION_PANEL} panels. 865 */ 866 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2; 867 868 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout 869 * of the window happens as that of a top-level window, <em>not</em> 870 * as a child of its container. 871 */ 872 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3; 873 874 /** 875 * Window type: window for showing overlays on top of media windows. 876 * These windows are displayed between TYPE_APPLICATION_MEDIA and the 877 * application window. They should be translucent to be useful. This 878 * is a big ugly hack so: 879 * @hide 880 */ 881 @UnsupportedAppUsage 882 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4; 883 884 /** 885 * Window type: a above sub-panel on top of an application window and it's 886 * sub-panel windows. These windows are displayed on top of their attached window 887 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels. 888 * @hide 889 */ 890 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5; 891 892 /** 893 * End of types of sub-windows. 894 */ 895 public static final int LAST_SUB_WINDOW = 1999; 896 897 /** 898 * Start of system-specific window types. These are not normally 899 * created by applications. 900 */ 901 public static final int FIRST_SYSTEM_WINDOW = 2000; 902 903 /** 904 * Window type: the status bar. There can be only one status bar 905 * window; it is placed at the top of the screen, and all other 906 * windows are shifted down so they are below it. 907 * In multiuser systems shows on all users' windows. 908 */ 909 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW; 910 911 /** 912 * Window type: the search bar. There can be only one search bar 913 * window; it is placed at the top of the screen. 914 * In multiuser systems shows on all users' windows. 915 */ 916 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1; 917 918 /** 919 * Window type: phone. These are non-application windows providing 920 * user interaction with the phone (in particular incoming calls). 921 * These windows are normally placed above all applications, but behind 922 * the status bar. 923 * In multiuser systems shows on all users' windows. 924 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead. 925 */ 926 @Deprecated 927 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; 928 929 /** 930 * Window type: system window, such as low power alert. These windows 931 * are always on top of application windows. 932 * In multiuser systems shows only on the owning user's window. 933 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead. 934 */ 935 @Deprecated 936 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3; 937 938 /** 939 * Window type: keyguard window. 940 * In multiuser systems shows on all users' windows. 941 * @removed 942 */ 943 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4; 944 945 /** 946 * Window type: transient notifications. 947 * In multiuser systems shows only on the owning user's window. 948 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead. 949 */ 950 @Deprecated 951 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5; 952 953 /** 954 * Window type: system overlay windows, which need to be displayed 955 * on top of everything else. These windows must not take input 956 * focus, or they will interfere with the keyguard. 957 * In multiuser systems shows only on the owning user's window. 958 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead. 959 */ 960 @Deprecated 961 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6; 962 963 /** 964 * Window type: priority phone UI, which needs to be displayed even if 965 * the keyguard is active. These windows must not take input 966 * focus, or they will interfere with the keyguard. 967 * In multiuser systems shows on all users' windows. 968 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead. 969 */ 970 @Deprecated 971 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7; 972 973 /** 974 * Window type: panel that slides out from the status bar 975 * In multiuser systems shows on all users' windows. 976 */ 977 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8; 978 979 /** 980 * Window type: dialogs that the keyguard shows 981 * In multiuser systems shows on all users' windows. 982 */ 983 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9; 984 985 /** 986 * Window type: internal system error windows, appear on top of 987 * everything they can. 988 * In multiuser systems shows only on the owning user's window. 989 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead. 990 */ 991 @Deprecated 992 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10; 993 994 /** 995 * Window type: internal input methods windows, which appear above 996 * the normal UI. Application windows may be resized or panned to keep 997 * the input focus visible while this window is displayed. 998 * In multiuser systems shows only on the owning user's window. 999 */ 1000 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11; 1001 1002 /** 1003 * Window type: internal input methods dialog windows, which appear above 1004 * the current input method window. 1005 * In multiuser systems shows only on the owning user's window. 1006 */ 1007 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12; 1008 1009 /** 1010 * Window type: wallpaper window, placed behind any window that wants 1011 * to sit on top of the wallpaper. 1012 * In multiuser systems shows only on the owning user's window. 1013 */ 1014 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13; 1015 1016 /** 1017 * Window type: panel that slides out from over the status bar 1018 * In multiuser systems shows on all users' windows. 1019 * 1020 * @deprecated This became API by accident and was never intended to be used for 1021 * applications. 1022 */ 1023 @Deprecated 1024 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; 1025 1026 /** 1027 * Window type: secure system overlay windows, which need to be displayed 1028 * on top of everything else. These windows must not take input 1029 * focus, or they will interfere with the keyguard. 1030 * 1031 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the 1032 * system itself is allowed to create these overlays. Applications cannot 1033 * obtain permission to create secure system overlays. 1034 * 1035 * In multiuser systems shows only on the owning user's window. 1036 * @hide 1037 */ 1038 @UnsupportedAppUsage 1039 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15; 1040 1041 /** 1042 * Window type: the drag-and-drop pseudowindow. There is only one 1043 * drag layer (at most), and it is placed on top of all other windows. 1044 * In multiuser systems shows only on the owning user's window. 1045 * @hide 1046 */ 1047 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16; 1048 1049 /** 1050 * Window type: panel that slides out from over the status bar 1051 * In multiuser systems shows on all users' windows. These windows 1052 * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL} 1053 * windows. 1054 * @hide 1055 */ 1056 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17; 1057 1058 /** 1059 * Window type: (mouse) pointer 1060 * In multiuser systems shows on all users' windows. 1061 * @hide 1062 */ 1063 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18; 1064 1065 /** 1066 * Window type: Navigation bar (when distinct from status bar) 1067 * In multiuser systems shows on all users' windows. 1068 * @hide 1069 */ 1070 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19; 1071 1072 /** 1073 * Window type: The volume level overlay/dialog shown when the user 1074 * changes the system volume. 1075 * In multiuser systems shows on all users' windows. 1076 * @hide 1077 */ 1078 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20; 1079 1080 /** 1081 * Window type: The boot progress dialog, goes on top of everything 1082 * in the world. 1083 * In multiuser systems shows on all users' windows. 1084 * @hide 1085 */ 1086 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21; 1087 1088 /** 1089 * Window type to consume input events when the systemUI bars are hidden. 1090 * In multiuser systems shows on all users' windows. 1091 * @hide 1092 */ 1093 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22; 1094 1095 /** 1096 * Window type: Navigation bar panel (when navigation bar is distinct from status bar) 1097 * In multiuser systems shows on all users' windows. 1098 * @hide 1099 */ 1100 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24; 1101 1102 /** 1103 * Window type: Display overlay window. Used to simulate secondary display devices. 1104 * In multiuser systems shows on all users' windows. 1105 * @hide 1106 */ 1107 @UnsupportedAppUsage 1108 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26; 1109 1110 /** 1111 * Window type: Magnification overlay window. Used to highlight the magnified 1112 * portion of a display when accessibility magnification is enabled. 1113 * In multiuser systems shows on all users' windows. 1114 * @hide 1115 */ 1116 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27; 1117 1118 /** 1119 * Window type: Window for Presentation on top of private 1120 * virtual display. 1121 */ 1122 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30; 1123 1124 /** 1125 * Window type: Windows in the voice interaction layer. 1126 * @hide 1127 */ 1128 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31; 1129 1130 /** 1131 * Window type: Windows that are overlaid <em>only</em> by a connected {@link 1132 * android.accessibilityservice.AccessibilityService} for interception of 1133 * user interactions without changing the windows an accessibility service 1134 * can introspect. In particular, an accessibility service can introspect 1135 * only windows that a sighted user can interact with which is they can touch 1136 * these windows or can type into these windows. For example, if there 1137 * is a full screen accessibility overlay that is touchable, the windows 1138 * below it will be introspectable by an accessibility service even though 1139 * they are covered by a touchable window. 1140 */ 1141 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32; 1142 1143 /** 1144 * Window type: Starting window for voice interaction layer. 1145 * @hide 1146 */ 1147 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33; 1148 1149 /** 1150 * Window for displaying a handle used for resizing docked stacks. This window is owned 1151 * by the system process. 1152 * @hide 1153 */ 1154 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34; 1155 1156 /** 1157 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used 1158 * by Quick Settings Tiles. 1159 * @hide 1160 */ 1161 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35; 1162 1163 /** 1164 * Window type: shows directly above the keyguard. The layer is 1165 * reserved for screenshot animation, region selection and UI. 1166 * In multiuser systems shows only on the owning user's window. 1167 * @hide 1168 */ 1169 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36; 1170 1171 /** 1172 * Window type: Window for Presentation on an external display. 1173 * @see android.app.Presentation 1174 * @hide 1175 */ 1176 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37; 1177 1178 /** 1179 * Window type: Application overlay windows are displayed above all activity windows 1180 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW}) 1181 * but below critical system windows like the status bar or IME. 1182 * <p> 1183 * The system may change the position, size, or visibility of these windows at anytime 1184 * to reduce visual clutter to the user and also manage resources. 1185 * <p> 1186 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission. 1187 * <p> 1188 * The system will adjust the importance of processes with this window type to reduce the 1189 * chance of the low-memory-killer killing them. 1190 * <p> 1191 * In multi-user systems shows only on the owning user's screen. 1192 */ 1193 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38; 1194 1195 /** 1196 * Window type: Window for adding accessibility window magnification above other windows. 1197 * This will place the window in the overlay windows. 1198 * @hide 1199 */ 1200 public static final int TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 39; 1201 1202 /** 1203 * Window type: the notification shade and keyguard. There can be only one status bar 1204 * window; it is placed at the top of the screen, and all other 1205 * windows are shifted down so they are below it. 1206 * In multiuser systems shows on all users' windows. 1207 * @hide 1208 */ 1209 public static final int TYPE_NOTIFICATION_SHADE = FIRST_SYSTEM_WINDOW + 40; 1210 1211 /** 1212 * Window type: used to show the status bar in non conventional parts of the screen (i.e. 1213 * the left or the bottom of the screen). 1214 * In multiuser systems shows on all users' windows. 1215 * @hide 1216 */ 1217 public static final int TYPE_STATUS_BAR_ADDITIONAL = FIRST_SYSTEM_WINDOW + 41; 1218 1219 /** 1220 * Similar to TYPE_APPLICATION_OVERLAY, but trusted to overlay other windows since it is 1221 * is coming from the system. 1222 * @hide 1223 */ 1224 // TODO(b/155781676): Remove and replace call points with trustedOverlay when that is ready. 1225 public static final int TYPE_TRUSTED_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 42; 1226 1227 /** 1228 * End of types of system windows. 1229 */ 1230 public static final int LAST_SYSTEM_WINDOW = 2999; 1231 1232 /** 1233 * @hide 1234 * Used internally when there is no suitable type available. 1235 */ 1236 public static final int INVALID_WINDOW_TYPE = -1; 1237 1238 /** 1239 * @hide 1240 */ 1241 @IntDef(prefix = "TYPE_", value = { 1242 TYPE_ACCESSIBILITY_OVERLAY, 1243 TYPE_APPLICATION, 1244 TYPE_APPLICATION_ATTACHED_DIALOG, 1245 TYPE_APPLICATION_MEDIA, 1246 TYPE_APPLICATION_OVERLAY, 1247 TYPE_APPLICATION_PANEL, 1248 TYPE_APPLICATION_STARTING, 1249 TYPE_APPLICATION_SUB_PANEL, 1250 TYPE_BASE_APPLICATION, 1251 TYPE_DRAWN_APPLICATION, 1252 TYPE_INPUT_METHOD, 1253 TYPE_INPUT_METHOD_DIALOG, 1254 TYPE_KEYGUARD, 1255 TYPE_KEYGUARD_DIALOG, 1256 TYPE_PHONE, 1257 TYPE_PRIORITY_PHONE, 1258 TYPE_PRIVATE_PRESENTATION, 1259 TYPE_SEARCH_BAR, 1260 TYPE_STATUS_BAR, 1261 TYPE_STATUS_BAR_PANEL, 1262 TYPE_SYSTEM_ALERT, 1263 TYPE_SYSTEM_DIALOG, 1264 TYPE_SYSTEM_ERROR, 1265 TYPE_SYSTEM_OVERLAY, 1266 TYPE_TOAST, 1267 TYPE_WALLPAPER, 1268 }) 1269 @Retention(RetentionPolicy.SOURCE) 1270 public @interface WindowType {} 1271 1272 /** 1273 * Return true if the window type is an alert window. 1274 * 1275 * @param type The window type. 1276 * @return If the window type is an alert window. 1277 * @hide 1278 */ isSystemAlertWindowType(@indowType int type)1279 public static boolean isSystemAlertWindowType(@WindowType int type) { 1280 switch (type) { 1281 case TYPE_PHONE: 1282 case TYPE_PRIORITY_PHONE: 1283 case TYPE_SYSTEM_ALERT: 1284 case TYPE_SYSTEM_ERROR: 1285 case TYPE_SYSTEM_OVERLAY: 1286 case TYPE_APPLICATION_OVERLAY: 1287 return true; 1288 } 1289 return false; 1290 } 1291 1292 /** @deprecated this is ignored, this value is set automatically when needed. */ 1293 @Deprecated 1294 public static final int MEMORY_TYPE_NORMAL = 0; 1295 /** @deprecated this is ignored, this value is set automatically when needed. */ 1296 @Deprecated 1297 public static final int MEMORY_TYPE_HARDWARE = 1; 1298 /** @deprecated this is ignored, this value is set automatically when needed. */ 1299 @Deprecated 1300 public static final int MEMORY_TYPE_GPU = 2; 1301 /** @deprecated this is ignored, this value is set automatically when needed. */ 1302 @Deprecated 1303 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; 1304 1305 /** 1306 * @deprecated this is ignored 1307 */ 1308 @Deprecated 1309 public int memoryType; 1310 1311 /** Window flag: as long as this window is visible to the user, allow 1312 * the lock screen to activate while the screen is on. 1313 * This can be used independently, or in combination with 1314 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */ 1315 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001; 1316 1317 /** Window flag: everything behind this window will be dimmed. 1318 * Use {@link #dimAmount} to control the amount of dim. */ 1319 public static final int FLAG_DIM_BEHIND = 0x00000002; 1320 1321 /** Window flag: blur everything behind this window. 1322 * @deprecated Blurring is no longer supported. */ 1323 @Deprecated 1324 public static final int FLAG_BLUR_BEHIND = 0x00000004; 1325 1326 /** Window flag: this window won't ever get key input focus, so the 1327 * user can not send key or other button events to it. Those will 1328 * instead go to whatever focusable window is behind it. This flag 1329 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that 1330 * is explicitly set. 1331 * 1332 * <p>Setting this flag also implies that the window will not need to 1333 * interact with 1334 * a soft input method, so it will be Z-ordered and positioned 1335 * independently of any active input method (typically this means it 1336 * gets Z-ordered on top of the input method, so it can use the full 1337 * screen for its content and cover the input method if needed. You 1338 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */ 1339 public static final int FLAG_NOT_FOCUSABLE = 0x00000008; 1340 1341 /** Window flag: this window can never receive touch events. */ 1342 public static final int FLAG_NOT_TOUCHABLE = 0x00000010; 1343 1344 /** Window flag: even when this window is focusable (its 1345 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events 1346 * outside of the window to be sent to the windows behind it. Otherwise 1347 * it will consume all pointer events itself, regardless of whether they 1348 * are inside of the window. */ 1349 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020; 1350 1351 /** Window flag: when set, if the device is asleep when the touch 1352 * screen is pressed, you will receive this first touch event. Usually 1353 * the first touch event is consumed by the system since the user can 1354 * not see what they are pressing on. 1355 * 1356 * @deprecated This flag has no effect. 1357 */ 1358 @Deprecated 1359 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040; 1360 1361 /** Window flag: as long as this window is visible to the user, keep 1362 * the device's screen turned on and bright. */ 1363 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080; 1364 1365 /** 1366 * Window flag for attached windows: Place the window within the entire screen, ignoring 1367 * any constraints from the parent window. 1368 * 1369 * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed 1370 * such that it avoids the {@link DisplayCutout} area if necessary according to the 1371 * {@link #layoutInDisplayCutoutMode}. 1372 */ 1373 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100; 1374 1375 /** Window flag: allow window to extend outside of the screen. */ 1376 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200; 1377 1378 /** 1379 * Window flag: hide all screen decorations (such as the status bar) while 1380 * this window is displayed. This allows the window to use the entire 1381 * display space for itself -- the status bar will be hidden when 1382 * an app window with this flag set is on the top layer. A fullscreen window 1383 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's 1384 * {@link #softInputMode} field; the window will stay fullscreen 1385 * and will not resize. 1386 * 1387 * <p>This flag can be controlled in your theme through the 1388 * {@link android.R.attr#windowFullscreen} attribute; this attribute 1389 * is automatically set for you in the standard fullscreen themes 1390 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen}, 1391 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen}, 1392 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen}, 1393 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen}, 1394 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen}, 1395 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and 1396 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p> 1397 * 1398 * @deprecated Use {@link WindowInsetsController#hide(int)} with {@link Type#statusBars()} 1399 * instead. 1400 */ 1401 @Deprecated 1402 public static final int FLAG_FULLSCREEN = 0x00000400; 1403 1404 /** 1405 * Window flag: override {@link #FLAG_FULLSCREEN} and force the 1406 * screen decorations (such as the status bar) to be shown. 1407 * 1408 * @deprecated This value became API "by accident", and shouldn't be used by 3rd party 1409 * applications. 1410 */ 1411 @Deprecated 1412 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; 1413 1414 /** Window flag: turn on dithering when compositing this window to 1415 * the screen. 1416 * @deprecated This flag is no longer used. */ 1417 @Deprecated 1418 public static final int FLAG_DITHER = 0x00001000; 1419 1420 /** Window flag: treat the content of the window as secure, preventing 1421 * it from appearing in screenshots or from being viewed on non-secure 1422 * displays. 1423 * 1424 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about 1425 * secure surfaces and secure displays. 1426 */ 1427 public static final int FLAG_SECURE = 0x00002000; 1428 1429 /** Window flag: a special mode where the layout parameters are used 1430 * to perform scaling of the surface when it is composited to the 1431 * screen. */ 1432 public static final int FLAG_SCALED = 0x00004000; 1433 1434 /** Window flag: intended for windows that will often be used when the user is 1435 * holding the screen against their face, it will aggressively filter the event 1436 * stream to prevent unintended presses in this situation that may not be 1437 * desired for a particular window, when such an event stream is detected, the 1438 * application will receive a CANCEL motion event to indicate this so applications 1439 * can handle this accordingly by taking no action on the event 1440 * until the finger is released. */ 1441 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000; 1442 1443 /** 1444 * Window flag: a special option only for use in combination with 1445 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the 1446 * screen your window may appear on top of or behind screen decorations 1447 * such as the status bar. By also including this flag, the window 1448 * manager will report the inset rectangle needed to ensure your 1449 * content is not covered by screen decorations. This flag is normally 1450 * set for you by Window as described in {@link Window#setFlags} 1451 * 1452 * @deprecated Insets will always be delivered to your application. 1453 */ 1454 @Deprecated 1455 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; 1456 1457 /** Window flag: when set, inverts the input method focusability of the window. 1458 * 1459 * The effect of setting this flag depends on whether {@link #FLAG_NOT_FOCUSABLE} is set: 1460 * <p> 1461 * If {@link #FLAG_NOT_FOCUSABLE} is <em>not</em> set, i.e. when the window is focusable, 1462 * setting this flag prevents this window from becoming the target of the input method. 1463 * Consequently, it will <em>not</em> be able to interact with the input method, 1464 * and will be layered above the input method (unless there is another input method 1465 * target above it). 1466 * 1467 * <p> 1468 * If {@link #FLAG_NOT_FOCUSABLE} <em>is</em> set, setting this flag requests for the window 1469 * to be the input method target even though the window is <em>not</em> focusable. 1470 * Consequently, it will be layered below the input method. 1471 * Note: Windows that set {@link #FLAG_NOT_FOCUSABLE} cannot interact with the input method, 1472 * regardless of this flag. 1473 */ 1474 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; 1475 1476 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you 1477 * can set this flag to receive a single special MotionEvent with 1478 * the action 1479 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for 1480 * touches that occur outside of your window. Note that you will not 1481 * receive the full down/move/up gesture, only the location of the 1482 * first down as an ACTION_OUTSIDE. 1483 */ 1484 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000; 1485 1486 /** Window flag: special flag to let windows be shown when the screen 1487 * is locked. This will let application windows take precedence over 1488 * key guard or any other lock screens. Can be used with 1489 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows 1490 * directly before showing the key guard window. Can be used with 1491 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss 1492 * non-secure keyguards. This flag only applies to the top-most 1493 * full-screen window. 1494 * @deprecated Use {@link android.R.attr#showWhenLocked} or 1495 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an 1496 * unintentional double life-cycle event. 1497 */ 1498 @Deprecated 1499 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000; 1500 1501 /** Window flag: ask that the system wallpaper be shown behind 1502 * your window. The window surface must be translucent to be able 1503 * to actually see the wallpaper behind it; this flag just ensures 1504 * that the wallpaper surface will be there if this window actually 1505 * has translucent regions. 1506 * 1507 * <p>This flag can be controlled in your theme through the 1508 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute 1509 * is automatically set for you in the standard wallpaper themes 1510 * such as {@link android.R.style#Theme_Wallpaper}, 1511 * {@link android.R.style#Theme_Wallpaper_NoTitleBar}, 1512 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen}, 1513 * {@link android.R.style#Theme_Holo_Wallpaper}, 1514 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar}, 1515 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and 1516 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p> 1517 */ 1518 public static final int FLAG_SHOW_WALLPAPER = 0x00100000; 1519 1520 /** Window flag: when set as a window is being added or made 1521 * visible, once the window has been shown then the system will 1522 * poke the power manager's user activity (as if the user had woken 1523 * up the device) to turn the screen on. 1524 * @deprecated Use {@link android.R.attr#turnScreenOn} or 1525 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an 1526 * unintentional double life-cycle event. 1527 */ 1528 @Deprecated 1529 public static final int FLAG_TURN_SCREEN_ON = 0x00200000; 1530 1531 /** 1532 * Window flag: when set the window will cause the keyguard to be 1533 * dismissed, only if it is not a secure lock keyguard. Because such a 1534 * keyguard is not needed for security, it will never re-appear if the 1535 * user navigates to another window (in contrast to 1536 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both 1537 * secure and non-secure keyguards but ensure they reappear when the 1538 * user moves to another UI that doesn't hide them). If the keyguard is 1539 * currently active and is secure (requires an unlock credential) than 1540 * the user will still need to confirm it before seeing this window, 1541 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set. 1542 * 1543 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or 1544 * {@link KeyguardManager#requestDismissKeyguard} instead. 1545 * Since keyguard was dismissed all the time as long as an 1546 * activity with this flag on its window was focused, 1547 * keyguard couldn't guard against unintentional touches on 1548 * the screen, which isn't desired. 1549 */ 1550 @Deprecated 1551 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000; 1552 1553 /** Window flag: when set the window will accept for touch events 1554 * outside of its bounds to be sent to other windows that also 1555 * support split touch. When this flag is not set, the first pointer 1556 * that goes down determines the window to which all subsequent touches 1557 * go until all pointers go up. When this flag is set, each pointer 1558 * (not necessarily the first) that goes down determines the window 1559 * to which all subsequent touches of that pointer will go until that 1560 * pointer goes up thereby enabling touches with multiple pointers 1561 * to be split across multiple windows. 1562 */ 1563 public static final int FLAG_SPLIT_TOUCH = 0x00800000; 1564 1565 /** 1566 * <p>Indicates whether this window should be hardware accelerated. 1567 * Requesting hardware acceleration does not guarantee it will happen.</p> 1568 * 1569 * <p>This flag can be controlled programmatically <em>only</em> to enable 1570 * hardware acceleration. To enable hardware acceleration for a given 1571 * window programmatically, do the following:</p> 1572 * 1573 * <pre> 1574 * Window w = activity.getWindow(); // in Activity's onCreate() for instance 1575 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, 1576 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); 1577 * </pre> 1578 * 1579 * <p>It is important to remember that this flag <strong>must</strong> 1580 * be set before setting the content view of your activity or dialog.</p> 1581 * 1582 * <p>This flag cannot be used to disable hardware acceleration after it 1583 * was enabled in your manifest using 1584 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively 1585 * and programmatically disable hardware acceleration (for automated testing 1586 * for instance), make sure it is turned off in your manifest and enable it 1587 * on your activity or dialog when you need it instead, using the method 1588 * described above.</p> 1589 * 1590 * <p>This flag is automatically set by the system if the 1591 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated} 1592 * XML attribute is set to true on an activity or on the application.</p> 1593 */ 1594 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000; 1595 1596 /** 1597 * Window flag: allow window contents to extend in to the screen's 1598 * overscan area, if there is one. The window should still correctly 1599 * position its contents to take the overscan area into account. 1600 * 1601 * <p>This flag can be controlled in your theme through the 1602 * {@link android.R.attr#windowOverscan} attribute; this attribute 1603 * is automatically set for you in the standard overscan themes 1604 * such as 1605 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan}, 1606 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan}, 1607 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and 1608 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p> 1609 * 1610 * <p>When this flag is enabled for a window, its normal content may be obscured 1611 * to some degree by the overscan region of the display. To ensure key parts of 1612 * that content are visible to the user, you can use 1613 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)} 1614 * to set the point in the view hierarchy where the appropriate offsets should 1615 * be applied. (This can be done either by directly calling this function, using 1616 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy, 1617 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect) 1618 * View.fitSystemWindows(Rect)} method).</p> 1619 * 1620 * <p>This mechanism for positioning content elements is identical to its equivalent 1621 * use with layout and {@link View#setSystemUiVisibility(int) 1622 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly 1623 * position its UI elements with this overscan flag is set:</p> 1624 * 1625 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete} 1626 * 1627 * @deprecated Overscan areas aren't set by any Android product anymore as of Android 11. 1628 */ 1629 @Deprecated 1630 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000; 1631 1632 /** 1633 * Window flag: request a translucent status bar with minimal system-provided 1634 * background protection. 1635 * 1636 * <p>This flag can be controlled in your theme through the 1637 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute 1638 * is automatically set for you in the standard translucent decor themes 1639 * such as 1640 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor}, 1641 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor}, 1642 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and 1643 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p> 1644 * 1645 * <p>When this flag is enabled for a window, it automatically sets 1646 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and 1647 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p> 1648 * 1649 * <p>Note: For devices that support 1650 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag may be ignored. 1651 * 1652 * @deprecated Use {@link Window#setStatusBarColor(int)} with a half-translucent color 1653 * instead. 1654 */ 1655 @Deprecated 1656 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000; 1657 1658 /** 1659 * Window flag: request a translucent navigation bar with minimal system-provided 1660 * background protection. 1661 * 1662 * <p>This flag can be controlled in your theme through the 1663 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute 1664 * is automatically set for you in the standard translucent decor themes 1665 * such as 1666 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor}, 1667 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor}, 1668 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and 1669 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p> 1670 * 1671 * <p>When this flag is enabled for a window, it automatically sets 1672 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and 1673 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p> 1674 * 1675 * <p>Note: For devices that support 1676 * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag can be disabled 1677 * by the car manufacturers. 1678 * 1679 * @deprecated Use {@link Window#setNavigationBarColor(int)} with a half-translucent color 1680 * instead. 1681 */ 1682 @Deprecated 1683 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000; 1684 1685 /** 1686 * Flag for a window in local focus mode. 1687 * Window in local focus mode can control focus independent of window manager using 1688 * {@link Window#setLocalFocus(boolean, boolean)}. 1689 * Usually window in this mode will not get touch/key events from window manager, but will 1690 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}. 1691 */ 1692 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000; 1693 1694 /** Window flag: Enable touches to slide out of a window into neighboring 1695 * windows in mid-gesture instead of being captured for the duration of 1696 * the gesture. 1697 * 1698 * This flag changes the behavior of touch focus for this window only. 1699 * Touches can slide out of the window but they cannot necessarily slide 1700 * back in (unless the other window with touch focus permits it). 1701 * 1702 * {@hide} 1703 */ 1704 @UnsupportedAppUsage 1705 public static final int FLAG_SLIPPERY = 0x20000000; 1706 1707 /** 1708 * Window flag: When requesting layout with an attached window, the attached window may 1709 * overlap with the screen decorations of the parent window such as the navigation bar. By 1710 * including this flag, the window manager will layout the attached window within the decor 1711 * frame of the parent window such that it doesn't overlap with screen decorations. 1712 * 1713 * @deprecated Use {@link #setFitInsetsTypes(int)} to determine whether the attached 1714 * window will overlap with system bars. 1715 */ 1716 @Deprecated 1717 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000; 1718 1719 /** 1720 * Flag indicating that this Window is responsible for drawing the background for the 1721 * system bars. If set, the system bars are drawn with a transparent background and the 1722 * corresponding areas in this window are filled with the colors specified in 1723 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}. 1724 */ 1725 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000; 1726 1727 /** 1728 * Various behavioral options/flags. Default is none. 1729 * 1730 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON 1731 * @see #FLAG_DIM_BEHIND 1732 * @see #FLAG_NOT_FOCUSABLE 1733 * @see #FLAG_NOT_TOUCHABLE 1734 * @see #FLAG_NOT_TOUCH_MODAL 1735 * @see #FLAG_TOUCHABLE_WHEN_WAKING 1736 * @see #FLAG_KEEP_SCREEN_ON 1737 * @see #FLAG_LAYOUT_IN_SCREEN 1738 * @see #FLAG_LAYOUT_NO_LIMITS 1739 * @see #FLAG_FULLSCREEN 1740 * @see #FLAG_FORCE_NOT_FULLSCREEN 1741 * @see #FLAG_SECURE 1742 * @see #FLAG_SCALED 1743 * @see #FLAG_IGNORE_CHEEK_PRESSES 1744 * @see #FLAG_LAYOUT_INSET_DECOR 1745 * @see #FLAG_ALT_FOCUSABLE_IM 1746 * @see #FLAG_WATCH_OUTSIDE_TOUCH 1747 * @see #FLAG_SHOW_WHEN_LOCKED 1748 * @see #FLAG_SHOW_WALLPAPER 1749 * @see #FLAG_TURN_SCREEN_ON 1750 * @see #FLAG_DISMISS_KEYGUARD 1751 * @see #FLAG_SPLIT_TOUCH 1752 * @see #FLAG_HARDWARE_ACCELERATED 1753 * @see #FLAG_LOCAL_FOCUS_MODE 1754 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS 1755 */ 1756 @ViewDebug.ExportedProperty(flagMapping = { 1757 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, 1758 name = "ALLOW_LOCK_WHILE_SCREEN_ON"), 1759 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND, 1760 name = "DIM_BEHIND"), 1761 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND, 1762 name = "BLUR_BEHIND"), 1763 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE, 1764 name = "NOT_FOCUSABLE"), 1765 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE, 1766 name = "NOT_TOUCHABLE"), 1767 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL, 1768 name = "NOT_TOUCH_MODAL"), 1769 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING, 1770 name = "TOUCHABLE_WHEN_WAKING"), 1771 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON, 1772 name = "KEEP_SCREEN_ON"), 1773 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN, 1774 name = "LAYOUT_IN_SCREEN"), 1775 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS, 1776 name = "LAYOUT_NO_LIMITS"), 1777 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN, 1778 name = "FULLSCREEN"), 1779 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN, 1780 name = "FORCE_NOT_FULLSCREEN"), 1781 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER, 1782 name = "DITHER"), 1783 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE, 1784 name = "SECURE"), 1785 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED, 1786 name = "SCALED"), 1787 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES, 1788 name = "IGNORE_CHEEK_PRESSES"), 1789 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR, 1790 name = "LAYOUT_INSET_DECOR"), 1791 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM, 1792 name = "ALT_FOCUSABLE_IM"), 1793 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH, 1794 name = "WATCH_OUTSIDE_TOUCH"), 1795 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED, 1796 name = "SHOW_WHEN_LOCKED"), 1797 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER, 1798 name = "SHOW_WALLPAPER"), 1799 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON, 1800 name = "TURN_SCREEN_ON"), 1801 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD, 1802 name = "DISMISS_KEYGUARD"), 1803 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH, 1804 name = "SPLIT_TOUCH"), 1805 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED, 1806 name = "HARDWARE_ACCELERATED"), 1807 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_OVERSCAN, equals = FLAG_LAYOUT_IN_OVERSCAN, 1808 name = "LOCAL_FOCUS_MODE"), 1809 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS, 1810 name = "TRANSLUCENT_STATUS"), 1811 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION, 1812 name = "TRANSLUCENT_NAVIGATION"), 1813 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE, 1814 name = "LOCAL_FOCUS_MODE"), 1815 @ViewDebug.FlagToString(mask = FLAG_SLIPPERY, equals = FLAG_SLIPPERY, 1816 name = "FLAG_SLIPPERY"), 1817 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_ATTACHED_IN_DECOR, equals = FLAG_LAYOUT_ATTACHED_IN_DECOR, 1818 name = "FLAG_LAYOUT_ATTACHED_IN_DECOR"), 1819 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, 1820 name = "DRAWS_SYSTEM_BAR_BACKGROUNDS") 1821 }, formatToHexString = true) 1822 public int flags; 1823 1824 /** 1825 * If the window has requested hardware acceleration, but this is not 1826 * allowed in the process it is in, then still render it as if it is 1827 * hardware accelerated. This is used for the starting preview windows 1828 * in the system process, which don't need to have the overhead of 1829 * hardware acceleration (they are just a static rendering), but should 1830 * be rendered as such to match the actual window of the app even if it 1831 * is hardware accelerated. 1832 * Even if the window isn't hardware accelerated, still do its rendering 1833 * as if it was. 1834 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows 1835 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration 1836 * is generally disabled. This flag must be specified in addition to 1837 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system 1838 * windows. 1839 * 1840 * @hide 1841 */ 1842 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001; 1843 1844 /** 1845 * In the system process, we globally do not use hardware acceleration 1846 * because there are many threads doing UI there and they conflict. 1847 * If certain parts of the UI that really do want to use hardware 1848 * acceleration, this flag can be set to force it. This is basically 1849 * for the lock screen. Anyone else using it, you are probably wrong. 1850 * 1851 * @hide 1852 */ 1853 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002; 1854 1855 /** 1856 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers 1857 * may elect to skip these notifications if they are not doing anything productive with 1858 * them (they do not affect the wallpaper scrolling operation) by calling 1859 * {@link 1860 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}. 1861 * 1862 * @hide 1863 */ 1864 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004; 1865 1866 /** In a multiuser system if this flag is set and the owner is a system process then this 1867 * window will appear on all user screens. This overrides the default behavior of window 1868 * types that normally only appear on the owning user's screen. Refer to each window type 1869 * to determine its default behavior. 1870 * 1871 * {@hide} */ 1872 @SystemApi 1873 @RequiresPermission(permission.INTERNAL_SYSTEM_WINDOW) 1874 public static final int SYSTEM_FLAG_SHOW_FOR_ALL_USERS = 0x00000010; 1875 1876 /** 1877 * Never animate position changes of the window. 1878 * 1879 * {@hide} 1880 */ 1881 @UnsupportedAppUsage 1882 @TestApi 1883 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040; 1884 1885 /** Window flag: special flag to limit the size of the window to be 1886 * original size ([320x480] x density). Used to create window for applications 1887 * running under compatibility mode. 1888 * 1889 * {@hide} */ 1890 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080; 1891 1892 /** Window flag: a special option intended for system dialogs. When 1893 * this flag is set, the window will demand focus unconditionally when 1894 * it is created. 1895 * {@hide} */ 1896 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100; 1897 1898 /** 1899 * Flag that prevents the wallpaper behind the current window from receiving touch events. 1900 * 1901 * {@hide} 1902 */ 1903 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800; 1904 1905 /** 1906 * Flag to force the status bar window to be visible all the time. If the bar is hidden when 1907 * this flag is set it will be shown again. 1908 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}. 1909 * 1910 * {@hide} 1911 */ 1912 public static final int PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR = 0x00001000; 1913 1914 /** 1915 * Flag indicating that the x, y, width, and height members should be 1916 * ignored (and thus their previous value preserved). For example 1917 * because they are being managed externally through repositionChild. 1918 * 1919 * {@hide} 1920 */ 1921 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000; 1922 1923 /** 1924 * Flag that will make window ignore app visibility and instead depend purely on the decor 1925 * view visibility for determining window visibility. This is used by recents to keep 1926 * drawing after it launches an app. 1927 * @hide 1928 */ 1929 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000; 1930 1931 /** 1932 * Flag to indicate that this window is not expected to be replaced across 1933 * configuration change triggered activity relaunches. In general the WindowManager 1934 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces 1935 * until the replacement is ready to show in order to prevent visual glitch. However 1936 * some windows, such as PopupWindows expect to be cleared across configuration change, 1937 * and thus should hint to the WindowManager that it should not wait for a replacement. 1938 * @hide 1939 */ 1940 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000; 1941 1942 /** 1943 * Flag to indicate that this child window should always be laid-out in the parent 1944 * frame regardless of the current windowing mode configuration. 1945 * @hide 1946 */ 1947 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000; 1948 1949 /** 1950 * Flag to indicate that this window is always drawing the status bar background, no matter 1951 * what the other flags are. 1952 * @hide 1953 */ 1954 public static final int PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS = 0x00020000; 1955 1956 /** 1957 * Flag to indicate that this window needs Sustained Performance Mode if 1958 * the device supports it. 1959 * @hide 1960 */ 1961 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000; 1962 1963 /** 1964 * Flag to indicate that any window added by an application process that is of type 1965 * {@link #TYPE_TOAST} or that requires 1966 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when 1967 * this window is visible. 1968 * @hide 1969 */ 1970 @SystemApi 1971 @RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS) 1972 public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000; 1973 1974 /** 1975 * Indicates that this window is the rounded corners overlay present on some 1976 * devices this means that it will be excluded from: screenshots, 1977 * screen magnification, and mirroring. 1978 * @hide 1979 */ 1980 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000; 1981 1982 /** 1983 * Flag to indicate that this window should be considered a screen decoration similar to the 1984 * nav bar and status bar. This will cause this window to affect the window insets reported 1985 * to other windows when it is visible. 1986 * @hide 1987 */ 1988 @RequiresPermission(permission.STATUS_BAR_SERVICE) 1989 public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000; 1990 1991 /** 1992 * Flag to indicate that the status bar window is in a state such that it forces showing 1993 * the navigation bar unless the navigation bar window is explicitly set to 1994 * {@link View#GONE}. 1995 * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}. 1996 * @hide 1997 */ 1998 public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000; 1999 2000 /** 2001 * Flag to indicate that the window is color space agnostic, and the color can be 2002 * interpreted to any color space. 2003 * @hide 2004 */ 2005 public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000; 2006 2007 /** 2008 * Flag to request creation of a BLAST (Buffer as LayerState) Layer. 2009 * If not specified the client will receive a BufferQueue layer. 2010 * @hide 2011 */ 2012 public static final int PRIVATE_FLAG_USE_BLAST = 0x02000000; 2013 2014 /** 2015 * Flag to indicate that the window is controlling the appearance of system bars. So we 2016 * don't need to adjust it by reading its system UI flags for compatibility. 2017 * @hide 2018 */ 2019 public static final int PRIVATE_FLAG_APPEARANCE_CONTROLLED = 0x04000000; 2020 2021 /** 2022 * Flag to indicate that the window is controlling the behavior of system bars. So we don't 2023 * need to adjust it by reading its window flags or system UI flags for compatibility. 2024 * @hide 2025 */ 2026 public static final int PRIVATE_FLAG_BEHAVIOR_CONTROLLED = 0x08000000; 2027 2028 /** 2029 * Flag to indicate that the window is controlling how it fits window insets on its own. 2030 * So we don't need to adjust its attributes for fitting window insets. 2031 * @hide 2032 */ 2033 public static final int PRIVATE_FLAG_FIT_INSETS_CONTROLLED = 0x10000000; 2034 2035 /** 2036 * Flag to indicate that the parent frame of a window should be inset by IME. 2037 * @hide 2038 */ 2039 public static final int PRIVATE_FLAG_INSET_PARENT_FRAME_BY_IME = 0x40000000; 2040 2041 /** 2042 * An internal annotation for flags that can be specified to {@link #softInputMode}. 2043 * 2044 * @hide 2045 */ 2046 @SystemApi 2047 @Retention(RetentionPolicy.SOURCE) 2048 @IntDef(flag = true, prefix = { "SYSTEM_FLAG_" }, value = { 2049 SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS, 2050 SYSTEM_FLAG_SHOW_FOR_ALL_USERS, 2051 }) 2052 public @interface SystemFlags {} 2053 2054 /** 2055 * Control flags that are private to the platform. 2056 * @hide 2057 */ 2058 @UnsupportedAppUsage 2059 @ViewDebug.ExportedProperty(flagMapping = { 2060 @ViewDebug.FlagToString( 2061 mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED, 2062 equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED, 2063 name = "FAKE_HARDWARE_ACCELERATED"), 2064 @ViewDebug.FlagToString( 2065 mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED, 2066 equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED, 2067 name = "FORCE_HARDWARE_ACCELERATED"), 2068 @ViewDebug.FlagToString( 2069 mask = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS, 2070 equals = PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS, 2071 name = "WANTS_OFFSET_NOTIFICATIONS"), 2072 @ViewDebug.FlagToString( 2073 mask = SYSTEM_FLAG_SHOW_FOR_ALL_USERS, 2074 equals = SYSTEM_FLAG_SHOW_FOR_ALL_USERS, 2075 name = "SHOW_FOR_ALL_USERS"), 2076 @ViewDebug.FlagToString( 2077 mask = PRIVATE_FLAG_NO_MOVE_ANIMATION, 2078 equals = PRIVATE_FLAG_NO_MOVE_ANIMATION, 2079 name = "NO_MOVE_ANIMATION"), 2080 @ViewDebug.FlagToString( 2081 mask = PRIVATE_FLAG_COMPATIBLE_WINDOW, 2082 equals = PRIVATE_FLAG_COMPATIBLE_WINDOW, 2083 name = "COMPATIBLE_WINDOW"), 2084 @ViewDebug.FlagToString( 2085 mask = PRIVATE_FLAG_SYSTEM_ERROR, 2086 equals = PRIVATE_FLAG_SYSTEM_ERROR, 2087 name = "SYSTEM_ERROR"), 2088 @ViewDebug.FlagToString( 2089 mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, 2090 equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, 2091 name = "DISABLE_WALLPAPER_TOUCH_EVENTS"), 2092 @ViewDebug.FlagToString( 2093 mask = PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR, 2094 equals = PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR, 2095 name = "FORCE_STATUS_BAR_VISIBLE"), 2096 @ViewDebug.FlagToString( 2097 mask = PRIVATE_FLAG_PRESERVE_GEOMETRY, 2098 equals = PRIVATE_FLAG_PRESERVE_GEOMETRY, 2099 name = "PRESERVE_GEOMETRY"), 2100 @ViewDebug.FlagToString( 2101 mask = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY, 2102 equals = PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY, 2103 name = "FORCE_DECOR_VIEW_VISIBILITY"), 2104 @ViewDebug.FlagToString( 2105 mask = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH, 2106 equals = PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH, 2107 name = "WILL_NOT_REPLACE_ON_RELAUNCH"), 2108 @ViewDebug.FlagToString( 2109 mask = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME, 2110 equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME, 2111 name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"), 2112 @ViewDebug.FlagToString( 2113 mask = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS, 2114 equals = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS, 2115 name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"), 2116 @ViewDebug.FlagToString( 2117 mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE, 2118 equals = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE, 2119 name = "SUSTAINED_PERFORMANCE_MODE"), 2120 @ViewDebug.FlagToString( 2121 mask = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS, 2122 equals = SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS, 2123 name = "HIDE_NON_SYSTEM_OVERLAY_WINDOWS"), 2124 @ViewDebug.FlagToString( 2125 mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY, 2126 equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY, 2127 name = "IS_ROUNDED_CORNERS_OVERLAY"), 2128 @ViewDebug.FlagToString( 2129 mask = PRIVATE_FLAG_IS_SCREEN_DECOR, 2130 equals = PRIVATE_FLAG_IS_SCREEN_DECOR, 2131 name = "IS_SCREEN_DECOR"), 2132 @ViewDebug.FlagToString( 2133 mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION, 2134 equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION, 2135 name = "STATUS_FORCE_SHOW_NAVIGATION"), 2136 @ViewDebug.FlagToString( 2137 mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC, 2138 equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC, 2139 name = "COLOR_SPACE_AGNOSTIC"), 2140 @ViewDebug.FlagToString( 2141 mask = PRIVATE_FLAG_APPEARANCE_CONTROLLED, 2142 equals = PRIVATE_FLAG_APPEARANCE_CONTROLLED, 2143 name = "APPEARANCE_CONTROLLED"), 2144 @ViewDebug.FlagToString( 2145 mask = PRIVATE_FLAG_BEHAVIOR_CONTROLLED, 2146 equals = PRIVATE_FLAG_BEHAVIOR_CONTROLLED, 2147 name = "BEHAVIOR_CONTROLLED"), 2148 @ViewDebug.FlagToString( 2149 mask = PRIVATE_FLAG_FIT_INSETS_CONTROLLED, 2150 equals = PRIVATE_FLAG_FIT_INSETS_CONTROLLED, 2151 name = "FIT_INSETS_CONTROLLED") 2152 }) 2153 @TestApi 2154 public int privateFlags; 2155 2156 /** 2157 * Given a particular set of window manager flags, determine whether 2158 * such a window may be a target for an input method when it has 2159 * focus. In particular, this checks the 2160 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM} 2161 * flags and returns true if the combination of the two corresponds 2162 * to a window that can use the input method. 2163 * 2164 * @param flags The current window manager flags. 2165 * 2166 * @return Returns {@code true} if a window with the given flags would be able to 2167 * use the input method, {@code false} if not. 2168 */ mayUseInputMethod(int flags)2169 public static boolean mayUseInputMethod(int flags) { 2170 return (flags & FLAG_NOT_FOCUSABLE) != FLAG_NOT_FOCUSABLE 2171 && (flags & FLAG_ALT_FOCUSABLE_IM) != FLAG_ALT_FOCUSABLE_IM; 2172 } 2173 2174 /** 2175 * Mask for {@link #softInputMode} of the bits that determine the 2176 * desired visibility state of the soft input area for this window. 2177 */ 2178 public static final int SOFT_INPUT_MASK_STATE = 0x0f; 2179 2180 /** 2181 * Visibility state for {@link #softInputMode}: no state has been specified. The system may 2182 * show or hide the software keyboard for better user experience when the window gains 2183 * focus. 2184 */ 2185 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; 2186 2187 /** 2188 * Visibility state for {@link #softInputMode}: please don't change the state of 2189 * the soft input area. 2190 */ 2191 public static final int SOFT_INPUT_STATE_UNCHANGED = 1; 2192 2193 /** 2194 * Visibility state for {@link #softInputMode}: please hide any soft input 2195 * area when normally appropriate (when the user is navigating 2196 * forward to your window). 2197 */ 2198 public static final int SOFT_INPUT_STATE_HIDDEN = 2; 2199 2200 /** 2201 * Visibility state for {@link #softInputMode}: please always hide any 2202 * soft input area when this window receives focus. 2203 */ 2204 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; 2205 2206 /** 2207 * Visibility state for {@link #softInputMode}: please show the soft 2208 * input area when normally appropriate (when the user is navigating 2209 * forward to your window). 2210 * 2211 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag 2212 * is ignored unless there is a focused view that returns {@code true} from 2213 * {@link View#isInEditMode()} when the window is focused.</p> 2214 */ 2215 public static final int SOFT_INPUT_STATE_VISIBLE = 4; 2216 2217 /** 2218 * Visibility state for {@link #softInputMode}: please always make the 2219 * soft input area visible when this window receives input focus. 2220 * 2221 * <p>Applications that target {@link android.os.Build.VERSION_CODES#P} and later, this flag 2222 * is ignored unless there is a focused view that returns {@code true} from 2223 * {@link View#isInEditMode()} when the window is focused.</p> 2224 */ 2225 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; 2226 2227 /** 2228 * Mask for {@link #softInputMode} of the bits that determine the 2229 * way that the window should be adjusted to accommodate the soft 2230 * input window. 2231 */ 2232 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0; 2233 2234 /** Adjustment option for {@link #softInputMode}: nothing specified. 2235 * The system will try to pick one or 2236 * the other depending on the contents of the window. 2237 */ 2238 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00; 2239 2240 /** Adjustment option for {@link #softInputMode}: set to allow the 2241 * window to be resized when an input 2242 * method is shown, so that its contents are not covered by the input 2243 * method. This can <em>not</em> be combined with 2244 * {@link #SOFT_INPUT_ADJUST_PAN}; if 2245 * neither of these are set, then the system will try to pick one or 2246 * the other depending on the contents of the window. If the window's 2247 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this 2248 * value for {@link #softInputMode} will be ignored; the window will 2249 * not resize, but will stay fullscreen. 2250 * 2251 * @deprecated Call {@link Window#setDecorFitsSystemWindows(boolean)} with {@code false} and 2252 * install an {@link OnApplyWindowInsetsListener} on your root content view that fits insets 2253 * of type {@link Type#ime()}. 2254 */ 2255 @Deprecated 2256 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10; 2257 2258 /** Adjustment option for {@link #softInputMode}: set to have a window 2259 * pan when an input method is 2260 * shown, so it doesn't need to deal with resizing but just panned 2261 * by the framework to ensure the current input focus is visible. This 2262 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if 2263 * neither of these are set, then the system will try to pick one or 2264 * the other depending on the contents of the window. 2265 */ 2266 public static final int SOFT_INPUT_ADJUST_PAN = 0x20; 2267 2268 /** Adjustment option for {@link #softInputMode}: set to have a window 2269 * not adjust for a shown input method. The window will not be resized, 2270 * and it will not be panned to make its focus visible. 2271 */ 2272 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30; 2273 2274 /** 2275 * Bit for {@link #softInputMode}: set when the user has navigated 2276 * forward to the window. This is normally set automatically for 2277 * you by the system, though you may want to set it in certain cases 2278 * when you are displaying a window yourself. This flag will always 2279 * be cleared automatically after the window is displayed. 2280 */ 2281 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100; 2282 2283 /** 2284 * An internal annotation for flags that can be specified to {@link #softInputMode}. 2285 * 2286 * @hide 2287 */ 2288 @Retention(RetentionPolicy.SOURCE) 2289 @IntDef(flag = true, prefix = { "SOFT_INPUT_" }, value = { 2290 SOFT_INPUT_STATE_UNSPECIFIED, 2291 SOFT_INPUT_STATE_UNCHANGED, 2292 SOFT_INPUT_STATE_HIDDEN, 2293 SOFT_INPUT_STATE_ALWAYS_HIDDEN, 2294 SOFT_INPUT_STATE_VISIBLE, 2295 SOFT_INPUT_STATE_ALWAYS_VISIBLE, 2296 SOFT_INPUT_ADJUST_UNSPECIFIED, 2297 SOFT_INPUT_ADJUST_RESIZE, 2298 SOFT_INPUT_ADJUST_PAN, 2299 SOFT_INPUT_ADJUST_NOTHING, 2300 SOFT_INPUT_IS_FORWARD_NAVIGATION, 2301 }) 2302 public @interface SoftInputModeFlags {} 2303 2304 /** 2305 * Desired operating mode for any soft input area. May be any combination 2306 * of: 2307 * 2308 * <ul> 2309 * <li> One of the visibility states 2310 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED}, 2311 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN}, 2312 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}. 2313 * <li> One of the adjustment options 2314 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE}, 2315 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}. 2316 * </ul> 2317 * 2318 * 2319 * <p>This flag can be controlled in your theme through the 2320 * {@link android.R.attr#windowSoftInputMode} attribute.</p> 2321 */ 2322 @SoftInputModeFlags 2323 public int softInputMode; 2324 2325 /** 2326 * Placement of window within the screen as per {@link Gravity}. Both 2327 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, 2328 * android.graphics.Rect) Gravity.apply} and 2329 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) 2330 * Gravity.applyDisplay} are used during window layout, with this value 2331 * given as the desired gravity. For example you can specify 2332 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and 2333 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here 2334 * to control the behavior of 2335 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) 2336 * Gravity.applyDisplay}. 2337 * 2338 * @see Gravity 2339 */ 2340 public int gravity; 2341 2342 /** 2343 * The horizontal margin, as a percentage of the container's width, 2344 * between the container and the widget. See 2345 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, 2346 * android.graphics.Rect) Gravity.apply} for how this is used. This 2347 * field is added with {@link #x} to supply the <var>xAdj</var> parameter. 2348 */ 2349 public float horizontalMargin; 2350 2351 /** 2352 * The vertical margin, as a percentage of the container's height, 2353 * between the container and the widget. See 2354 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, 2355 * android.graphics.Rect) Gravity.apply} for how this is used. This 2356 * field is added with {@link #y} to supply the <var>yAdj</var> parameter. 2357 */ 2358 public float verticalMargin; 2359 2360 /** 2361 * Positive insets between the drawing surface and window content. 2362 * 2363 * @hide 2364 */ 2365 public final Rect surfaceInsets = new Rect(); 2366 2367 /** 2368 * Whether the surface insets have been manually set. When set to 2369 * {@code false}, the view root will automatically determine the 2370 * appropriate surface insets. 2371 * 2372 * @see #surfaceInsets 2373 * @hide 2374 */ 2375 public boolean hasManualSurfaceInsets; 2376 2377 /** 2378 * Whether the previous surface insets should be used vs. what is currently set. When set 2379 * to {@code true}, the view root will ignore surfaces insets in this object and use what 2380 * it currently has. 2381 * 2382 * @see #surfaceInsets 2383 * @hide 2384 */ 2385 public boolean preservePreviousSurfaceInsets = true; 2386 2387 /** 2388 * The desired bitmap format. May be one of the constants in 2389 * {@link android.graphics.PixelFormat}. The choice of format 2390 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE. 2391 */ 2392 public int format; 2393 2394 /** 2395 * A style resource defining the animations to use for this window. 2396 * This must be a system resource; it can not be an application resource 2397 * because the window manager does not have access to applications. 2398 */ 2399 public int windowAnimations; 2400 2401 /** 2402 * An alpha value to apply to this entire window. 2403 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent 2404 */ 2405 public float alpha = 1.0f; 2406 2407 /** 2408 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming 2409 * to apply. Range is from 1.0 for completely opaque to 0.0 for no 2410 * dim. 2411 */ 2412 public float dimAmount = 1.0f; 2413 2414 /** 2415 * Default value for {@link #screenBrightness} and {@link #buttonBrightness} 2416 * indicating that the brightness value is not overridden for this window 2417 * and normal brightness policy should be used. 2418 */ 2419 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f; 2420 2421 /** 2422 * Value for {@link #screenBrightness} and {@link #buttonBrightness} 2423 * indicating that the screen or button backlight brightness should be set 2424 * to the lowest value when this window is in front. 2425 */ 2426 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f; 2427 2428 /** 2429 * Value for {@link #screenBrightness} and {@link #buttonBrightness} 2430 * indicating that the screen or button backlight brightness should be set 2431 * to the hightest value when this window is in front. 2432 */ 2433 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f; 2434 2435 /** 2436 * This can be used to override the user's preferred brightness of 2437 * the screen. A value of less than 0, the default, means to use the 2438 * preferred screen brightness. 0 to 1 adjusts the brightness from 2439 * dark to full bright. 2440 */ 2441 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE; 2442 2443 /** 2444 * This can be used to override the standard behavior of the button and 2445 * keyboard backlights. A value of less than 0, the default, means to 2446 * use the standard backlight behavior. 0 to 1 adjusts the brightness 2447 * from dark to full bright. 2448 */ 2449 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE; 2450 2451 /** 2452 * Unspecified value for {@link #rotationAnimation} indicating 2453 * a lack of preference. 2454 * @hide 2455 */ 2456 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1; 2457 2458 /** 2459 * Value for {@link #rotationAnimation} which specifies that this 2460 * window will visually rotate in or out following a rotation. 2461 */ 2462 public static final int ROTATION_ANIMATION_ROTATE = 0; 2463 2464 /** 2465 * Value for {@link #rotationAnimation} which specifies that this 2466 * window will fade in or out following a rotation. 2467 */ 2468 public static final int ROTATION_ANIMATION_CROSSFADE = 1; 2469 2470 /** 2471 * Value for {@link #rotationAnimation} which specifies that this window 2472 * will immediately disappear or appear following a rotation. 2473 */ 2474 public static final int ROTATION_ANIMATION_JUMPCUT = 2; 2475 2476 /** 2477 * Value for {@link #rotationAnimation} to specify seamless rotation mode. 2478 * This works like JUMPCUT but will fall back to CROSSFADE if rotation 2479 * can't be applied without pausing the screen. For example, this is ideal 2480 * for Camera apps which don't want the viewfinder contents to ever rotate 2481 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT 2482 * during app transition scenarios where seamless rotation can't be applied. 2483 */ 2484 public static final int ROTATION_ANIMATION_SEAMLESS = 3; 2485 2486 /** 2487 * Define the exit and entry animations used on this window when the device is rotated. 2488 * This only has an affect if the incoming and outgoing topmost 2489 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered 2490 * by other windows. All other situations default to the 2491 * {@link #ROTATION_ANIMATION_ROTATE} behavior. 2492 * 2493 * @see #ROTATION_ANIMATION_ROTATE 2494 * @see #ROTATION_ANIMATION_CROSSFADE 2495 * @see #ROTATION_ANIMATION_JUMPCUT 2496 */ 2497 public int rotationAnimation = ROTATION_ANIMATION_ROTATE; 2498 2499 /** 2500 * Identifier for this window. This will usually be filled in for 2501 * you. 2502 */ 2503 public IBinder token = null; 2504 2505 /** 2506 * Name of the package owning this window. 2507 */ 2508 public String packageName = null; 2509 2510 /** 2511 * Specific orientation value for a window. 2512 * May be any of the same values allowed 2513 * for {@link android.content.pm.ActivityInfo#screenOrientation}. 2514 * If not set, a default value of 2515 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED} 2516 * will be used. 2517 */ 2518 @ActivityInfo.ScreenOrientation 2519 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; 2520 2521 /** 2522 * The preferred refresh rate for the window. 2523 * 2524 * This must be one of the supported refresh rates obtained for the display(s) the window 2525 * is on. The selected refresh rate will be applied to the display's default mode. 2526 * 2527 * This value is ignored if {@link #preferredDisplayModeId} is set. 2528 * 2529 * @see Display#getSupportedRefreshRates() 2530 * @deprecated use {@link #preferredDisplayModeId} instead 2531 */ 2532 @Deprecated 2533 public float preferredRefreshRate; 2534 2535 /** 2536 * Id of the preferred display mode for the window. 2537 * <p> 2538 * This must be one of the supported modes obtained for the display(s) the window is on. 2539 * A value of {@code 0} means no preference. 2540 * 2541 * @see Display#getSupportedModes() 2542 * @see Display.Mode#getModeId() 2543 */ 2544 public int preferredDisplayModeId; 2545 2546 /** 2547 * Control the visibility of the status bar. 2548 * 2549 * @see View#STATUS_BAR_VISIBLE 2550 * @see View#STATUS_BAR_HIDDEN 2551 * 2552 * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} 2553 * instead. 2554 */ 2555 @Deprecated 2556 public int systemUiVisibility; 2557 2558 /** 2559 * @hide 2560 * The ui visibility as requested by the views in this hierarchy. 2561 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility. 2562 */ 2563 @UnsupportedAppUsage 2564 public int subtreeSystemUiVisibility; 2565 2566 /** 2567 * Get callbacks about the system ui visibility changing. 2568 * 2569 * TODO: Maybe there should be a bitfield of optional callbacks that we need. 2570 * 2571 * @hide 2572 */ 2573 @UnsupportedAppUsage 2574 public boolean hasSystemUiListeners; 2575 2576 2577 /** @hide */ 2578 @Retention(RetentionPolicy.SOURCE) 2579 @IntDef( 2580 flag = true, 2581 value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT, 2582 LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES, 2583 LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER, 2584 LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS}) 2585 @interface LayoutInDisplayCutoutMode {} 2586 2587 /** 2588 * Controls how the window is laid out if there is a {@link DisplayCutout}. 2589 * 2590 * <p> 2591 * Defaults to {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT}. 2592 * 2593 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT 2594 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES 2595 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER 2596 * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS 2597 * @see DisplayCutout 2598 * @see android.R.attr#windowLayoutInDisplayCutoutMode 2599 * android:windowLayoutInDisplayCutoutMode 2600 */ 2601 @LayoutInDisplayCutoutMode 2602 public int layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT; 2603 2604 /** 2605 * The window is allowed to extend into the {@link DisplayCutout} area, only if the 2606 * {@link DisplayCutout} is fully contained within a system bar. Otherwise, the window is 2607 * laid out such that it does not overlap with the {@link DisplayCutout} area. 2608 * 2609 * <p> 2610 * In practice, this means that if the window did not set {@link #FLAG_FULLSCREEN} or 2611 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN}, it can extend into the cutout area in portrait 2612 * if the cutout is at the top edge. Similarly for 2613 * {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} and a cutout at the bottom of the screen. 2614 * Otherwise (i.e. fullscreen or landscape) it is laid out such that it does not overlap the 2615 * cutout area. 2616 * 2617 * <p> 2618 * The usual precautions for not overlapping with the status and navigation bar are 2619 * sufficient for ensuring that no important content overlaps with the DisplayCutout. 2620 * 2621 * @see DisplayCutout 2622 * @see WindowInsets 2623 * @see #layoutInDisplayCutoutMode 2624 * @see android.R.attr#windowLayoutInDisplayCutoutMode 2625 * android:windowLayoutInDisplayCutoutMode 2626 */ 2627 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0; 2628 2629 /** 2630 * The window is always allowed to extend into the {@link DisplayCutout} areas on the short 2631 * edges of the screen. 2632 * 2633 * The window will never extend into a {@link DisplayCutout} area on the long edges of the 2634 * screen. 2635 * 2636 * <p> 2637 * The window must make sure that no important content overlaps with the 2638 * {@link DisplayCutout}. 2639 * 2640 * <p> 2641 * In this mode, the window extends under cutouts on the short edge of the display in both 2642 * portrait and landscape, regardless of whether the window is hiding the system bars:<br/> 2643 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_top_no_letterbox.png" 2644 * height="720" 2645 * alt="Screenshot of a fullscreen activity on a display with a cutout at the top edge in 2646 * portrait, no letterbox is applied."/> 2647 * 2648 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/landscape_top_no_letterbox.png" 2649 * width="720" 2650 * alt="Screenshot of an activity on a display with a cutout at the top edge in landscape, 2651 * no letterbox is applied."/> 2652 * 2653 * <p> 2654 * A cutout in the corner is considered to be on the short edge: <br/> 2655 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/fullscreen_corner_no_letterbox.png" 2656 * height="720" 2657 * alt="Screenshot of a fullscreen activity on a display with a cutout in the corner in 2658 * portrait, no letterbox is applied."/> 2659 * 2660 * <p> 2661 * On the other hand, should the cutout be on the long edge of the display, a letterbox will 2662 * be applied such that the window does not extend into the cutout on either long edge: 2663 * <br/> 2664 * <img src="{@docRoot}reference/android/images/display_cutout/short_edge/portrait_side_letterbox.png" 2665 * height="720" 2666 * alt="Screenshot of an activity on a display with a cutout on the long edge in portrait, 2667 * letterbox is applied."/> 2668 * 2669 * @see DisplayCutout 2670 * @see WindowInsets#getDisplayCutout() 2671 * @see #layoutInDisplayCutoutMode 2672 * @see android.R.attr#windowLayoutInDisplayCutoutMode 2673 * android:windowLayoutInDisplayCutoutMode 2674 */ 2675 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1; 2676 2677 /** 2678 * The window is never allowed to overlap with the DisplayCutout area. 2679 * 2680 * <p> 2681 * This should be used with windows that transiently set 2682 * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} or {@link View#SYSTEM_UI_FLAG_HIDE_NAVIGATION} 2683 * to avoid a relayout of the window when the respective flag is set or cleared. 2684 * 2685 * @see DisplayCutout 2686 * @see #layoutInDisplayCutoutMode 2687 * @see android.R.attr#windowLayoutInDisplayCutoutMode 2688 * android:windowLayoutInDisplayCutoutMode 2689 */ 2690 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2; 2691 2692 /** 2693 * The window is always allowed to extend into the {@link DisplayCutout} areas on the all 2694 * edges of the screen. 2695 * 2696 * <p> 2697 * The window must make sure that no important content overlaps with the 2698 * {@link DisplayCutout}. 2699 * 2700 * <p> 2701 * In this mode, the window extends under cutouts on the all edges of the display in both 2702 * portrait and landscape, regardless of whether the window is hiding the system bars. 2703 * 2704 * @see DisplayCutout 2705 * @see WindowInsets#getDisplayCutout() 2706 * @see #layoutInDisplayCutoutMode 2707 * @see android.R.attr#windowLayoutInDisplayCutoutMode 2708 * android:windowLayoutInDisplayCutoutMode 2709 */ 2710 public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 3; 2711 2712 /** 2713 * When this window has focus, disable touch pad pointer gesture processing. 2714 * The window will receive raw position updates from the touch pad instead 2715 * of pointer movements and synthetic touch events. 2716 * 2717 * @hide 2718 */ 2719 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001; 2720 2721 /** 2722 * Does not construct an input channel for this window. The channel will therefore 2723 * be incapable of receiving input. 2724 * 2725 * @hide 2726 */ 2727 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002; 2728 2729 /** 2730 * When this window has focus, does not call user activity for all input events so 2731 * the application will have to do it itself. Should only be used by 2732 * the keyguard and phone app. 2733 * <p> 2734 * Should only be used by the keyguard and phone app. 2735 * </p> 2736 * 2737 * @hide 2738 */ 2739 @UnsupportedAppUsage 2740 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004; 2741 2742 /** 2743 * Control special features of the input subsystem. 2744 * 2745 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES 2746 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL 2747 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY 2748 * @hide 2749 */ 2750 @UnsupportedAppUsage 2751 public int inputFeatures; 2752 2753 /** 2754 * Sets the number of milliseconds before the user activity timeout occurs 2755 * when this window has focus. A value of -1 uses the standard timeout. 2756 * A value of 0 uses the minimum support display timeout. 2757 * <p> 2758 * This property can only be used to reduce the user specified display timeout; 2759 * it can never make the timeout longer than it normally would be. 2760 * </p><p> 2761 * Should only be used by the keyguard and phone app. 2762 * </p> 2763 * 2764 * @hide 2765 */ 2766 @UnsupportedAppUsage 2767 public long userActivityTimeout = -1; 2768 2769 /** 2770 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the 2771 * window. 2772 * 2773 * @hide 2774 */ 2775 public long accessibilityIdOfAnchor = AccessibilityNodeInfo.UNDEFINED_NODE_ID; 2776 2777 /** 2778 * The window title isn't kept in sync with what is displayed in the title bar, so we 2779 * separately track the currently shown title to provide to accessibility. 2780 * 2781 * @hide 2782 */ 2783 @TestApi 2784 public CharSequence accessibilityTitle; 2785 2786 /** 2787 * Sets a timeout in milliseconds before which the window will be hidden 2788 * by the window manager. Useful for transient notifications like toasts 2789 * so we don't have to rely on client cooperation to ensure the window 2790 * is hidden. Must be specified at window creation time. Note that apps 2791 * are not prepared to handle their windows being removed without their 2792 * explicit request and may try to interact with the removed window 2793 * resulting in undefined behavior and crashes. Therefore, we do hide 2794 * such windows to prevent them from overlaying other apps. 2795 * 2796 * @hide 2797 */ 2798 @UnsupportedAppUsage 2799 public long hideTimeoutMilliseconds = -1; 2800 2801 /** 2802 * Indicates whether this window wants the connected display to do minimal post processing 2803 * on the produced image or video frames. This will only be requested if the window is 2804 * visible on the screen. 2805 * 2806 * <p>This setting should be used when low latency has a higher priority than image 2807 * enhancement processing (e.g. for games or video conferencing). 2808 * 2809 * <p>If the Display sink is connected via HDMI, the device will begin to send infoframes 2810 * with Auto Low Latency Mode enabled and Game Content Type. This will switch the connected 2811 * display to a minimal image processing mode (if available), which reduces latency, 2812 * improving the user experience for gaming or video conferencing applications. For more 2813 * information, see HDMI 2.1 specification. 2814 * 2815 * <p>If the Display sink has an internal connection or uses some other protocol than HDMI, 2816 * effects may be similar but implementation-defined. 2817 * 2818 * <p>The ability to switch to a mode with minimal post proessing may be disabled by a user 2819 * setting in the system settings menu. In that case, this field is ignored and the display 2820 * will remain in its current mode. 2821 * 2822 * @see android.content.pm.ActivityInfo#FLAG_PREFER_MINIMAL_POST_PROCESSING 2823 * @see android.view.Display#isMinimalPostProcessingSupported 2824 * @see android.view.Window#setPreferMinimalPostProcessing 2825 */ 2826 public boolean preferMinimalPostProcessing = false; 2827 2828 /** 2829 * The color mode requested by this window. The target display may 2830 * not be able to honor the request. When the color mode is not set 2831 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the 2832 * pixel format specified in {@link #format}. 2833 * 2834 * @hide 2835 */ 2836 @ActivityInfo.ColorMode 2837 private int mColorMode = COLOR_MODE_DEFAULT; 2838 2839 /** 2840 * Carries the requests about {@link WindowInsetsController.Appearance} and 2841 * {@link WindowInsetsController.Behavior} to the system windows which can produce insets. 2842 * 2843 * @hide 2844 */ 2845 public final InsetsFlags insetsFlags = new InsetsFlags(); 2846 2847 @ViewDebug.ExportedProperty(flagMapping = { 2848 @ViewDebug.FlagToString( 2849 mask = STATUS_BARS, 2850 equals = STATUS_BARS, 2851 name = "STATUS_BARS"), 2852 @ViewDebug.FlagToString( 2853 mask = NAVIGATION_BARS, 2854 equals = NAVIGATION_BARS, 2855 name = "NAVIGATION_BARS"), 2856 @ViewDebug.FlagToString( 2857 mask = CAPTION_BAR, 2858 equals = CAPTION_BAR, 2859 name = "CAPTION_BAR"), 2860 @ViewDebug.FlagToString( 2861 mask = IME, 2862 equals = IME, 2863 name = "IME"), 2864 @ViewDebug.FlagToString( 2865 mask = SYSTEM_GESTURES, 2866 equals = SYSTEM_GESTURES, 2867 name = "SYSTEM_GESTURES"), 2868 @ViewDebug.FlagToString( 2869 mask = MANDATORY_SYSTEM_GESTURES, 2870 equals = MANDATORY_SYSTEM_GESTURES, 2871 name = "MANDATORY_SYSTEM_GESTURES"), 2872 @ViewDebug.FlagToString( 2873 mask = TAPPABLE_ELEMENT, 2874 equals = TAPPABLE_ELEMENT, 2875 name = "TAPPABLE_ELEMENT"), 2876 @ViewDebug.FlagToString( 2877 mask = WINDOW_DECOR, 2878 equals = WINDOW_DECOR, 2879 name = "WINDOW_DECOR") 2880 }) 2881 private @InsetsType int mFitInsetsTypes = Type.systemBars(); 2882 2883 @ViewDebug.ExportedProperty(flagMapping = { 2884 @ViewDebug.FlagToString( 2885 mask = LEFT, 2886 equals = LEFT, 2887 name = "LEFT"), 2888 @ViewDebug.FlagToString( 2889 mask = TOP, 2890 equals = TOP, 2891 name = "TOP"), 2892 @ViewDebug.FlagToString( 2893 mask = RIGHT, 2894 equals = RIGHT, 2895 name = "RIGHT"), 2896 @ViewDebug.FlagToString( 2897 mask = BOTTOM, 2898 equals = BOTTOM, 2899 name = "BOTTOM") 2900 }) 2901 private @InsetsSide int mFitInsetsSides = Side.all(); 2902 2903 private boolean mFitInsetsIgnoringVisibility = false; 2904 2905 /** 2906 * {@link InsetsState.InternalInsetsType}s to be applied to the window 2907 * If {@link #type} has the predefined insets (like {@link #TYPE_STATUS_BAR} or 2908 * {@link #TYPE_NAVIGATION_BAR}), this field will be ignored. 2909 * 2910 * <p>Note: provide only one inset corresponding to the window type (like 2911 * {@link InsetsState.InternalInsetsType#ITYPE_STATUS_BAR} or 2912 * {@link InsetsState.InternalInsetsType#ITYPE_NAVIGATION_BAR})</p> 2913 * @hide 2914 */ 2915 public @InsetsState.InternalInsetsType int[] providesInsetsTypes; 2916 2917 /** 2918 * Specifies types of insets that this window should avoid overlapping during layout. 2919 * 2920 * @param types which types of insets that this window should avoid. The initial value of 2921 * this object includes all system bars. 2922 */ setFitInsetsTypes(@nsetsType int types)2923 public void setFitInsetsTypes(@InsetsType int types) { 2924 mFitInsetsTypes = types; 2925 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED; 2926 } 2927 2928 /** 2929 * Specifies sides of insets that this window should avoid overlapping during layout. 2930 * 2931 * @param sides which sides that this window should avoid overlapping with the types 2932 * specified. The initial value of this object includes all sides. 2933 */ setFitInsetsSides(@nsetsSide int sides)2934 public void setFitInsetsSides(@InsetsSide int sides) { 2935 mFitInsetsSides = sides; 2936 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED; 2937 } 2938 2939 /** 2940 * Specifies if this window should fit the window insets no matter they are visible or not. 2941 * 2942 * @param ignore if true, this window will fit the given types even if they are not visible. 2943 */ setFitInsetsIgnoringVisibility(boolean ignore)2944 public void setFitInsetsIgnoringVisibility(boolean ignore) { 2945 mFitInsetsIgnoringVisibility = ignore; 2946 privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED; 2947 } 2948 2949 /** 2950 * @return the insets types that this window is avoiding overlapping. 2951 */ getFitInsetsTypes()2952 public @InsetsType int getFitInsetsTypes() { 2953 return mFitInsetsTypes; 2954 } 2955 2956 /** 2957 * @return the sides that this window is avoiding overlapping. 2958 */ getFitInsetsSides()2959 public @InsetsSide int getFitInsetsSides() { 2960 return mFitInsetsSides; 2961 } 2962 2963 /** 2964 * @return {@code true} if this window fits the window insets no matter they are visible or 2965 * not. 2966 */ isFitInsetsIgnoringVisibility()2967 public boolean isFitInsetsIgnoringVisibility() { 2968 return mFitInsetsIgnoringVisibility; 2969 } 2970 LayoutParams()2971 public LayoutParams() { 2972 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 2973 type = TYPE_APPLICATION; 2974 format = PixelFormat.OPAQUE; 2975 } 2976 LayoutParams(int _type)2977 public LayoutParams(int _type) { 2978 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 2979 type = _type; 2980 format = PixelFormat.OPAQUE; 2981 } 2982 LayoutParams(int _type, int _flags)2983 public LayoutParams(int _type, int _flags) { 2984 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 2985 type = _type; 2986 flags = _flags; 2987 format = PixelFormat.OPAQUE; 2988 } 2989 LayoutParams(int _type, int _flags, int _format)2990 public LayoutParams(int _type, int _flags, int _format) { 2991 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 2992 type = _type; 2993 flags = _flags; 2994 format = _format; 2995 } 2996 LayoutParams(int w, int h, int _type, int _flags, int _format)2997 public LayoutParams(int w, int h, int _type, int _flags, int _format) { 2998 super(w, h); 2999 type = _type; 3000 flags = _flags; 3001 format = _format; 3002 } 3003 LayoutParams(int w, int h, int xpos, int ypos, int _type, int _flags, int _format)3004 public LayoutParams(int w, int h, int xpos, int ypos, int _type, 3005 int _flags, int _format) { 3006 super(w, h); 3007 x = xpos; 3008 y = ypos; 3009 type = _type; 3010 flags = _flags; 3011 format = _format; 3012 } 3013 setTitle(CharSequence title)3014 public final void setTitle(CharSequence title) { 3015 if (null == title) 3016 title = ""; 3017 3018 mTitle = TextUtils.stringOrSpannedString(title); 3019 } 3020 getTitle()3021 public final CharSequence getTitle() { 3022 return mTitle != null ? mTitle : ""; 3023 } 3024 3025 /** 3026 * Sets the surface insets based on the elevation (visual z position) of the input view. 3027 * @hide 3028 */ setSurfaceInsets(View view, boolean manual, boolean preservePrevious)3029 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) { 3030 final int surfaceInset = (int) Math.ceil(view.getZ() * 2); 3031 // Partial workaround for b/28318973. Every inset change causes a freeform window 3032 // to jump a little for a few frames. If we never allow surface insets to decrease, 3033 // they will stabilize quickly (often from the very beginning, as most windows start 3034 // as focused). 3035 // TODO(b/22668382) to fix this properly. 3036 if (surfaceInset == 0) { 3037 // OK to have 0 (this is the case for non-freeform windows). 3038 surfaceInsets.set(0, 0, 0, 0); 3039 } else { 3040 surfaceInsets.set( 3041 Math.max(surfaceInset, surfaceInsets.left), 3042 Math.max(surfaceInset, surfaceInsets.top), 3043 Math.max(surfaceInset, surfaceInsets.right), 3044 Math.max(surfaceInset, surfaceInsets.bottom)); 3045 } 3046 hasManualSurfaceInsets = manual; 3047 preservePreviousSurfaceInsets = preservePrevious; 3048 } 3049 3050 /** 3051 * <p>Set the color mode of the window. Setting the color mode might 3052 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p> 3053 * 3054 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT}, 3055 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or 3056 * {@link ActivityInfo#COLOR_MODE_HDR}.</p> 3057 * 3058 * @see #getColorMode() 3059 */ setColorMode(@ctivityInfo.ColorMode int colorMode)3060 public void setColorMode(@ActivityInfo.ColorMode int colorMode) { 3061 mColorMode = colorMode; 3062 } 3063 3064 /** 3065 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT}, 3066 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}. 3067 * 3068 * @see #setColorMode(int) 3069 */ 3070 @ActivityInfo.ColorMode getColorMode()3071 public int getColorMode() { 3072 return mColorMode; 3073 } 3074 3075 /** @hide */ 3076 @SystemApi setUserActivityTimeout(long timeout)3077 public final void setUserActivityTimeout(long timeout) { 3078 userActivityTimeout = timeout; 3079 } 3080 3081 /** @hide */ 3082 @SystemApi getUserActivityTimeout()3083 public final long getUserActivityTimeout() { 3084 return userActivityTimeout; 3085 } 3086 describeContents()3087 public int describeContents() { 3088 return 0; 3089 } 3090 writeToParcel(Parcel out, int parcelableFlags)3091 public void writeToParcel(Parcel out, int parcelableFlags) { 3092 out.writeInt(width); 3093 out.writeInt(height); 3094 out.writeInt(x); 3095 out.writeInt(y); 3096 out.writeInt(type); 3097 out.writeInt(flags); 3098 out.writeInt(privateFlags); 3099 out.writeInt(softInputMode); 3100 out.writeInt(layoutInDisplayCutoutMode); 3101 out.writeInt(gravity); 3102 out.writeFloat(horizontalMargin); 3103 out.writeFloat(verticalMargin); 3104 out.writeInt(format); 3105 out.writeInt(windowAnimations); 3106 out.writeFloat(alpha); 3107 out.writeFloat(dimAmount); 3108 out.writeFloat(screenBrightness); 3109 out.writeFloat(buttonBrightness); 3110 out.writeInt(rotationAnimation); 3111 out.writeStrongBinder(token); 3112 out.writeString(packageName); 3113 TextUtils.writeToParcel(mTitle, out, parcelableFlags); 3114 out.writeInt(screenOrientation); 3115 out.writeFloat(preferredRefreshRate); 3116 out.writeInt(preferredDisplayModeId); 3117 out.writeInt(systemUiVisibility); 3118 out.writeInt(subtreeSystemUiVisibility); 3119 out.writeInt(hasSystemUiListeners ? 1 : 0); 3120 out.writeInt(inputFeatures); 3121 out.writeLong(userActivityTimeout); 3122 out.writeInt(surfaceInsets.left); 3123 out.writeInt(surfaceInsets.top); 3124 out.writeInt(surfaceInsets.right); 3125 out.writeInt(surfaceInsets.bottom); 3126 out.writeInt(hasManualSurfaceInsets ? 1 : 0); 3127 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0); 3128 out.writeLong(accessibilityIdOfAnchor); 3129 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags); 3130 out.writeInt(mColorMode); 3131 out.writeLong(hideTimeoutMilliseconds); 3132 out.writeInt(insetsFlags.appearance); 3133 out.writeInt(insetsFlags.behavior); 3134 out.writeInt(mFitInsetsTypes); 3135 out.writeInt(mFitInsetsSides); 3136 out.writeBoolean(mFitInsetsIgnoringVisibility); 3137 out.writeBoolean(preferMinimalPostProcessing); 3138 if (providesInsetsTypes != null) { 3139 out.writeInt(providesInsetsTypes.length); 3140 out.writeIntArray(providesInsetsTypes); 3141 } else { 3142 out.writeInt(0); 3143 } 3144 } 3145 3146 public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR 3147 = new Parcelable.Creator<LayoutParams>() { 3148 public LayoutParams createFromParcel(Parcel in) { 3149 return new LayoutParams(in); 3150 } 3151 3152 public LayoutParams[] newArray(int size) { 3153 return new LayoutParams[size]; 3154 } 3155 }; 3156 3157 LayoutParams(Parcel in)3158 public LayoutParams(Parcel in) { 3159 width = in.readInt(); 3160 height = in.readInt(); 3161 x = in.readInt(); 3162 y = in.readInt(); 3163 type = in.readInt(); 3164 flags = in.readInt(); 3165 privateFlags = in.readInt(); 3166 softInputMode = in.readInt(); 3167 layoutInDisplayCutoutMode = in.readInt(); 3168 gravity = in.readInt(); 3169 horizontalMargin = in.readFloat(); 3170 verticalMargin = in.readFloat(); 3171 format = in.readInt(); 3172 windowAnimations = in.readInt(); 3173 alpha = in.readFloat(); 3174 dimAmount = in.readFloat(); 3175 screenBrightness = in.readFloat(); 3176 buttonBrightness = in.readFloat(); 3177 rotationAnimation = in.readInt(); 3178 token = in.readStrongBinder(); 3179 packageName = in.readString(); 3180 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); 3181 screenOrientation = in.readInt(); 3182 preferredRefreshRate = in.readFloat(); 3183 preferredDisplayModeId = in.readInt(); 3184 systemUiVisibility = in.readInt(); 3185 subtreeSystemUiVisibility = in.readInt(); 3186 hasSystemUiListeners = in.readInt() != 0; 3187 inputFeatures = in.readInt(); 3188 userActivityTimeout = in.readLong(); 3189 surfaceInsets.left = in.readInt(); 3190 surfaceInsets.top = in.readInt(); 3191 surfaceInsets.right = in.readInt(); 3192 surfaceInsets.bottom = in.readInt(); 3193 hasManualSurfaceInsets = in.readInt() != 0; 3194 preservePreviousSurfaceInsets = in.readInt() != 0; 3195 accessibilityIdOfAnchor = in.readLong(); 3196 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); 3197 mColorMode = in.readInt(); 3198 hideTimeoutMilliseconds = in.readLong(); 3199 insetsFlags.appearance = in.readInt(); 3200 insetsFlags.behavior = in.readInt(); 3201 mFitInsetsTypes = in.readInt(); 3202 mFitInsetsSides = in.readInt(); 3203 mFitInsetsIgnoringVisibility = in.readBoolean(); 3204 preferMinimalPostProcessing = in.readBoolean(); 3205 int insetsTypesLength = in.readInt(); 3206 if (insetsTypesLength > 0) { 3207 providesInsetsTypes = new int[insetsTypesLength]; 3208 in.readIntArray(providesInsetsTypes); 3209 } 3210 } 3211 3212 @SuppressWarnings({"PointlessBitwiseExpression"}) 3213 public static final int LAYOUT_CHANGED = 1<<0; 3214 public static final int TYPE_CHANGED = 1<<1; 3215 public static final int FLAGS_CHANGED = 1<<2; 3216 public static final int FORMAT_CHANGED = 1<<3; 3217 public static final int ANIMATION_CHANGED = 1<<4; 3218 public static final int DIM_AMOUNT_CHANGED = 1<<5; 3219 public static final int TITLE_CHANGED = 1<<6; 3220 public static final int ALPHA_CHANGED = 1<<7; 3221 public static final int MEMORY_TYPE_CHANGED = 1<<8; 3222 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9; 3223 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10; 3224 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11; 3225 public static final int ROTATION_ANIMATION_CHANGED = 1<<12; 3226 /** {@hide} */ 3227 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13; 3228 /** {@hide} */ 3229 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14; 3230 /** {@hide} */ 3231 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15; 3232 /** {@hide} */ 3233 public static final int INPUT_FEATURES_CHANGED = 1<<16; 3234 /** {@hide} */ 3235 public static final int PRIVATE_FLAGS_CHANGED = 1<<17; 3236 /** {@hide} */ 3237 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18; 3238 /** {@hide} */ 3239 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19; 3240 /** {@hide} */ 3241 public static final int SURFACE_INSETS_CHANGED = 1<<20; 3242 /** {@hide} */ 3243 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21; 3244 /** {@hide} */ 3245 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23; 3246 /** {@hide} */ 3247 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24; 3248 /** {@hide} */ 3249 @TestApi 3250 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25; 3251 /** {@hide} */ 3252 public static final int COLOR_MODE_CHANGED = 1 << 26; 3253 /** {@hide} */ 3254 public static final int INSET_FLAGS_CHANGED = 1 << 27; 3255 /** {@hide} */ 3256 public static final int MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED = 1 << 28; 3257 3258 // internal buffer to backup/restore parameters under compatibility mode. 3259 private int[] mCompatibilityParamsBackup = null; 3260 copyFrom(LayoutParams o)3261 public final int copyFrom(LayoutParams o) { 3262 int changes = 0; 3263 3264 if (width != o.width) { 3265 width = o.width; 3266 changes |= LAYOUT_CHANGED; 3267 } 3268 if (height != o.height) { 3269 height = o.height; 3270 changes |= LAYOUT_CHANGED; 3271 } 3272 if (x != o.x) { 3273 x = o.x; 3274 changes |= LAYOUT_CHANGED; 3275 } 3276 if (y != o.y) { 3277 y = o.y; 3278 changes |= LAYOUT_CHANGED; 3279 } 3280 if (horizontalWeight != o.horizontalWeight) { 3281 horizontalWeight = o.horizontalWeight; 3282 changes |= LAYOUT_CHANGED; 3283 } 3284 if (verticalWeight != o.verticalWeight) { 3285 verticalWeight = o.verticalWeight; 3286 changes |= LAYOUT_CHANGED; 3287 } 3288 if (horizontalMargin != o.horizontalMargin) { 3289 horizontalMargin = o.horizontalMargin; 3290 changes |= LAYOUT_CHANGED; 3291 } 3292 if (verticalMargin != o.verticalMargin) { 3293 verticalMargin = o.verticalMargin; 3294 changes |= LAYOUT_CHANGED; 3295 } 3296 if (type != o.type) { 3297 type = o.type; 3298 changes |= TYPE_CHANGED; 3299 } 3300 if (flags != o.flags) { 3301 final int diff = flags ^ o.flags; 3302 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) { 3303 changes |= TRANSLUCENT_FLAGS_CHANGED; 3304 } 3305 flags = o.flags; 3306 changes |= FLAGS_CHANGED; 3307 } 3308 if (privateFlags != o.privateFlags) { 3309 privateFlags = o.privateFlags; 3310 changes |= PRIVATE_FLAGS_CHANGED; 3311 } 3312 if (softInputMode != o.softInputMode) { 3313 softInputMode = o.softInputMode; 3314 changes |= SOFT_INPUT_MODE_CHANGED; 3315 } 3316 if (layoutInDisplayCutoutMode != o.layoutInDisplayCutoutMode) { 3317 layoutInDisplayCutoutMode = o.layoutInDisplayCutoutMode; 3318 changes |= LAYOUT_CHANGED; 3319 } 3320 if (gravity != o.gravity) { 3321 gravity = o.gravity; 3322 changes |= LAYOUT_CHANGED; 3323 } 3324 if (format != o.format) { 3325 format = o.format; 3326 changes |= FORMAT_CHANGED; 3327 } 3328 if (windowAnimations != o.windowAnimations) { 3329 windowAnimations = o.windowAnimations; 3330 changes |= ANIMATION_CHANGED; 3331 } 3332 if (token == null) { 3333 // NOTE: token only copied if the recipient doesn't 3334 // already have one. 3335 token = o.token; 3336 } 3337 if (packageName == null) { 3338 // NOTE: packageName only copied if the recipient doesn't 3339 // already have one. 3340 packageName = o.packageName; 3341 } 3342 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) { 3343 // NOTE: mTitle only copied if the originator set one. 3344 mTitle = o.mTitle; 3345 changes |= TITLE_CHANGED; 3346 } 3347 if (alpha != o.alpha) { 3348 alpha = o.alpha; 3349 changes |= ALPHA_CHANGED; 3350 } 3351 if (dimAmount != o.dimAmount) { 3352 dimAmount = o.dimAmount; 3353 changes |= DIM_AMOUNT_CHANGED; 3354 } 3355 if (screenBrightness != o.screenBrightness) { 3356 screenBrightness = o.screenBrightness; 3357 changes |= SCREEN_BRIGHTNESS_CHANGED; 3358 } 3359 if (buttonBrightness != o.buttonBrightness) { 3360 buttonBrightness = o.buttonBrightness; 3361 changes |= BUTTON_BRIGHTNESS_CHANGED; 3362 } 3363 if (rotationAnimation != o.rotationAnimation) { 3364 rotationAnimation = o.rotationAnimation; 3365 changes |= ROTATION_ANIMATION_CHANGED; 3366 } 3367 3368 if (screenOrientation != o.screenOrientation) { 3369 screenOrientation = o.screenOrientation; 3370 changes |= SCREEN_ORIENTATION_CHANGED; 3371 } 3372 3373 if (preferredRefreshRate != o.preferredRefreshRate) { 3374 preferredRefreshRate = o.preferredRefreshRate; 3375 changes |= PREFERRED_REFRESH_RATE_CHANGED; 3376 } 3377 3378 if (preferredDisplayModeId != o.preferredDisplayModeId) { 3379 preferredDisplayModeId = o.preferredDisplayModeId; 3380 changes |= PREFERRED_DISPLAY_MODE_ID; 3381 } 3382 3383 if (systemUiVisibility != o.systemUiVisibility 3384 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) { 3385 systemUiVisibility = o.systemUiVisibility; 3386 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility; 3387 changes |= SYSTEM_UI_VISIBILITY_CHANGED; 3388 } 3389 3390 if (hasSystemUiListeners != o.hasSystemUiListeners) { 3391 hasSystemUiListeners = o.hasSystemUiListeners; 3392 changes |= SYSTEM_UI_LISTENER_CHANGED; 3393 } 3394 3395 if (inputFeatures != o.inputFeatures) { 3396 inputFeatures = o.inputFeatures; 3397 changes |= INPUT_FEATURES_CHANGED; 3398 } 3399 3400 if (userActivityTimeout != o.userActivityTimeout) { 3401 userActivityTimeout = o.userActivityTimeout; 3402 changes |= USER_ACTIVITY_TIMEOUT_CHANGED; 3403 } 3404 3405 if (!surfaceInsets.equals(o.surfaceInsets)) { 3406 surfaceInsets.set(o.surfaceInsets); 3407 changes |= SURFACE_INSETS_CHANGED; 3408 } 3409 3410 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) { 3411 hasManualSurfaceInsets = o.hasManualSurfaceInsets; 3412 changes |= SURFACE_INSETS_CHANGED; 3413 } 3414 3415 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) { 3416 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets; 3417 changes |= SURFACE_INSETS_CHANGED; 3418 } 3419 3420 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) { 3421 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor; 3422 changes |= ACCESSIBILITY_ANCHOR_CHANGED; 3423 } 3424 3425 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle) 3426 && o.accessibilityTitle != null) { 3427 // NOTE: accessibilityTitle only copied if the originator set one. 3428 accessibilityTitle = o.accessibilityTitle; 3429 changes |= ACCESSIBILITY_TITLE_CHANGED; 3430 } 3431 3432 if (mColorMode != o.mColorMode) { 3433 mColorMode = o.mColorMode; 3434 changes |= COLOR_MODE_CHANGED; 3435 } 3436 3437 if (preferMinimalPostProcessing != o.preferMinimalPostProcessing) { 3438 preferMinimalPostProcessing = o.preferMinimalPostProcessing; 3439 changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED; 3440 } 3441 3442 // This can't change, it's only set at window creation time. 3443 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds; 3444 3445 if (insetsFlags.appearance != o.insetsFlags.appearance) { 3446 insetsFlags.appearance = o.insetsFlags.appearance; 3447 changes |= INSET_FLAGS_CHANGED; 3448 } 3449 3450 if (insetsFlags.behavior != o.insetsFlags.behavior) { 3451 insetsFlags.behavior = o.insetsFlags.behavior; 3452 changes |= INSET_FLAGS_CHANGED; 3453 } 3454 3455 if (mFitInsetsTypes != o.mFitInsetsTypes) { 3456 mFitInsetsTypes = o.mFitInsetsTypes; 3457 changes |= LAYOUT_CHANGED; 3458 } 3459 3460 if (mFitInsetsSides != o.mFitInsetsSides) { 3461 mFitInsetsSides = o.mFitInsetsSides; 3462 changes |= LAYOUT_CHANGED; 3463 } 3464 3465 if (mFitInsetsIgnoringVisibility != o.mFitInsetsIgnoringVisibility) { 3466 mFitInsetsIgnoringVisibility = o.mFitInsetsIgnoringVisibility; 3467 changes |= LAYOUT_CHANGED; 3468 } 3469 3470 if (!Arrays.equals(providesInsetsTypes, o.providesInsetsTypes)) { 3471 providesInsetsTypes = o.providesInsetsTypes; 3472 changes |= LAYOUT_CHANGED; 3473 } 3474 3475 return changes; 3476 } 3477 3478 @Override debug(String output)3479 public String debug(String output) { 3480 output += "Contents of " + this + ":"; 3481 Log.d("Debug", output); 3482 output = super.debug(""); 3483 Log.d("Debug", output); 3484 Log.d("Debug", ""); 3485 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}"); 3486 return ""; 3487 } 3488 3489 @Override toString()3490 public String toString() { 3491 return toString(""); 3492 } 3493 3494 /** 3495 * @hide 3496 */ dumpDimensions(StringBuilder sb)3497 public void dumpDimensions(StringBuilder sb) { 3498 sb.append('('); 3499 sb.append(x); 3500 sb.append(','); 3501 sb.append(y); 3502 sb.append(")("); 3503 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT 3504 ? "wrap" : String.valueOf(width)))); 3505 sb.append('x'); 3506 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT 3507 ? "wrap" : String.valueOf(height)))); 3508 sb.append(")"); 3509 } 3510 3511 /** 3512 * @hide 3513 */ toString(String prefix)3514 public String toString(String prefix) { 3515 StringBuilder sb = new StringBuilder(256); 3516 sb.append('{'); 3517 dumpDimensions(sb); 3518 if (horizontalMargin != 0) { 3519 sb.append(" hm="); 3520 sb.append(horizontalMargin); 3521 } 3522 if (verticalMargin != 0) { 3523 sb.append(" vm="); 3524 sb.append(verticalMargin); 3525 } 3526 if (gravity != 0) { 3527 sb.append(" gr="); 3528 sb.append(Gravity.toString(gravity)); 3529 } 3530 if (softInputMode != 0) { 3531 sb.append(" sim={"); 3532 sb.append(softInputModeToString(softInputMode)); 3533 sb.append('}'); 3534 } 3535 if (layoutInDisplayCutoutMode != 0) { 3536 sb.append(" layoutInDisplayCutoutMode="); 3537 sb.append(layoutInDisplayCutoutModeToString(layoutInDisplayCutoutMode)); 3538 } 3539 sb.append(" ty="); 3540 sb.append(ViewDebug.intToString(LayoutParams.class, "type", type)); 3541 if (format != PixelFormat.OPAQUE) { 3542 sb.append(" fmt="); 3543 sb.append(PixelFormat.formatToString(format)); 3544 } 3545 if (windowAnimations != 0) { 3546 sb.append(" wanim=0x"); 3547 sb.append(Integer.toHexString(windowAnimations)); 3548 } 3549 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) { 3550 sb.append(" or="); 3551 sb.append(ActivityInfo.screenOrientationToString(screenOrientation)); 3552 } 3553 if (alpha != 1.0f) { 3554 sb.append(" alpha="); 3555 sb.append(alpha); 3556 } 3557 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) { 3558 sb.append(" sbrt="); 3559 sb.append(screenBrightness); 3560 } 3561 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) { 3562 sb.append(" bbrt="); 3563 sb.append(buttonBrightness); 3564 } 3565 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) { 3566 sb.append(" rotAnim="); 3567 sb.append(rotationAnimationToString(rotationAnimation)); 3568 } 3569 if (preferredRefreshRate != 0) { 3570 sb.append(" preferredRefreshRate="); 3571 sb.append(preferredRefreshRate); 3572 } 3573 if (preferredDisplayModeId != 0) { 3574 sb.append(" preferredDisplayMode="); 3575 sb.append(preferredDisplayModeId); 3576 } 3577 if (hasSystemUiListeners) { 3578 sb.append(" sysuil="); 3579 sb.append(hasSystemUiListeners); 3580 } 3581 if (inputFeatures != 0) { 3582 sb.append(" if=").append(inputFeatureToString(inputFeatures)); 3583 } 3584 if (userActivityTimeout >= 0) { 3585 sb.append(" userActivityTimeout=").append(userActivityTimeout); 3586 } 3587 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 || 3588 surfaceInsets.bottom != 0 || hasManualSurfaceInsets 3589 || !preservePreviousSurfaceInsets) { 3590 sb.append(" surfaceInsets=").append(surfaceInsets); 3591 if (hasManualSurfaceInsets) { 3592 sb.append(" (manual)"); 3593 } 3594 if (!preservePreviousSurfaceInsets) { 3595 sb.append(" (!preservePreviousSurfaceInsets)"); 3596 } 3597 } 3598 if (mColorMode != COLOR_MODE_DEFAULT) { 3599 sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode)); 3600 } 3601 if (preferMinimalPostProcessing) { 3602 sb.append(" preferMinimalPostProcessing="); 3603 sb.append(preferMinimalPostProcessing); 3604 } 3605 sb.append(System.lineSeparator()); 3606 sb.append(prefix).append(" fl=").append( 3607 ViewDebug.flagsToString(LayoutParams.class, "flags", flags)); 3608 if (privateFlags != 0) { 3609 sb.append(System.lineSeparator()); 3610 sb.append(prefix).append(" pfl=").append(ViewDebug.flagsToString( 3611 LayoutParams.class, "privateFlags", privateFlags)); 3612 } 3613 if (systemUiVisibility != 0) { 3614 sb.append(System.lineSeparator()); 3615 sb.append(prefix).append(" sysui=").append(ViewDebug.flagsToString( 3616 View.class, "mSystemUiVisibility", systemUiVisibility)); 3617 } 3618 if (subtreeSystemUiVisibility != 0) { 3619 sb.append(System.lineSeparator()); 3620 sb.append(prefix).append(" vsysui=").append(ViewDebug.flagsToString( 3621 View.class, "mSystemUiVisibility", subtreeSystemUiVisibility)); 3622 } 3623 if (insetsFlags.appearance != 0) { 3624 sb.append(System.lineSeparator()); 3625 sb.append(prefix).append(" apr=").append(ViewDebug.flagsToString( 3626 InsetsFlags.class, "appearance", insetsFlags.appearance)); 3627 } 3628 if (insetsFlags.behavior != 0) { 3629 sb.append(System.lineSeparator()); 3630 sb.append(prefix).append(" bhv=").append(ViewDebug.flagsToString( 3631 InsetsFlags.class, "behavior", insetsFlags.behavior)); 3632 } 3633 if (mFitInsetsTypes != 0) { 3634 sb.append(System.lineSeparator()); 3635 sb.append(prefix).append(" fitTypes=").append(ViewDebug.flagsToString( 3636 LayoutParams.class, "mFitInsetsTypes", mFitInsetsTypes)); 3637 } 3638 if (mFitInsetsSides != Side.all()) { 3639 sb.append(System.lineSeparator()); 3640 sb.append(prefix).append(" fitSides=").append(ViewDebug.flagsToString( 3641 LayoutParams.class, "mFitInsetsSides", mFitInsetsSides)); 3642 } 3643 if (mFitInsetsIgnoringVisibility) { 3644 sb.append(System.lineSeparator()); 3645 sb.append(prefix).append(" fitIgnoreVis"); 3646 } 3647 if (providesInsetsTypes != null) { 3648 sb.append(System.lineSeparator()); 3649 sb.append(prefix).append(" insetsTypes="); 3650 for (int i = 0; i < providesInsetsTypes.length; ++i) { 3651 if (i > 0) sb.append(' '); 3652 sb.append(InsetsState.typeToString(providesInsetsTypes[i])); 3653 } 3654 } 3655 3656 sb.append('}'); 3657 return sb.toString(); 3658 } 3659 3660 /** 3661 * @hide 3662 */ dumpDebug(ProtoOutputStream proto, long fieldId)3663 public void dumpDebug(ProtoOutputStream proto, long fieldId) { 3664 final long token = proto.start(fieldId); 3665 proto.write(TYPE, type); 3666 proto.write(X, x); 3667 proto.write(Y, y); 3668 proto.write(WIDTH, width); 3669 proto.write(HEIGHT, height); 3670 proto.write(HORIZONTAL_MARGIN, horizontalMargin); 3671 proto.write(VERTICAL_MARGIN, verticalMargin); 3672 proto.write(GRAVITY, gravity); 3673 proto.write(SOFT_INPUT_MODE, softInputMode); 3674 proto.write(FORMAT, format); 3675 proto.write(WINDOW_ANIMATIONS, windowAnimations); 3676 proto.write(ALPHA, alpha); 3677 proto.write(SCREEN_BRIGHTNESS, screenBrightness); 3678 proto.write(BUTTON_BRIGHTNESS, buttonBrightness); 3679 proto.write(ROTATION_ANIMATION, rotationAnimation); 3680 proto.write(PREFERRED_REFRESH_RATE, preferredRefreshRate); 3681 proto.write(WindowLayoutParamsProto.PREFERRED_DISPLAY_MODE_ID, preferredDisplayModeId); 3682 proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners); 3683 proto.write(INPUT_FEATURE_FLAGS, inputFeatures); 3684 proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout); 3685 proto.write(COLOR_MODE, mColorMode); 3686 proto.write(FLAGS, flags); 3687 proto.write(PRIVATE_FLAGS, privateFlags); 3688 proto.write(SYSTEM_UI_VISIBILITY_FLAGS, systemUiVisibility); 3689 proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility); 3690 proto.write(APPEARANCE, insetsFlags.appearance); 3691 proto.write(BEHAVIOR, insetsFlags.behavior); 3692 proto.write(FIT_INSETS_TYPES, mFitInsetsTypes); 3693 proto.write(FIT_INSETS_SIDES, mFitInsetsSides); 3694 proto.write(FIT_IGNORE_VISIBILITY, mFitInsetsIgnoringVisibility); 3695 proto.end(token); 3696 } 3697 3698 /** 3699 * Scale the layout params' coordinates and size. 3700 * @hide 3701 */ scale(float scale)3702 public void scale(float scale) { 3703 x = (int) (x * scale + 0.5f); 3704 y = (int) (y * scale + 0.5f); 3705 if (width > 0) { 3706 width = (int) (width * scale + 0.5f); 3707 } 3708 if (height > 0) { 3709 height = (int) (height * scale + 0.5f); 3710 } 3711 } 3712 3713 /** 3714 * Backup the layout parameters used in compatibility mode. 3715 * @see LayoutParams#restore() 3716 */ 3717 @UnsupportedAppUsage backup()3718 void backup() { 3719 int[] backup = mCompatibilityParamsBackup; 3720 if (backup == null) { 3721 // we backup 4 elements, x, y, width, height 3722 backup = mCompatibilityParamsBackup = new int[4]; 3723 } 3724 backup[0] = x; 3725 backup[1] = y; 3726 backup[2] = width; 3727 backup[3] = height; 3728 } 3729 3730 /** 3731 * Restore the layout params' coordinates, size and gravity 3732 * @see LayoutParams#backup() 3733 */ 3734 @UnsupportedAppUsage restore()3735 void restore() { 3736 int[] backup = mCompatibilityParamsBackup; 3737 if (backup != null) { 3738 x = backup[0]; 3739 y = backup[1]; 3740 width = backup[2]; 3741 height = backup[3]; 3742 } 3743 } 3744 3745 private CharSequence mTitle = null; 3746 3747 /** @hide */ 3748 @Override encodeProperties(@onNull ViewHierarchyEncoder encoder)3749 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) { 3750 super.encodeProperties(encoder); 3751 3752 encoder.addProperty("x", x); 3753 encoder.addProperty("y", y); 3754 encoder.addProperty("horizontalWeight", horizontalWeight); 3755 encoder.addProperty("verticalWeight", verticalWeight); 3756 encoder.addProperty("type", type); 3757 encoder.addProperty("flags", flags); 3758 } 3759 3760 /** 3761 * @hide 3762 * @return True if the layout parameters will cause the window to cover the full screen; 3763 * false otherwise. 3764 */ isFullscreen()3765 public boolean isFullscreen() { 3766 return x == 0 && y == 0 3767 && width == WindowManager.LayoutParams.MATCH_PARENT 3768 && height == WindowManager.LayoutParams.MATCH_PARENT; 3769 } 3770 layoutInDisplayCutoutModeToString( @ayoutInDisplayCutoutMode int mode)3771 private static String layoutInDisplayCutoutModeToString( 3772 @LayoutInDisplayCutoutMode int mode) { 3773 switch (mode) { 3774 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT: 3775 return "default"; 3776 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS: 3777 return "always"; 3778 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER: 3779 return "never"; 3780 case LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES: 3781 return "shortEdges"; 3782 default: 3783 return "unknown(" + mode + ")"; 3784 } 3785 } 3786 softInputModeToString(@oftInputModeFlags int softInputMode)3787 private static String softInputModeToString(@SoftInputModeFlags int softInputMode) { 3788 final StringBuilder result = new StringBuilder(); 3789 final int state = softInputMode & SOFT_INPUT_MASK_STATE; 3790 if (state != 0) { 3791 result.append("state="); 3792 switch (state) { 3793 case SOFT_INPUT_STATE_UNCHANGED: 3794 result.append("unchanged"); 3795 break; 3796 case SOFT_INPUT_STATE_HIDDEN: 3797 result.append("hidden"); 3798 break; 3799 case SOFT_INPUT_STATE_ALWAYS_HIDDEN: 3800 result.append("always_hidden"); 3801 break; 3802 case SOFT_INPUT_STATE_VISIBLE: 3803 result.append("visible"); 3804 break; 3805 case SOFT_INPUT_STATE_ALWAYS_VISIBLE: 3806 result.append("always_visible"); 3807 break; 3808 default: 3809 result.append(state); 3810 break; 3811 } 3812 result.append(' '); 3813 } 3814 final int adjust = softInputMode & SOFT_INPUT_MASK_ADJUST; 3815 if (adjust != 0) { 3816 result.append("adjust="); 3817 switch (adjust) { 3818 case SOFT_INPUT_ADJUST_RESIZE: 3819 result.append("resize"); 3820 break; 3821 case SOFT_INPUT_ADJUST_PAN: 3822 result.append("pan"); 3823 break; 3824 case SOFT_INPUT_ADJUST_NOTHING: 3825 result.append("nothing"); 3826 break; 3827 default: 3828 result.append(adjust); 3829 break; 3830 } 3831 result.append(' '); 3832 } 3833 if ((softInputMode & SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) { 3834 result.append("forwardNavigation").append(' '); 3835 } 3836 result.deleteCharAt(result.length() - 1); 3837 return result.toString(); 3838 } 3839 rotationAnimationToString(int rotationAnimation)3840 private static String rotationAnimationToString(int rotationAnimation) { 3841 switch (rotationAnimation) { 3842 case ROTATION_ANIMATION_UNSPECIFIED: 3843 return "UNSPECIFIED"; 3844 case ROTATION_ANIMATION_ROTATE: 3845 return "ROTATE"; 3846 case ROTATION_ANIMATION_CROSSFADE: 3847 return "CROSSFADE"; 3848 case ROTATION_ANIMATION_JUMPCUT: 3849 return "JUMPCUT"; 3850 case ROTATION_ANIMATION_SEAMLESS: 3851 return "SEAMLESS"; 3852 default: 3853 return Integer.toString(rotationAnimation); 3854 } 3855 } 3856 inputFeatureToString(int inputFeature)3857 private static String inputFeatureToString(int inputFeature) { 3858 switch (inputFeature) { 3859 case INPUT_FEATURE_DISABLE_POINTER_GESTURES: 3860 return "DISABLE_POINTER_GESTURES"; 3861 case INPUT_FEATURE_NO_INPUT_CHANNEL: 3862 return "NO_INPUT_CHANNEL"; 3863 case INPUT_FEATURE_DISABLE_USER_ACTIVITY: 3864 return "DISABLE_USER_ACTIVITY"; 3865 default: 3866 return Integer.toString(inputFeature); 3867 } 3868 } 3869 } 3870 } 3871