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 android.annotation.NonNull; 20 import android.annotation.SystemApi; 21 import android.app.Presentation; 22 import android.content.Context; 23 import android.content.pm.ActivityInfo; 24 import android.graphics.PixelFormat; 25 import android.graphics.Rect; 26 import android.os.IBinder; 27 import android.os.Parcel; 28 import android.os.Parcelable; 29 import android.text.TextUtils; 30 import android.util.Log; 31 32 import java.util.List; 33 import java.util.Objects; 34 35 /** 36 * The interface that apps use to talk to the window manager. 37 * <p> 38 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these. 39 * </p><p> 40 * Each window manager instance is bound to a particular {@link Display}. 41 * To obtain a {@link WindowManager} for a different display, use 42 * {@link Context#createDisplayContext} to obtain a {@link Context} for that 43 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> 44 * to get the WindowManager. 45 * </p><p> 46 * The simplest way to show a window on another display is to create a 47 * {@link Presentation}. The presentation will automatically obtain a 48 * {@link WindowManager} and {@link Context} for that display. 49 * </p> 50 * 51 * @see android.content.Context#getSystemService 52 * @see android.content.Context#WINDOW_SERVICE 53 */ 54 public interface WindowManager extends ViewManager { 55 56 /** @hide */ 57 int DOCKED_INVALID = -1; 58 /** @hide */ 59 int DOCKED_LEFT = 1; 60 /** @hide */ 61 int DOCKED_TOP = 2; 62 /** @hide */ 63 int DOCKED_RIGHT = 3; 64 /** @hide */ 65 int DOCKED_BOTTOM = 4; 66 67 /** 68 * Exception that is thrown when trying to add view whose 69 * {@link LayoutParams} {@link LayoutParams#token} 70 * is invalid. 71 */ 72 public static class BadTokenException extends RuntimeException { 73 public BadTokenException() { 74 } 75 76 public BadTokenException(String name) { 77 super(name); 78 } 79 } 80 81 /** 82 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot 83 * be found. See {@link android.app.Presentation} for more information on secondary displays. 84 */ 85 public static class InvalidDisplayException extends RuntimeException { 86 public InvalidDisplayException() { 87 } 88 89 public InvalidDisplayException(String name) { 90 super(name); 91 } 92 } 93 94 /** 95 * Returns the {@link Display} upon which this {@link WindowManager} instance 96 * will create new windows. 97 * <p> 98 * Despite the name of this method, the display that is returned is not 99 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}). 100 * The returned display could instead be a secondary display that this 101 * window manager instance is managing. Think of it as the display that 102 * this {@link WindowManager} instance uses by default. 103 * </p><p> 104 * To create windows on a different display, you need to obtain a 105 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager} 106 * class documentation for more information.) 107 * </p> 108 * 109 * @return The display that this window manager is managing. 110 */ 111 public Display getDefaultDisplay(); 112 113 /** 114 * Special variation of {@link #removeView} that immediately invokes 115 * the given view hierarchy's {@link View#onDetachedFromWindow() 116 * View.onDetachedFromWindow()} methods before returning. This is not 117 * for normal applications; using it correctly requires great care. 118 * 119 * @param view The view to be removed. 120 */ 121 public void removeViewImmediate(View view); 122 123 /** 124 * Used to asynchronously request Keyboard Shortcuts from the focused window. 125 * 126 * @hide 127 */ 128 public interface KeyboardShortcutsReceiver { 129 /** 130 * Callback used when the focused window keyboard shortcuts are ready to be displayed. 131 * 132 * @param result The keyboard shortcuts to be displayed. 133 */ 134 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result); 135 } 136 137 /** 138 * Message for taking fullscreen screenshot 139 * @hide 140 */ 141 final int TAKE_SCREENSHOT_FULLSCREEN = 1; 142 143 /** 144 * Message for taking screenshot of selected region. 145 * @hide 146 */ 147 final int TAKE_SCREENSHOT_SELECTED_REGION = 2; 148 149 /** 150 * @hide 151 */ 152 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array"; 153 154 /** 155 * Request for keyboard shortcuts to be retrieved asynchronously. 156 * 157 * @param receiver The callback to be triggered when the result is ready. 158 * 159 * @hide 160 */ 161 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId); 162 163 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable { 164 /** 165 * X position for this window. With the default gravity it is ignored. 166 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or 167 * {@link Gravity#END} it provides an offset from the given edge. 168 */ 169 @ViewDebug.ExportedProperty 170 public int x; 171 172 /** 173 * Y position for this window. With the default gravity it is ignored. 174 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides 175 * an offset from the given edge. 176 */ 177 @ViewDebug.ExportedProperty 178 public int y; 179 180 /** 181 * Indicates how much of the extra space will be allocated horizontally 182 * to the view associated with these LayoutParams. Specify 0 if the view 183 * should not be stretched. Otherwise the extra pixels will be pro-rated 184 * among all views whose weight is greater than 0. 185 */ 186 @ViewDebug.ExportedProperty 187 public float horizontalWeight; 188 189 /** 190 * Indicates how much of the extra space will be allocated vertically 191 * to the view associated with these LayoutParams. Specify 0 if the view 192 * should not be stretched. Otherwise the extra pixels will be pro-rated 193 * among all views whose weight is greater than 0. 194 */ 195 @ViewDebug.ExportedProperty 196 public float verticalWeight; 197 198 /** 199 * The general type of window. There are three main classes of 200 * window types: 201 * <ul> 202 * <li> <strong>Application windows</strong> (ranging from 203 * {@link #FIRST_APPLICATION_WINDOW} to 204 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application 205 * windows. For these types of windows, the {@link #token} must be 206 * set to the token of the activity they are a part of (this will 207 * normally be done for you if {@link #token} is null). 208 * <li> <strong>Sub-windows</strong> (ranging from 209 * {@link #FIRST_SUB_WINDOW} to 210 * {@link #LAST_SUB_WINDOW}) are associated with another top-level 211 * window. For these types of windows, the {@link #token} must be 212 * the token of the window it is attached to. 213 * <li> <strong>System windows</strong> (ranging from 214 * {@link #FIRST_SYSTEM_WINDOW} to 215 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for 216 * use by the system for specific purposes. They should not normally 217 * be used by applications, and a special permission is required 218 * to use them. 219 * </ul> 220 * 221 * @see #TYPE_BASE_APPLICATION 222 * @see #TYPE_APPLICATION 223 * @see #TYPE_APPLICATION_STARTING 224 * @see #TYPE_APPLICATION_PANEL 225 * @see #TYPE_APPLICATION_MEDIA 226 * @see #TYPE_APPLICATION_SUB_PANEL 227 * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL 228 * @see #TYPE_APPLICATION_ATTACHED_DIALOG 229 * @see #TYPE_STATUS_BAR 230 * @see #TYPE_SEARCH_BAR 231 * @see #TYPE_PHONE 232 * @see #TYPE_SYSTEM_ALERT 233 * @see #TYPE_TOAST 234 * @see #TYPE_SYSTEM_OVERLAY 235 * @see #TYPE_PRIORITY_PHONE 236 * @see #TYPE_STATUS_BAR_PANEL 237 * @see #TYPE_SYSTEM_DIALOG 238 * @see #TYPE_KEYGUARD_DIALOG 239 * @see #TYPE_SYSTEM_ERROR 240 * @see #TYPE_INPUT_METHOD 241 * @see #TYPE_INPUT_METHOD_DIALOG 242 */ 243 @ViewDebug.ExportedProperty(mapping = { 244 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"), 245 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"), 246 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"), 247 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"), 248 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"), 249 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"), 250 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL, to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"), 251 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"), 252 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"), 253 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"), 254 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"), 255 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"), 256 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"), 257 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"), 258 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"), 259 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"), 260 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"), 261 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"), 262 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"), 263 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"), 264 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"), 265 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"), 266 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"), 267 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"), 268 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"), 269 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"), 270 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"), 271 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"), 272 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"), 273 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"), 274 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER, to = "TYPE_INPUT_CONSUMER"), 275 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"), 276 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"), 277 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"), 278 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"), 279 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"), 280 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"), 281 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"), 282 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, to = "TYPE_DOCK_DIVIDER"), 283 @ViewDebug.IntToString(from = TYPE_QS_DIALOG, to = "TYPE_QS_DIALOG"), 284 @ViewDebug.IntToString(from = TYPE_SCREENSHOT, to = "TYPE_SCREENSHOT") 285 }) 286 public int type; 287 288 /** 289 * Start of window types that represent normal application windows. 290 */ 291 public static final int FIRST_APPLICATION_WINDOW = 1; 292 293 /** 294 * Window type: an application window that serves as the "base" window 295 * of the overall application; all other application windows will 296 * appear on top of it. 297 * In multiuser systems shows only on the owning user's window. 298 */ 299 public static final int TYPE_BASE_APPLICATION = 1; 300 301 /** 302 * Window type: a normal application window. The {@link #token} must be 303 * an Activity token identifying who the window belongs to. 304 * In multiuser systems shows only on the owning user's window. 305 */ 306 public static final int TYPE_APPLICATION = 2; 307 308 /** 309 * Window type: special application window that is displayed while the 310 * application is starting. Not for use by applications themselves; 311 * this is used by the system to display something until the 312 * application can show its own windows. 313 * In multiuser systems shows on all users' windows. 314 */ 315 public static final int TYPE_APPLICATION_STARTING = 3; 316 317 /** 318 * End of types of application windows. 319 */ 320 public static final int LAST_APPLICATION_WINDOW = 99; 321 322 /** 323 * Start of types of sub-windows. The {@link #token} of these windows 324 * must be set to the window they are attached to. These types of 325 * windows are kept next to their attached window in Z-order, and their 326 * coordinate space is relative to their attached window. 327 */ 328 public static final int FIRST_SUB_WINDOW = 1000; 329 330 /** 331 * Window type: a panel on top of an application window. These windows 332 * appear on top of their attached window. 333 */ 334 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW; 335 336 /** 337 * Window type: window for showing media (such as video). These windows 338 * are displayed behind their attached window. 339 */ 340 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1; 341 342 /** 343 * Window type: a sub-panel on top of an application window. These 344 * windows are displayed on top their attached window and any 345 * {@link #TYPE_APPLICATION_PANEL} panels. 346 */ 347 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2; 348 349 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout 350 * of the window happens as that of a top-level window, <em>not</em> 351 * as a child of its container. 352 */ 353 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3; 354 355 /** 356 * Window type: window for showing overlays on top of media windows. 357 * These windows are displayed between TYPE_APPLICATION_MEDIA and the 358 * application window. They should be translucent to be useful. This 359 * is a big ugly hack so: 360 * @hide 361 */ 362 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4; 363 364 /** 365 * Window type: a above sub-panel on top of an application window and it's 366 * sub-panel windows. These windows are displayed on top of their attached window 367 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels. 368 * @hide 369 */ 370 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5; 371 372 /** 373 * End of types of sub-windows. 374 */ 375 public static final int LAST_SUB_WINDOW = 1999; 376 377 /** 378 * Start of system-specific window types. These are not normally 379 * created by applications. 380 */ 381 public static final int FIRST_SYSTEM_WINDOW = 2000; 382 383 /** 384 * Window type: the status bar. There can be only one status bar 385 * window; it is placed at the top of the screen, and all other 386 * windows are shifted down so they are below it. 387 * In multiuser systems shows on all users' windows. 388 */ 389 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW; 390 391 /** 392 * Window type: the search bar. There can be only one search bar 393 * window; it is placed at the top of the screen. 394 * In multiuser systems shows on all users' windows. 395 */ 396 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1; 397 398 /** 399 * Window type: phone. These are non-application windows providing 400 * user interaction with the phone (in particular incoming calls). 401 * These windows are normally placed above all applications, but behind 402 * the status bar. 403 * In multiuser systems shows on all users' windows. 404 */ 405 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; 406 407 /** 408 * Window type: system window, such as low power alert. These windows 409 * are always on top of application windows. 410 * In multiuser systems shows only on the owning user's window. 411 */ 412 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3; 413 414 /** 415 * Window type: keyguard window. 416 * In multiuser systems shows on all users' windows. 417 * @removed 418 */ 419 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4; 420 421 /** 422 * Window type: transient notifications. 423 * In multiuser systems shows only on the owning user's window. 424 */ 425 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5; 426 427 /** 428 * Window type: system overlay windows, which need to be displayed 429 * on top of everything else. These windows must not take input 430 * focus, or they will interfere with the keyguard. 431 * In multiuser systems shows only on the owning user's window. 432 */ 433 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6; 434 435 /** 436 * Window type: priority phone UI, which needs to be displayed even if 437 * the keyguard is active. These windows must not take input 438 * focus, or they will interfere with the keyguard. 439 * In multiuser systems shows on all users' windows. 440 */ 441 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7; 442 443 /** 444 * Window type: panel that slides out from the status bar 445 * In multiuser systems shows on all users' windows. 446 */ 447 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8; 448 449 /** 450 * Window type: dialogs that the keyguard shows 451 * In multiuser systems shows on all users' windows. 452 */ 453 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9; 454 455 /** 456 * Window type: internal system error windows, appear on top of 457 * everything they can. 458 * In multiuser systems shows only on the owning user's window. 459 */ 460 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10; 461 462 /** 463 * Window type: internal input methods windows, which appear above 464 * the normal UI. Application windows may be resized or panned to keep 465 * the input focus visible while this window is displayed. 466 * In multiuser systems shows only on the owning user's window. 467 */ 468 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11; 469 470 /** 471 * Window type: internal input methods dialog windows, which appear above 472 * the current input method window. 473 * In multiuser systems shows only on the owning user's window. 474 */ 475 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12; 476 477 /** 478 * Window type: wallpaper window, placed behind any window that wants 479 * to sit on top of the wallpaper. 480 * In multiuser systems shows only on the owning user's window. 481 */ 482 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13; 483 484 /** 485 * Window type: panel that slides out from over the status bar 486 * In multiuser systems shows on all users' windows. 487 */ 488 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; 489 490 /** 491 * Window type: secure system overlay windows, which need to be displayed 492 * on top of everything else. These windows must not take input 493 * focus, or they will interfere with the keyguard. 494 * 495 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the 496 * system itself is allowed to create these overlays. Applications cannot 497 * obtain permission to create secure system overlays. 498 * 499 * In multiuser systems shows only on the owning user's window. 500 * @hide 501 */ 502 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15; 503 504 /** 505 * Window type: the drag-and-drop pseudowindow. There is only one 506 * drag layer (at most), and it is placed on top of all other windows. 507 * In multiuser systems shows only on the owning user's window. 508 * @hide 509 */ 510 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16; 511 512 /** 513 * Window type: panel that slides out from under the status bar 514 * In multiuser systems shows on all users' windows. 515 * @hide 516 */ 517 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17; 518 519 /** 520 * Window type: (mouse) pointer 521 * In multiuser systems shows on all users' windows. 522 * @hide 523 */ 524 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18; 525 526 /** 527 * Window type: Navigation bar (when distinct from status bar) 528 * In multiuser systems shows on all users' windows. 529 * @hide 530 */ 531 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19; 532 533 /** 534 * Window type: The volume level overlay/dialog shown when the user 535 * changes the system volume. 536 * In multiuser systems shows on all users' windows. 537 * @hide 538 */ 539 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20; 540 541 /** 542 * Window type: The boot progress dialog, goes on top of everything 543 * in the world. 544 * In multiuser systems shows on all users' windows. 545 * @hide 546 */ 547 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21; 548 549 /** 550 * Window type to consume input events when the systemUI bars are hidden. 551 * In multiuser systems shows on all users' windows. 552 * @hide 553 */ 554 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22; 555 556 /** 557 * Window type: Dreams (screen saver) window, just above keyguard. 558 * In multiuser systems shows only on the owning user's window. 559 * @hide 560 */ 561 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23; 562 563 /** 564 * Window type: Navigation bar panel (when navigation bar is distinct from status bar) 565 * In multiuser systems shows on all users' windows. 566 * @hide 567 */ 568 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24; 569 570 /** 571 * Window type: Display overlay window. Used to simulate secondary display devices. 572 * In multiuser systems shows on all users' windows. 573 * @hide 574 */ 575 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26; 576 577 /** 578 * Window type: Magnification overlay window. Used to highlight the magnified 579 * portion of a display when accessibility magnification is enabled. 580 * In multiuser systems shows on all users' windows. 581 * @hide 582 */ 583 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27; 584 585 /** 586 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted. 587 * In multiuser systems shows on all users' windows. 588 * @hide 589 */ 590 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29; 591 592 /** 593 * Window type: Window for Presentation on top of private 594 * virtual display. 595 */ 596 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30; 597 598 /** 599 * Window type: Windows in the voice interaction layer. 600 * @hide 601 */ 602 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31; 603 604 /** 605 * Window type: Windows that are overlaid <em>only</em> by a connected {@link 606 * android.accessibilityservice.AccessibilityService} for interception of 607 * user interactions without changing the windows an accessibility service 608 * can introspect. In particular, an accessibility service can introspect 609 * only windows that a sighted user can interact with which is they can touch 610 * these windows or can type into these windows. For example, if there 611 * is a full screen accessibility overlay that is touchable, the windows 612 * below it will be introspectable by an accessibility service even though 613 * they are covered by a touchable window. 614 */ 615 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32; 616 617 /** 618 * Window type: Starting window for voice interaction layer. 619 * @hide 620 */ 621 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33; 622 623 /** 624 * Window for displaying a handle used for resizing docked stacks. This window is owned 625 * by the system process. 626 * @hide 627 */ 628 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34; 629 630 /** 631 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used 632 * by Quick Settings Tiles. 633 * @hide 634 */ 635 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35; 636 637 /** 638 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is 639 * reserved for screenshot region selection. 640 * @hide 641 */ 642 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36; 643 644 /** 645 * End of types of system windows. 646 */ 647 public static final int LAST_SYSTEM_WINDOW = 2999; 648 649 /** @deprecated this is ignored, this value is set automatically when needed. */ 650 @Deprecated 651 public static final int MEMORY_TYPE_NORMAL = 0; 652 /** @deprecated this is ignored, this value is set automatically when needed. */ 653 @Deprecated 654 public static final int MEMORY_TYPE_HARDWARE = 1; 655 /** @deprecated this is ignored, this value is set automatically when needed. */ 656 @Deprecated 657 public static final int MEMORY_TYPE_GPU = 2; 658 /** @deprecated this is ignored, this value is set automatically when needed. */ 659 @Deprecated 660 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; 661 662 /** 663 * @deprecated this is ignored 664 */ 665 @Deprecated 666 public int memoryType; 667 668 /** Window flag: as long as this window is visible to the user, allow 669 * the lock screen to activate while the screen is on. 670 * This can be used independently, or in combination with 671 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */ 672 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001; 673 674 /** Window flag: everything behind this window will be dimmed. 675 * Use {@link #dimAmount} to control the amount of dim. */ 676 public static final int FLAG_DIM_BEHIND = 0x00000002; 677 678 /** Window flag: blur everything behind this window. 679 * @deprecated Blurring is no longer supported. */ 680 @Deprecated 681 public static final int FLAG_BLUR_BEHIND = 0x00000004; 682 683 /** Window flag: this window won't ever get key input focus, so the 684 * user can not send key or other button events to it. Those will 685 * instead go to whatever focusable window is behind it. This flag 686 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that 687 * is explicitly set. 688 * 689 * <p>Setting this flag also implies that the window will not need to 690 * interact with 691 * a soft input method, so it will be Z-ordered and positioned 692 * independently of any active input method (typically this means it 693 * gets Z-ordered on top of the input method, so it can use the full 694 * screen for its content and cover the input method if needed. You 695 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */ 696 public static final int FLAG_NOT_FOCUSABLE = 0x00000008; 697 698 /** Window flag: this window can never receive touch events. */ 699 public static final int FLAG_NOT_TOUCHABLE = 0x00000010; 700 701 /** Window flag: even when this window is focusable (its 702 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events 703 * outside of the window to be sent to the windows behind it. Otherwise 704 * it will consume all pointer events itself, regardless of whether they 705 * are inside of the window. */ 706 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020; 707 708 /** Window flag: when set, if the device is asleep when the touch 709 * screen is pressed, you will receive this first touch event. Usually 710 * the first touch event is consumed by the system since the user can 711 * not see what they are pressing on. 712 * 713 * @deprecated This flag has no effect. 714 */ 715 @Deprecated 716 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040; 717 718 /** Window flag: as long as this window is visible to the user, keep 719 * the device's screen turned on and bright. */ 720 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080; 721 722 /** Window flag: place the window within the entire screen, ignoring 723 * decorations around the border (such as the status bar). The 724 * window must correctly position its contents to take the screen 725 * decoration into account. This flag is normally set for you 726 * by Window as described in {@link Window#setFlags}. */ 727 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100; 728 729 /** Window flag: allow window to extend outside of the screen. */ 730 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200; 731 732 /** 733 * Window flag: hide all screen decorations (such as the status bar) while 734 * this window is displayed. This allows the window to use the entire 735 * display space for itself -- the status bar will be hidden when 736 * an app window with this flag set is on the top layer. A fullscreen window 737 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's 738 * {@link #softInputMode} field; the window will stay fullscreen 739 * and will not resize. 740 * 741 * <p>This flag can be controlled in your theme through the 742 * {@link android.R.attr#windowFullscreen} attribute; this attribute 743 * is automatically set for you in the standard fullscreen themes 744 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen}, 745 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen}, 746 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen}, 747 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen}, 748 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen}, 749 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and 750 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p> 751 */ 752 public static final int FLAG_FULLSCREEN = 0x00000400; 753 754 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the 755 * screen decorations (such as the status bar) to be shown. */ 756 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; 757 758 /** Window flag: turn on dithering when compositing this window to 759 * the screen. 760 * @deprecated This flag is no longer used. */ 761 @Deprecated 762 public static final int FLAG_DITHER = 0x00001000; 763 764 /** Window flag: treat the content of the window as secure, preventing 765 * it from appearing in screenshots or from being viewed on non-secure 766 * displays. 767 * 768 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about 769 * secure surfaces and secure displays. 770 */ 771 public static final int FLAG_SECURE = 0x00002000; 772 773 /** Window flag: a special mode where the layout parameters are used 774 * to perform scaling of the surface when it is composited to the 775 * screen. */ 776 public static final int FLAG_SCALED = 0x00004000; 777 778 /** Window flag: intended for windows that will often be used when the user is 779 * holding the screen against their face, it will aggressively filter the event 780 * stream to prevent unintended presses in this situation that may not be 781 * desired for a particular window, when such an event stream is detected, the 782 * application will receive a CANCEL motion event to indicate this so applications 783 * can handle this accordingly by taking no action on the event 784 * until the finger is released. */ 785 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000; 786 787 /** Window flag: a special option only for use in combination with 788 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the 789 * screen your window may appear on top of or behind screen decorations 790 * such as the status bar. By also including this flag, the window 791 * manager will report the inset rectangle needed to ensure your 792 * content is not covered by screen decorations. This flag is normally 793 * set for you by Window as described in {@link Window#setFlags}.*/ 794 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; 795 796 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with 797 * respect to how this window interacts with the current method. That 798 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the 799 * window will behave as if it needs to interact with the input method 800 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is 801 * not set and this flag is set, then the window will behave as if it 802 * doesn't need to interact with the input method and can be placed 803 * to use more space and cover the input method. 804 */ 805 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; 806 807 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you 808 * can set this flag to receive a single special MotionEvent with 809 * the action 810 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for 811 * touches that occur outside of your window. Note that you will not 812 * receive the full down/move/up gesture, only the location of the 813 * first down as an ACTION_OUTSIDE. 814 */ 815 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000; 816 817 /** Window flag: special flag to let windows be shown when the screen 818 * is locked. This will let application windows take precedence over 819 * key guard or any other lock screens. Can be used with 820 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows 821 * directly before showing the key guard window. Can be used with 822 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss 823 * non-secure keyguards. This flag only applies to the top-most 824 * full-screen window. 825 */ 826 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000; 827 828 /** Window flag: ask that the system wallpaper be shown behind 829 * your window. The window surface must be translucent to be able 830 * to actually see the wallpaper behind it; this flag just ensures 831 * that the wallpaper surface will be there if this window actually 832 * has translucent regions. 833 * 834 * <p>This flag can be controlled in your theme through the 835 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute 836 * is automatically set for you in the standard wallpaper themes 837 * such as {@link android.R.style#Theme_Wallpaper}, 838 * {@link android.R.style#Theme_Wallpaper_NoTitleBar}, 839 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen}, 840 * {@link android.R.style#Theme_Holo_Wallpaper}, 841 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar}, 842 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and 843 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p> 844 */ 845 public static final int FLAG_SHOW_WALLPAPER = 0x00100000; 846 847 /** Window flag: when set as a window is being added or made 848 * visible, once the window has been shown then the system will 849 * poke the power manager's user activity (as if the user had woken 850 * up the device) to turn the screen on. */ 851 public static final int FLAG_TURN_SCREEN_ON = 0x00200000; 852 853 /** Window flag: when set the window will cause the keyguard to 854 * be dismissed, only if it is not a secure lock keyguard. Because such 855 * a keyguard is not needed for security, it will never re-appear if 856 * the user navigates to another window (in contrast to 857 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily 858 * hide both secure and non-secure keyguards but ensure they reappear 859 * when the user moves to another UI that doesn't hide them). 860 * If the keyguard is currently active and is secure (requires an 861 * unlock pattern) than the user will still need to confirm it before 862 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has 863 * also been set. 864 */ 865 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000; 866 867 /** Window flag: when set the window will accept for touch events 868 * outside of its bounds to be sent to other windows that also 869 * support split touch. When this flag is not set, the first pointer 870 * that goes down determines the window to which all subsequent touches 871 * go until all pointers go up. When this flag is set, each pointer 872 * (not necessarily the first) that goes down determines the window 873 * to which all subsequent touches of that pointer will go until that 874 * pointer goes up thereby enabling touches with multiple pointers 875 * to be split across multiple windows. 876 */ 877 public static final int FLAG_SPLIT_TOUCH = 0x00800000; 878 879 /** 880 * <p>Indicates whether this window should be hardware accelerated. 881 * Requesting hardware acceleration does not guarantee it will happen.</p> 882 * 883 * <p>This flag can be controlled programmatically <em>only</em> to enable 884 * hardware acceleration. To enable hardware acceleration for a given 885 * window programmatically, do the following:</p> 886 * 887 * <pre> 888 * Window w = activity.getWindow(); // in Activity's onCreate() for instance 889 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, 890 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); 891 * </pre> 892 * 893 * <p>It is important to remember that this flag <strong>must</strong> 894 * be set before setting the content view of your activity or dialog.</p> 895 * 896 * <p>This flag cannot be used to disable hardware acceleration after it 897 * was enabled in your manifest using 898 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively 899 * and programmatically disable hardware acceleration (for automated testing 900 * for instance), make sure it is turned off in your manifest and enable it 901 * on your activity or dialog when you need it instead, using the method 902 * described above.</p> 903 * 904 * <p>This flag is automatically set by the system if the 905 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated} 906 * XML attribute is set to true on an activity or on the application.</p> 907 */ 908 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000; 909 910 /** 911 * Window flag: allow window contents to extend in to the screen's 912 * overscan area, if there is one. The window should still correctly 913 * position its contents to take the overscan area into account. 914 * 915 * <p>This flag can be controlled in your theme through the 916 * {@link android.R.attr#windowOverscan} attribute; this attribute 917 * is automatically set for you in the standard overscan themes 918 * such as 919 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan}, 920 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan}, 921 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and 922 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p> 923 * 924 * <p>When this flag is enabled for a window, its normal content may be obscured 925 * to some degree by the overscan region of the display. To ensure key parts of 926 * that content are visible to the user, you can use 927 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)} 928 * to set the point in the view hierarchy where the appropriate offsets should 929 * be applied. (This can be done either by directly calling this function, using 930 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy, 931 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect) 932 * View.fitSystemWindows(Rect)} method).</p> 933 * 934 * <p>This mechanism for positioning content elements is identical to its equivalent 935 * use with layout and {@link View#setSystemUiVisibility(int) 936 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly 937 * position its UI elements with this overscan flag is set:</p> 938 * 939 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete} 940 */ 941 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000; 942 943 /** 944 * Window flag: request a translucent status bar with minimal system-provided 945 * background protection. 946 * 947 * <p>This flag can be controlled in your theme through the 948 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute 949 * is automatically set for you in the standard translucent decor themes 950 * such as 951 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor}, 952 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor}, 953 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and 954 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p> 955 * 956 * <p>When this flag is enabled for a window, it automatically sets 957 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and 958 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p> 959 */ 960 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000; 961 962 /** 963 * Window flag: request a translucent navigation bar with minimal system-provided 964 * background protection. 965 * 966 * <p>This flag can be controlled in your theme through the 967 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute 968 * is automatically set for you in the standard translucent decor themes 969 * such as 970 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor}, 971 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor}, 972 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and 973 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p> 974 * 975 * <p>When this flag is enabled for a window, it automatically sets 976 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and 977 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p> 978 */ 979 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000; 980 981 /** 982 * Flag for a window in local focus mode. 983 * Window in local focus mode can control focus independent of window manager using 984 * {@link Window#setLocalFocus(boolean, boolean)}. 985 * Usually window in this mode will not get touch/key events from window manager, but will 986 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}. 987 */ 988 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000; 989 990 /** Window flag: Enable touches to slide out of a window into neighboring 991 * windows in mid-gesture instead of being captured for the duration of 992 * the gesture. 993 * 994 * This flag changes the behavior of touch focus for this window only. 995 * Touches can slide out of the window but they cannot necessarily slide 996 * back in (unless the other window with touch focus permits it). 997 * 998 * {@hide} 999 */ 1000 public static final int FLAG_SLIPPERY = 0x20000000; 1001 1002 /** 1003 * Window flag: When requesting layout with an attached window, the attached window may 1004 * overlap with the screen decorations of the parent window such as the navigation bar. By 1005 * including this flag, the window manager will layout the attached window within the decor 1006 * frame of the parent window such that it doesn't overlap with screen decorations. 1007 */ 1008 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000; 1009 1010 /** 1011 * Flag indicating that this Window is responsible for drawing the background for the 1012 * system bars. If set, the system bars are drawn with a transparent background and the 1013 * corresponding areas in this window are filled with the colors specified in 1014 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}. 1015 */ 1016 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000; 1017 1018 /** 1019 * Various behavioral options/flags. Default is none. 1020 * 1021 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON 1022 * @see #FLAG_DIM_BEHIND 1023 * @see #FLAG_NOT_FOCUSABLE 1024 * @see #FLAG_NOT_TOUCHABLE 1025 * @see #FLAG_NOT_TOUCH_MODAL 1026 * @see #FLAG_TOUCHABLE_WHEN_WAKING 1027 * @see #FLAG_KEEP_SCREEN_ON 1028 * @see #FLAG_LAYOUT_IN_SCREEN 1029 * @see #FLAG_LAYOUT_NO_LIMITS 1030 * @see #FLAG_FULLSCREEN 1031 * @see #FLAG_FORCE_NOT_FULLSCREEN 1032 * @see #FLAG_SECURE 1033 * @see #FLAG_SCALED 1034 * @see #FLAG_IGNORE_CHEEK_PRESSES 1035 * @see #FLAG_LAYOUT_INSET_DECOR 1036 * @see #FLAG_ALT_FOCUSABLE_IM 1037 * @see #FLAG_WATCH_OUTSIDE_TOUCH 1038 * @see #FLAG_SHOW_WHEN_LOCKED 1039 * @see #FLAG_SHOW_WALLPAPER 1040 * @see #FLAG_TURN_SCREEN_ON 1041 * @see #FLAG_DISMISS_KEYGUARD 1042 * @see #FLAG_SPLIT_TOUCH 1043 * @see #FLAG_HARDWARE_ACCELERATED 1044 * @see #FLAG_LOCAL_FOCUS_MODE 1045 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS 1046 */ 1047 @ViewDebug.ExportedProperty(flagMapping = { 1048 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, 1049 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"), 1050 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND, 1051 name = "FLAG_DIM_BEHIND"), 1052 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND, 1053 name = "FLAG_BLUR_BEHIND"), 1054 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE, 1055 name = "FLAG_NOT_FOCUSABLE"), 1056 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE, 1057 name = "FLAG_NOT_TOUCHABLE"), 1058 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL, 1059 name = "FLAG_NOT_TOUCH_MODAL"), 1060 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING, 1061 name = "FLAG_TOUCHABLE_WHEN_WAKING"), 1062 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON, 1063 name = "FLAG_KEEP_SCREEN_ON"), 1064 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN, 1065 name = "FLAG_LAYOUT_IN_SCREEN"), 1066 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS, 1067 name = "FLAG_LAYOUT_NO_LIMITS"), 1068 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN, 1069 name = "FLAG_FULLSCREEN"), 1070 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN, 1071 name = "FLAG_FORCE_NOT_FULLSCREEN"), 1072 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER, 1073 name = "FLAG_DITHER"), 1074 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE, 1075 name = "FLAG_SECURE"), 1076 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED, 1077 name = "FLAG_SCALED"), 1078 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES, 1079 name = "FLAG_IGNORE_CHEEK_PRESSES"), 1080 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR, 1081 name = "FLAG_LAYOUT_INSET_DECOR"), 1082 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM, 1083 name = "FLAG_ALT_FOCUSABLE_IM"), 1084 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH, 1085 name = "FLAG_WATCH_OUTSIDE_TOUCH"), 1086 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED, 1087 name = "FLAG_SHOW_WHEN_LOCKED"), 1088 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER, 1089 name = "FLAG_SHOW_WALLPAPER"), 1090 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON, 1091 name = "FLAG_TURN_SCREEN_ON"), 1092 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD, 1093 name = "FLAG_DISMISS_KEYGUARD"), 1094 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH, 1095 name = "FLAG_SPLIT_TOUCH"), 1096 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED, 1097 name = "FLAG_HARDWARE_ACCELERATED"), 1098 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE, 1099 name = "FLAG_LOCAL_FOCUS_MODE"), 1100 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS, 1101 name = "FLAG_TRANSLUCENT_STATUS"), 1102 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION, 1103 name = "FLAG_TRANSLUCENT_NAVIGATION"), 1104 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, 1105 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS") 1106 }, formatToHexString = true) 1107 public int flags; 1108 1109 /** 1110 * If the window has requested hardware acceleration, but this is not 1111 * allowed in the process it is in, then still render it as if it is 1112 * hardware accelerated. This is used for the starting preview windows 1113 * in the system process, which don't need to have the overhead of 1114 * hardware acceleration (they are just a static rendering), but should 1115 * be rendered as such to match the actual window of the app even if it 1116 * is hardware accelerated. 1117 * Even if the window isn't hardware accelerated, still do its rendering 1118 * as if it was. 1119 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows 1120 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration 1121 * is generally disabled. This flag must be specified in addition to 1122 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system 1123 * windows. 1124 * 1125 * @hide 1126 */ 1127 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001; 1128 1129 /** 1130 * In the system process, we globally do not use hardware acceleration 1131 * because there are many threads doing UI there and they conflict. 1132 * If certain parts of the UI that really do want to use hardware 1133 * acceleration, this flag can be set to force it. This is basically 1134 * for the lock screen. Anyone else using it, you are probably wrong. 1135 * 1136 * @hide 1137 */ 1138 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002; 1139 1140 /** 1141 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers 1142 * may elect to skip these notifications if they are not doing anything productive with 1143 * them (they do not affect the wallpaper scrolling operation) by calling 1144 * {@link 1145 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}. 1146 * 1147 * @hide 1148 */ 1149 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004; 1150 1151 /** In a multiuser system if this flag is set and the owner is a system process then this 1152 * window will appear on all user screens. This overrides the default behavior of window 1153 * types that normally only appear on the owning user's screen. Refer to each window type 1154 * to determine its default behavior. 1155 * 1156 * {@hide} */ 1157 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010; 1158 1159 /** 1160 * Never animate position changes of the window. 1161 * 1162 * {@hide} */ 1163 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040; 1164 1165 /** Window flag: special flag to limit the size of the window to be 1166 * original size ([320x480] x density). Used to create window for applications 1167 * running under compatibility mode. 1168 * 1169 * {@hide} */ 1170 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080; 1171 1172 /** Window flag: a special option intended for system dialogs. When 1173 * this flag is set, the window will demand focus unconditionally when 1174 * it is created. 1175 * {@hide} */ 1176 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100; 1177 1178 /** Window flag: maintain the previous translucent decor state when this window 1179 * becomes top-most. 1180 * {@hide} */ 1181 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200; 1182 1183 /** 1184 * Flag whether the current window is a keyguard window, meaning that it will hide all other 1185 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set. 1186 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}. 1187 * {@hide} 1188 */ 1189 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400; 1190 1191 /** 1192 * Flag that prevents the wallpaper behind the current window from receiving touch events. 1193 * 1194 * {@hide} 1195 */ 1196 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800; 1197 1198 /** 1199 * Flag to force the status bar window to be visible all the time. If the bar is hidden when 1200 * this flag is set it will be shown again and the bar will have a transparent background. 1201 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}. 1202 * 1203 * {@hide} 1204 */ 1205 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000; 1206 1207 /** 1208 * Flag indicating that the x, y, width, and height members should be 1209 * ignored (and thus their previous value preserved). For example 1210 * because they are being managed externally through repositionChild. 1211 * 1212 * {@hide} 1213 */ 1214 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000; 1215 1216 /** 1217 * Flag that will make window ignore app visibility and instead depend purely on the decor 1218 * view visibility for determining window visibility. This is used by recents to keep 1219 * drawing after it launches an app. 1220 * @hide 1221 */ 1222 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000; 1223 1224 /** 1225 * Flag to indicate that this window is not expected to be replaced across 1226 * configuration change triggered activity relaunches. In general the WindowManager 1227 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces 1228 * until the replacement is ready to show in order to prevent visual glitch. However 1229 * some windows, such as PopupWindows expect to be cleared across configuration change, 1230 * and thus should hint to the WindowManager that it should not wait for a replacement. 1231 * @hide 1232 */ 1233 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000; 1234 1235 /** 1236 * Flag to indicate that this child window should always be laid-out in the parent 1237 * frame regardless of the current windowing mode configuration. 1238 * @hide 1239 */ 1240 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000; 1241 1242 /** 1243 * Flag to indicate that this window is always drawing the status bar background, no matter 1244 * what the other flags are. 1245 * @hide 1246 */ 1247 public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000; 1248 1249 /** 1250 * Flag to indicate that this window needs Sustained Performance Mode if 1251 * the device supports it. 1252 * @hide 1253 */ 1254 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000; 1255 1256 /** 1257 * Control flags that are private to the platform. 1258 * @hide 1259 */ 1260 public int privateFlags; 1261 1262 /** 1263 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it 1264 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu 1265 * key. For this case, we should look at windows behind it to determine the appropriate 1266 * value. 1267 * 1268 * @hide 1269 */ 1270 public static final int NEEDS_MENU_UNSET = 0; 1271 1272 /** 1273 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a 1274 * menu key. 1275 * 1276 * @hide 1277 */ 1278 public static final int NEEDS_MENU_SET_TRUE = 1; 1279 1280 /** 1281 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't 1282 * needs a menu key. 1283 * 1284 * @hide 1285 */ 1286 public static final int NEEDS_MENU_SET_FALSE = 2; 1287 1288 /** 1289 * State variable for a window belonging to an activity that responds to 1290 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a 1291 * physical button this variable is ignored, but on devices where the Menu key is drawn in 1292 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}. 1293 * 1294 * (Note that Action Bars, when available, are the preferred way to offer additional 1295 * functions otherwise accessed via an options menu.) 1296 * 1297 * {@hide} 1298 */ 1299 public int needsMenuKey = NEEDS_MENU_UNSET; 1300 1301 /** 1302 * Given a particular set of window manager flags, determine whether 1303 * such a window may be a target for an input method when it has 1304 * focus. In particular, this checks the 1305 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM} 1306 * flags and returns true if the combination of the two corresponds 1307 * to a window that needs to be behind the input method so that the 1308 * user can type into it. 1309 * 1310 * @param flags The current window manager flags. 1311 * 1312 * @return Returns true if such a window should be behind/interact 1313 * with an input method, false if not. 1314 */ 1315 public static boolean mayUseInputMethod(int flags) { 1316 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) { 1317 case 0: 1318 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM: 1319 return true; 1320 } 1321 return false; 1322 } 1323 1324 /** 1325 * Mask for {@link #softInputMode} of the bits that determine the 1326 * desired visibility state of the soft input area for this window. 1327 */ 1328 public static final int SOFT_INPUT_MASK_STATE = 0x0f; 1329 1330 /** 1331 * Visibility state for {@link #softInputMode}: no state has been specified. 1332 */ 1333 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; 1334 1335 /** 1336 * Visibility state for {@link #softInputMode}: please don't change the state of 1337 * the soft input area. 1338 */ 1339 public static final int SOFT_INPUT_STATE_UNCHANGED = 1; 1340 1341 /** 1342 * Visibility state for {@link #softInputMode}: please hide any soft input 1343 * area when normally appropriate (when the user is navigating 1344 * forward to your window). 1345 */ 1346 public static final int SOFT_INPUT_STATE_HIDDEN = 2; 1347 1348 /** 1349 * Visibility state for {@link #softInputMode}: please always hide any 1350 * soft input area when this window receives focus. 1351 */ 1352 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; 1353 1354 /** 1355 * Visibility state for {@link #softInputMode}: please show the soft 1356 * input area when normally appropriate (when the user is navigating 1357 * forward to your window). 1358 */ 1359 public static final int SOFT_INPUT_STATE_VISIBLE = 4; 1360 1361 /** 1362 * Visibility state for {@link #softInputMode}: please always make the 1363 * soft input area visible when this window receives input focus. 1364 */ 1365 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; 1366 1367 /** 1368 * Mask for {@link #softInputMode} of the bits that determine the 1369 * way that the window should be adjusted to accommodate the soft 1370 * input window. 1371 */ 1372 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0; 1373 1374 /** Adjustment option for {@link #softInputMode}: nothing specified. 1375 * The system will try to pick one or 1376 * the other depending on the contents of the window. 1377 */ 1378 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00; 1379 1380 /** Adjustment option for {@link #softInputMode}: set to allow the 1381 * window to be resized when an input 1382 * method is shown, so that its contents are not covered by the input 1383 * method. This can <em>not</em> be combined with 1384 * {@link #SOFT_INPUT_ADJUST_PAN}; if 1385 * neither of these are set, then the system will try to pick one or 1386 * the other depending on the contents of the window. If the window's 1387 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this 1388 * value for {@link #softInputMode} will be ignored; the window will 1389 * not resize, but will stay fullscreen. 1390 */ 1391 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10; 1392 1393 /** Adjustment option for {@link #softInputMode}: set to have a window 1394 * pan when an input method is 1395 * shown, so it doesn't need to deal with resizing but just panned 1396 * by the framework to ensure the current input focus is visible. This 1397 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if 1398 * neither of these are set, then the system will try to pick one or 1399 * the other depending on the contents of the window. 1400 */ 1401 public static final int SOFT_INPUT_ADJUST_PAN = 0x20; 1402 1403 /** Adjustment option for {@link #softInputMode}: set to have a window 1404 * not adjust for a shown input method. The window will not be resized, 1405 * and it will not be panned to make its focus visible. 1406 */ 1407 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30; 1408 1409 /** 1410 * Bit for {@link #softInputMode}: set when the user has navigated 1411 * forward to the window. This is normally set automatically for 1412 * you by the system, though you may want to set it in certain cases 1413 * when you are displaying a window yourself. This flag will always 1414 * be cleared automatically after the window is displayed. 1415 */ 1416 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100; 1417 1418 /** 1419 * Desired operating mode for any soft input area. May be any combination 1420 * of: 1421 * 1422 * <ul> 1423 * <li> One of the visibility states 1424 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED}, 1425 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or 1426 * {@link #SOFT_INPUT_STATE_VISIBLE}. 1427 * <li> One of the adjustment options 1428 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, 1429 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or 1430 * {@link #SOFT_INPUT_ADJUST_PAN}. 1431 * </ul> 1432 * 1433 * 1434 * <p>This flag can be controlled in your theme through the 1435 * {@link android.R.attr#windowSoftInputMode} attribute.</p> 1436 */ 1437 public int softInputMode; 1438 1439 /** 1440 * Placement of window within the screen as per {@link Gravity}. Both 1441 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, 1442 * android.graphics.Rect) Gravity.apply} and 1443 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) 1444 * Gravity.applyDisplay} are used during window layout, with this value 1445 * given as the desired gravity. For example you can specify 1446 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and 1447 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here 1448 * to control the behavior of 1449 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) 1450 * Gravity.applyDisplay}. 1451 * 1452 * @see Gravity 1453 */ 1454 public int gravity; 1455 1456 /** 1457 * The horizontal margin, as a percentage of the container's width, 1458 * between the container and the widget. See 1459 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, 1460 * android.graphics.Rect) Gravity.apply} for how this is used. This 1461 * field is added with {@link #x} to supply the <var>xAdj</var> parameter. 1462 */ 1463 public float horizontalMargin; 1464 1465 /** 1466 * The vertical margin, as a percentage of the container's height, 1467 * between the container and the widget. See 1468 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, 1469 * android.graphics.Rect) Gravity.apply} for how this is used. This 1470 * field is added with {@link #y} to supply the <var>yAdj</var> parameter. 1471 */ 1472 public float verticalMargin; 1473 1474 /** 1475 * Positive insets between the drawing surface and window content. 1476 * 1477 * @hide 1478 */ 1479 public final Rect surfaceInsets = new Rect(); 1480 1481 /** 1482 * Whether the surface insets have been manually set. When set to 1483 * {@code false}, the view root will automatically determine the 1484 * appropriate surface insets. 1485 * 1486 * @see #surfaceInsets 1487 * @hide 1488 */ 1489 public boolean hasManualSurfaceInsets; 1490 1491 /** 1492 * Whether the previous surface insets should be used vs. what is currently set. When set 1493 * to {@code true}, the view root will ignore surfaces insets in this object and use what 1494 * it currently has. 1495 * 1496 * @see #surfaceInsets 1497 * @hide 1498 */ 1499 public boolean preservePreviousSurfaceInsets = true; 1500 1501 /** 1502 * The desired bitmap format. May be one of the constants in 1503 * {@link android.graphics.PixelFormat}. Default is OPAQUE. 1504 */ 1505 public int format; 1506 1507 /** 1508 * A style resource defining the animations to use for this window. 1509 * This must be a system resource; it can not be an application resource 1510 * because the window manager does not have access to applications. 1511 */ 1512 public int windowAnimations; 1513 1514 /** 1515 * An alpha value to apply to this entire window. 1516 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent 1517 */ 1518 public float alpha = 1.0f; 1519 1520 /** 1521 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming 1522 * to apply. Range is from 1.0 for completely opaque to 0.0 for no 1523 * dim. 1524 */ 1525 public float dimAmount = 1.0f; 1526 1527 /** 1528 * Default value for {@link #screenBrightness} and {@link #buttonBrightness} 1529 * indicating that the brightness value is not overridden for this window 1530 * and normal brightness policy should be used. 1531 */ 1532 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f; 1533 1534 /** 1535 * Value for {@link #screenBrightness} and {@link #buttonBrightness} 1536 * indicating that the screen or button backlight brightness should be set 1537 * to the lowest value when this window is in front. 1538 */ 1539 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f; 1540 1541 /** 1542 * Value for {@link #screenBrightness} and {@link #buttonBrightness} 1543 * indicating that the screen or button backlight brightness should be set 1544 * to the hightest value when this window is in front. 1545 */ 1546 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f; 1547 1548 /** 1549 * This can be used to override the user's preferred brightness of 1550 * the screen. A value of less than 0, the default, means to use the 1551 * preferred screen brightness. 0 to 1 adjusts the brightness from 1552 * dark to full bright. 1553 */ 1554 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE; 1555 1556 /** 1557 * This can be used to override the standard behavior of the button and 1558 * keyboard backlights. A value of less than 0, the default, means to 1559 * use the standard backlight behavior. 0 to 1 adjusts the brightness 1560 * from dark to full bright. 1561 */ 1562 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE; 1563 1564 /** 1565 * Value for {@link #rotationAnimation} to define the animation used to 1566 * specify that this window will rotate in or out following a rotation. 1567 */ 1568 public static final int ROTATION_ANIMATION_ROTATE = 0; 1569 1570 /** 1571 * Value for {@link #rotationAnimation} to define the animation used to 1572 * specify that this window will fade in or out following a rotation. 1573 */ 1574 public static final int ROTATION_ANIMATION_CROSSFADE = 1; 1575 1576 /** 1577 * Value for {@link #rotationAnimation} to define the animation used to 1578 * specify that this window will immediately disappear or appear following 1579 * a rotation. 1580 */ 1581 public static final int ROTATION_ANIMATION_JUMPCUT = 2; 1582 1583 /** 1584 * Define the exit and entry animations used on this window when the device is rotated. 1585 * This only has an affect if the incoming and outgoing topmost 1586 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered 1587 * by other windows. All other situations default to the 1588 * {@link #ROTATION_ANIMATION_ROTATE} behavior. 1589 * 1590 * @see #ROTATION_ANIMATION_ROTATE 1591 * @see #ROTATION_ANIMATION_CROSSFADE 1592 * @see #ROTATION_ANIMATION_JUMPCUT 1593 */ 1594 public int rotationAnimation = ROTATION_ANIMATION_ROTATE; 1595 1596 /** 1597 * Identifier for this window. This will usually be filled in for 1598 * you. 1599 */ 1600 public IBinder token = null; 1601 1602 /** 1603 * Name of the package owning this window. 1604 */ 1605 public String packageName = null; 1606 1607 /** 1608 * Specific orientation value for a window. 1609 * May be any of the same values allowed 1610 * for {@link android.content.pm.ActivityInfo#screenOrientation}. 1611 * If not set, a default value of 1612 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED} 1613 * will be used. 1614 */ 1615 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; 1616 1617 /** 1618 * The preferred refresh rate for the window. 1619 * 1620 * This must be one of the supported refresh rates obtained for the display(s) the window 1621 * is on. The selected refresh rate will be applied to the display's default mode. 1622 * 1623 * This value is ignored if {@link #preferredDisplayModeId} is set. 1624 * 1625 * @see Display#getSupportedRefreshRates() 1626 * @deprecated use {@link #preferredDisplayModeId} instead 1627 */ 1628 @Deprecated 1629 public float preferredRefreshRate; 1630 1631 /** 1632 * Id of the preferred display mode for the window. 1633 * <p> 1634 * This must be one of the supported modes obtained for the display(s) the window is on. 1635 * A value of {@code 0} means no preference. 1636 * 1637 * @see Display#getSupportedModes() 1638 * @see Display.Mode#getModeId() 1639 */ 1640 public int preferredDisplayModeId; 1641 1642 /** 1643 * Control the visibility of the status bar. 1644 * 1645 * @see View#STATUS_BAR_VISIBLE 1646 * @see View#STATUS_BAR_HIDDEN 1647 */ 1648 public int systemUiVisibility; 1649 1650 /** 1651 * @hide 1652 * The ui visibility as requested by the views in this hierarchy. 1653 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility. 1654 */ 1655 public int subtreeSystemUiVisibility; 1656 1657 /** 1658 * Get callbacks about the system ui visibility changing. 1659 * 1660 * TODO: Maybe there should be a bitfield of optional callbacks that we need. 1661 * 1662 * @hide 1663 */ 1664 public boolean hasSystemUiListeners; 1665 1666 /** 1667 * When this window has focus, disable touch pad pointer gesture processing. 1668 * The window will receive raw position updates from the touch pad instead 1669 * of pointer movements and synthetic touch events. 1670 * 1671 * @hide 1672 */ 1673 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001; 1674 1675 /** 1676 * Does not construct an input channel for this window. The channel will therefore 1677 * be incapable of receiving input. 1678 * 1679 * @hide 1680 */ 1681 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002; 1682 1683 /** 1684 * When this window has focus, does not call user activity for all input events so 1685 * the application will have to do it itself. Should only be used by 1686 * the keyguard and phone app. 1687 * <p> 1688 * Should only be used by the keyguard and phone app. 1689 * </p> 1690 * 1691 * @hide 1692 */ 1693 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004; 1694 1695 /** 1696 * Control special features of the input subsystem. 1697 * 1698 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES 1699 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL 1700 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY 1701 * @hide 1702 */ 1703 public int inputFeatures; 1704 1705 /** 1706 * Sets the number of milliseconds before the user activity timeout occurs 1707 * when this window has focus. A value of -1 uses the standard timeout. 1708 * A value of 0 uses the minimum support display timeout. 1709 * <p> 1710 * This property can only be used to reduce the user specified display timeout; 1711 * it can never make the timeout longer than it normally would be. 1712 * </p><p> 1713 * Should only be used by the keyguard and phone app. 1714 * </p> 1715 * 1716 * @hide 1717 */ 1718 public long userActivityTimeout = -1; 1719 1720 /** 1721 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the 1722 * window. 1723 * 1724 * @hide 1725 */ 1726 public int accessibilityIdOfAnchor = -1; 1727 1728 /** 1729 * The window title isn't kept in sync with what is displayed in the title bar, so we 1730 * separately track the currently shown title to provide to accessibility. 1731 * 1732 * @hide 1733 */ 1734 public CharSequence accessibilityTitle; 1735 1736 /** 1737 * Sets a timeout in milliseconds before which the window will be removed 1738 * by the window manager. Useful for transient notifications like toasts 1739 * so we don't have to rely on client cooperation to ensure the window 1740 * is removed. Must be specified at window creation time. 1741 * 1742 * @hide 1743 */ 1744 public long removeTimeoutMilliseconds = -1; 1745 1746 public LayoutParams() { 1747 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 1748 type = TYPE_APPLICATION; 1749 format = PixelFormat.OPAQUE; 1750 } 1751 1752 public LayoutParams(int _type) { 1753 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 1754 type = _type; 1755 format = PixelFormat.OPAQUE; 1756 } 1757 1758 public LayoutParams(int _type, int _flags) { 1759 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 1760 type = _type; 1761 flags = _flags; 1762 format = PixelFormat.OPAQUE; 1763 } 1764 1765 public LayoutParams(int _type, int _flags, int _format) { 1766 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 1767 type = _type; 1768 flags = _flags; 1769 format = _format; 1770 } 1771 1772 public LayoutParams(int w, int h, int _type, int _flags, int _format) { 1773 super(w, h); 1774 type = _type; 1775 flags = _flags; 1776 format = _format; 1777 } 1778 1779 public LayoutParams(int w, int h, int xpos, int ypos, int _type, 1780 int _flags, int _format) { 1781 super(w, h); 1782 x = xpos; 1783 y = ypos; 1784 type = _type; 1785 flags = _flags; 1786 format = _format; 1787 } 1788 1789 public final void setTitle(CharSequence title) { 1790 if (null == title) 1791 title = ""; 1792 1793 mTitle = TextUtils.stringOrSpannedString(title); 1794 } 1795 1796 public final CharSequence getTitle() { 1797 return mTitle != null ? mTitle : ""; 1798 } 1799 1800 /** 1801 * Sets the surface insets based on the elevation (visual z position) of the input view. 1802 * @hide 1803 */ 1804 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) { 1805 final int surfaceInset = (int) Math.ceil(view.getZ() * 2); 1806 // Partial workaround for b/28318973. Every inset change causes a freeform window 1807 // to jump a little for a few frames. If we never allow surface insets to decrease, 1808 // they will stabilize quickly (often from the very beginning, as most windows start 1809 // as focused). 1810 // TODO(b/22668382) to fix this properly. 1811 if (surfaceInset == 0) { 1812 // OK to have 0 (this is the case for non-freeform windows). 1813 surfaceInsets.set(0, 0, 0, 0); 1814 } else { 1815 surfaceInsets.set( 1816 Math.max(surfaceInset, surfaceInsets.left), 1817 Math.max(surfaceInset, surfaceInsets.top), 1818 Math.max(surfaceInset, surfaceInsets.right), 1819 Math.max(surfaceInset, surfaceInsets.bottom)); 1820 } 1821 hasManualSurfaceInsets = manual; 1822 preservePreviousSurfaceInsets = preservePrevious; 1823 } 1824 1825 /** @hide */ 1826 @SystemApi 1827 public final void setUserActivityTimeout(long timeout) { 1828 userActivityTimeout = timeout; 1829 } 1830 1831 /** @hide */ 1832 @SystemApi 1833 public final long getUserActivityTimeout() { 1834 return userActivityTimeout; 1835 } 1836 1837 public int describeContents() { 1838 return 0; 1839 } 1840 1841 public void writeToParcel(Parcel out, int parcelableFlags) { 1842 out.writeInt(width); 1843 out.writeInt(height); 1844 out.writeInt(x); 1845 out.writeInt(y); 1846 out.writeInt(type); 1847 out.writeInt(flags); 1848 out.writeInt(privateFlags); 1849 out.writeInt(softInputMode); 1850 out.writeInt(gravity); 1851 out.writeFloat(horizontalMargin); 1852 out.writeFloat(verticalMargin); 1853 out.writeInt(format); 1854 out.writeInt(windowAnimations); 1855 out.writeFloat(alpha); 1856 out.writeFloat(dimAmount); 1857 out.writeFloat(screenBrightness); 1858 out.writeFloat(buttonBrightness); 1859 out.writeInt(rotationAnimation); 1860 out.writeStrongBinder(token); 1861 out.writeString(packageName); 1862 TextUtils.writeToParcel(mTitle, out, parcelableFlags); 1863 out.writeInt(screenOrientation); 1864 out.writeFloat(preferredRefreshRate); 1865 out.writeInt(preferredDisplayModeId); 1866 out.writeInt(systemUiVisibility); 1867 out.writeInt(subtreeSystemUiVisibility); 1868 out.writeInt(hasSystemUiListeners ? 1 : 0); 1869 out.writeInt(inputFeatures); 1870 out.writeLong(userActivityTimeout); 1871 out.writeInt(surfaceInsets.left); 1872 out.writeInt(surfaceInsets.top); 1873 out.writeInt(surfaceInsets.right); 1874 out.writeInt(surfaceInsets.bottom); 1875 out.writeInt(hasManualSurfaceInsets ? 1 : 0); 1876 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0); 1877 out.writeInt(needsMenuKey); 1878 out.writeInt(accessibilityIdOfAnchor); 1879 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags); 1880 out.writeLong(removeTimeoutMilliseconds); 1881 } 1882 1883 public static final Parcelable.Creator<LayoutParams> CREATOR 1884 = new Parcelable.Creator<LayoutParams>() { 1885 public LayoutParams createFromParcel(Parcel in) { 1886 return new LayoutParams(in); 1887 } 1888 1889 public LayoutParams[] newArray(int size) { 1890 return new LayoutParams[size]; 1891 } 1892 }; 1893 1894 1895 public LayoutParams(Parcel in) { 1896 width = in.readInt(); 1897 height = in.readInt(); 1898 x = in.readInt(); 1899 y = in.readInt(); 1900 type = in.readInt(); 1901 flags = in.readInt(); 1902 privateFlags = in.readInt(); 1903 softInputMode = in.readInt(); 1904 gravity = in.readInt(); 1905 horizontalMargin = in.readFloat(); 1906 verticalMargin = in.readFloat(); 1907 format = in.readInt(); 1908 windowAnimations = in.readInt(); 1909 alpha = in.readFloat(); 1910 dimAmount = in.readFloat(); 1911 screenBrightness = in.readFloat(); 1912 buttonBrightness = in.readFloat(); 1913 rotationAnimation = in.readInt(); 1914 token = in.readStrongBinder(); 1915 packageName = in.readString(); 1916 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); 1917 screenOrientation = in.readInt(); 1918 preferredRefreshRate = in.readFloat(); 1919 preferredDisplayModeId = in.readInt(); 1920 systemUiVisibility = in.readInt(); 1921 subtreeSystemUiVisibility = in.readInt(); 1922 hasSystemUiListeners = in.readInt() != 0; 1923 inputFeatures = in.readInt(); 1924 userActivityTimeout = in.readLong(); 1925 surfaceInsets.left = in.readInt(); 1926 surfaceInsets.top = in.readInt(); 1927 surfaceInsets.right = in.readInt(); 1928 surfaceInsets.bottom = in.readInt(); 1929 hasManualSurfaceInsets = in.readInt() != 0; 1930 preservePreviousSurfaceInsets = in.readInt() != 0; 1931 needsMenuKey = in.readInt(); 1932 accessibilityIdOfAnchor = in.readInt(); 1933 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); 1934 removeTimeoutMilliseconds = in.readLong(); 1935 } 1936 1937 @SuppressWarnings({"PointlessBitwiseExpression"}) 1938 public static final int LAYOUT_CHANGED = 1<<0; 1939 public static final int TYPE_CHANGED = 1<<1; 1940 public static final int FLAGS_CHANGED = 1<<2; 1941 public static final int FORMAT_CHANGED = 1<<3; 1942 public static final int ANIMATION_CHANGED = 1<<4; 1943 public static final int DIM_AMOUNT_CHANGED = 1<<5; 1944 public static final int TITLE_CHANGED = 1<<6; 1945 public static final int ALPHA_CHANGED = 1<<7; 1946 public static final int MEMORY_TYPE_CHANGED = 1<<8; 1947 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9; 1948 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10; 1949 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11; 1950 public static final int ROTATION_ANIMATION_CHANGED = 1<<12; 1951 /** {@hide} */ 1952 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13; 1953 /** {@hide} */ 1954 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14; 1955 /** {@hide} */ 1956 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15; 1957 /** {@hide} */ 1958 public static final int INPUT_FEATURES_CHANGED = 1<<16; 1959 /** {@hide} */ 1960 public static final int PRIVATE_FLAGS_CHANGED = 1<<17; 1961 /** {@hide} */ 1962 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18; 1963 /** {@hide} */ 1964 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19; 1965 /** {@hide} */ 1966 public static final int SURFACE_INSETS_CHANGED = 1<<20; 1967 /** {@hide} */ 1968 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21; 1969 /** {@hide} */ 1970 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22; 1971 /** {@hide} */ 1972 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23; 1973 /** {@hide} */ 1974 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24; 1975 /** {@hide} */ 1976 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25; 1977 /** {@hide} */ 1978 public static final int EVERYTHING_CHANGED = 0xffffffff; 1979 1980 // internal buffer to backup/restore parameters under compatibility mode. 1981 private int[] mCompatibilityParamsBackup = null; 1982 1983 public final int copyFrom(LayoutParams o) { 1984 int changes = 0; 1985 1986 if (width != o.width) { 1987 width = o.width; 1988 changes |= LAYOUT_CHANGED; 1989 } 1990 if (height != o.height) { 1991 height = o.height; 1992 changes |= LAYOUT_CHANGED; 1993 } 1994 if (x != o.x) { 1995 x = o.x; 1996 changes |= LAYOUT_CHANGED; 1997 } 1998 if (y != o.y) { 1999 y = o.y; 2000 changes |= LAYOUT_CHANGED; 2001 } 2002 if (horizontalWeight != o.horizontalWeight) { 2003 horizontalWeight = o.horizontalWeight; 2004 changes |= LAYOUT_CHANGED; 2005 } 2006 if (verticalWeight != o.verticalWeight) { 2007 verticalWeight = o.verticalWeight; 2008 changes |= LAYOUT_CHANGED; 2009 } 2010 if (horizontalMargin != o.horizontalMargin) { 2011 horizontalMargin = o.horizontalMargin; 2012 changes |= LAYOUT_CHANGED; 2013 } 2014 if (verticalMargin != o.verticalMargin) { 2015 verticalMargin = o.verticalMargin; 2016 changes |= LAYOUT_CHANGED; 2017 } 2018 if (type != o.type) { 2019 type = o.type; 2020 changes |= TYPE_CHANGED; 2021 } 2022 if (flags != o.flags) { 2023 final int diff = flags ^ o.flags; 2024 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) { 2025 changes |= TRANSLUCENT_FLAGS_CHANGED; 2026 } 2027 flags = o.flags; 2028 changes |= FLAGS_CHANGED; 2029 } 2030 if (privateFlags != o.privateFlags) { 2031 privateFlags = o.privateFlags; 2032 changes |= PRIVATE_FLAGS_CHANGED; 2033 } 2034 if (softInputMode != o.softInputMode) { 2035 softInputMode = o.softInputMode; 2036 changes |= SOFT_INPUT_MODE_CHANGED; 2037 } 2038 if (gravity != o.gravity) { 2039 gravity = o.gravity; 2040 changes |= LAYOUT_CHANGED; 2041 } 2042 if (format != o.format) { 2043 format = o.format; 2044 changes |= FORMAT_CHANGED; 2045 } 2046 if (windowAnimations != o.windowAnimations) { 2047 windowAnimations = o.windowAnimations; 2048 changes |= ANIMATION_CHANGED; 2049 } 2050 if (token == null) { 2051 // NOTE: token only copied if the recipient doesn't 2052 // already have one. 2053 token = o.token; 2054 } 2055 if (packageName == null) { 2056 // NOTE: packageName only copied if the recipient doesn't 2057 // already have one. 2058 packageName = o.packageName; 2059 } 2060 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) { 2061 // NOTE: mTitle only copied if the originator set one. 2062 mTitle = o.mTitle; 2063 changes |= TITLE_CHANGED; 2064 } 2065 if (alpha != o.alpha) { 2066 alpha = o.alpha; 2067 changes |= ALPHA_CHANGED; 2068 } 2069 if (dimAmount != o.dimAmount) { 2070 dimAmount = o.dimAmount; 2071 changes |= DIM_AMOUNT_CHANGED; 2072 } 2073 if (screenBrightness != o.screenBrightness) { 2074 screenBrightness = o.screenBrightness; 2075 changes |= SCREEN_BRIGHTNESS_CHANGED; 2076 } 2077 if (buttonBrightness != o.buttonBrightness) { 2078 buttonBrightness = o.buttonBrightness; 2079 changes |= BUTTON_BRIGHTNESS_CHANGED; 2080 } 2081 if (rotationAnimation != o.rotationAnimation) { 2082 rotationAnimation = o.rotationAnimation; 2083 changes |= ROTATION_ANIMATION_CHANGED; 2084 } 2085 2086 if (screenOrientation != o.screenOrientation) { 2087 screenOrientation = o.screenOrientation; 2088 changes |= SCREEN_ORIENTATION_CHANGED; 2089 } 2090 2091 if (preferredRefreshRate != o.preferredRefreshRate) { 2092 preferredRefreshRate = o.preferredRefreshRate; 2093 changes |= PREFERRED_REFRESH_RATE_CHANGED; 2094 } 2095 2096 if (preferredDisplayModeId != o.preferredDisplayModeId) { 2097 preferredDisplayModeId = o.preferredDisplayModeId; 2098 changes |= PREFERRED_DISPLAY_MODE_ID; 2099 } 2100 2101 if (systemUiVisibility != o.systemUiVisibility 2102 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) { 2103 systemUiVisibility = o.systemUiVisibility; 2104 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility; 2105 changes |= SYSTEM_UI_VISIBILITY_CHANGED; 2106 } 2107 2108 if (hasSystemUiListeners != o.hasSystemUiListeners) { 2109 hasSystemUiListeners = o.hasSystemUiListeners; 2110 changes |= SYSTEM_UI_LISTENER_CHANGED; 2111 } 2112 2113 if (inputFeatures != o.inputFeatures) { 2114 inputFeatures = o.inputFeatures; 2115 changes |= INPUT_FEATURES_CHANGED; 2116 } 2117 2118 if (userActivityTimeout != o.userActivityTimeout) { 2119 userActivityTimeout = o.userActivityTimeout; 2120 changes |= USER_ACTIVITY_TIMEOUT_CHANGED; 2121 } 2122 2123 if (!surfaceInsets.equals(o.surfaceInsets)) { 2124 surfaceInsets.set(o.surfaceInsets); 2125 changes |= SURFACE_INSETS_CHANGED; 2126 } 2127 2128 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) { 2129 hasManualSurfaceInsets = o.hasManualSurfaceInsets; 2130 changes |= SURFACE_INSETS_CHANGED; 2131 } 2132 2133 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) { 2134 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets; 2135 changes |= SURFACE_INSETS_CHANGED; 2136 } 2137 2138 if (needsMenuKey != o.needsMenuKey) { 2139 needsMenuKey = o.needsMenuKey; 2140 changes |= NEEDS_MENU_KEY_CHANGED; 2141 } 2142 2143 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) { 2144 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor; 2145 changes |= ACCESSIBILITY_ANCHOR_CHANGED; 2146 } 2147 2148 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle) 2149 && o.accessibilityTitle != null) { 2150 // NOTE: accessibilityTitle only copied if the originator set one. 2151 accessibilityTitle = o.accessibilityTitle; 2152 changes |= ACCESSIBILITY_TITLE_CHANGED; 2153 } 2154 2155 // This can't change, it's only set at window creation time. 2156 removeTimeoutMilliseconds = o.removeTimeoutMilliseconds; 2157 2158 return changes; 2159 } 2160 2161 @Override 2162 public String debug(String output) { 2163 output += "Contents of " + this + ":"; 2164 Log.d("Debug", output); 2165 output = super.debug(""); 2166 Log.d("Debug", output); 2167 Log.d("Debug", ""); 2168 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}"); 2169 return ""; 2170 } 2171 2172 @Override 2173 public String toString() { 2174 StringBuilder sb = new StringBuilder(256); 2175 sb.append("WM.LayoutParams{"); 2176 sb.append("("); 2177 sb.append(x); 2178 sb.append(','); 2179 sb.append(y); 2180 sb.append(")("); 2181 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width))); 2182 sb.append('x'); 2183 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height))); 2184 sb.append(")"); 2185 if (horizontalMargin != 0) { 2186 sb.append(" hm="); 2187 sb.append(horizontalMargin); 2188 } 2189 if (verticalMargin != 0) { 2190 sb.append(" vm="); 2191 sb.append(verticalMargin); 2192 } 2193 if (gravity != 0) { 2194 sb.append(" gr=#"); 2195 sb.append(Integer.toHexString(gravity)); 2196 } 2197 if (softInputMode != 0) { 2198 sb.append(" sim=#"); 2199 sb.append(Integer.toHexString(softInputMode)); 2200 } 2201 sb.append(" ty="); 2202 sb.append(type); 2203 sb.append(" fl=#"); 2204 sb.append(Integer.toHexString(flags)); 2205 if (privateFlags != 0) { 2206 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) { 2207 sb.append(" compatible=true"); 2208 } 2209 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags)); 2210 } 2211 if (format != PixelFormat.OPAQUE) { 2212 sb.append(" fmt="); 2213 sb.append(format); 2214 } 2215 if (windowAnimations != 0) { 2216 sb.append(" wanim=0x"); 2217 sb.append(Integer.toHexString(windowAnimations)); 2218 } 2219 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) { 2220 sb.append(" or="); 2221 sb.append(screenOrientation); 2222 } 2223 if (alpha != 1.0f) { 2224 sb.append(" alpha="); 2225 sb.append(alpha); 2226 } 2227 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) { 2228 sb.append(" sbrt="); 2229 sb.append(screenBrightness); 2230 } 2231 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) { 2232 sb.append(" bbrt="); 2233 sb.append(buttonBrightness); 2234 } 2235 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) { 2236 sb.append(" rotAnim="); 2237 sb.append(rotationAnimation); 2238 } 2239 if (preferredRefreshRate != 0) { 2240 sb.append(" preferredRefreshRate="); 2241 sb.append(preferredRefreshRate); 2242 } 2243 if (preferredDisplayModeId != 0) { 2244 sb.append(" preferredDisplayMode="); 2245 sb.append(preferredDisplayModeId); 2246 } 2247 if (systemUiVisibility != 0) { 2248 sb.append(" sysui=0x"); 2249 sb.append(Integer.toHexString(systemUiVisibility)); 2250 } 2251 if (subtreeSystemUiVisibility != 0) { 2252 sb.append(" vsysui=0x"); 2253 sb.append(Integer.toHexString(subtreeSystemUiVisibility)); 2254 } 2255 if (hasSystemUiListeners) { 2256 sb.append(" sysuil="); 2257 sb.append(hasSystemUiListeners); 2258 } 2259 if (inputFeatures != 0) { 2260 sb.append(" if=0x").append(Integer.toHexString(inputFeatures)); 2261 } 2262 if (userActivityTimeout >= 0) { 2263 sb.append(" userActivityTimeout=").append(userActivityTimeout); 2264 } 2265 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 || 2266 surfaceInsets.bottom != 0 || hasManualSurfaceInsets 2267 || !preservePreviousSurfaceInsets) { 2268 sb.append(" surfaceInsets=").append(surfaceInsets); 2269 if (hasManualSurfaceInsets) { 2270 sb.append(" (manual)"); 2271 } 2272 if (!preservePreviousSurfaceInsets) { 2273 sb.append(" (!preservePreviousSurfaceInsets)"); 2274 } 2275 } 2276 if (needsMenuKey != NEEDS_MENU_UNSET) { 2277 sb.append(" needsMenuKey="); 2278 sb.append(needsMenuKey); 2279 } 2280 sb.append('}'); 2281 return sb.toString(); 2282 } 2283 2284 /** 2285 * Scale the layout params' coordinates and size. 2286 * @hide 2287 */ 2288 public void scale(float scale) { 2289 x = (int) (x * scale + 0.5f); 2290 y = (int) (y * scale + 0.5f); 2291 if (width > 0) { 2292 width = (int) (width * scale + 0.5f); 2293 } 2294 if (height > 0) { 2295 height = (int) (height * scale + 0.5f); 2296 } 2297 } 2298 2299 /** 2300 * Backup the layout parameters used in compatibility mode. 2301 * @see LayoutParams#restore() 2302 */ 2303 void backup() { 2304 int[] backup = mCompatibilityParamsBackup; 2305 if (backup == null) { 2306 // we backup 4 elements, x, y, width, height 2307 backup = mCompatibilityParamsBackup = new int[4]; 2308 } 2309 backup[0] = x; 2310 backup[1] = y; 2311 backup[2] = width; 2312 backup[3] = height; 2313 } 2314 2315 /** 2316 * Restore the layout params' coordinates, size and gravity 2317 * @see LayoutParams#backup() 2318 */ 2319 void restore() { 2320 int[] backup = mCompatibilityParamsBackup; 2321 if (backup != null) { 2322 x = backup[0]; 2323 y = backup[1]; 2324 width = backup[2]; 2325 height = backup[3]; 2326 } 2327 } 2328 2329 private CharSequence mTitle = null; 2330 2331 /** @hide */ 2332 @Override 2333 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) { 2334 super.encodeProperties(encoder); 2335 2336 encoder.addProperty("x", x); 2337 encoder.addProperty("y", y); 2338 encoder.addProperty("horizontalWeight", horizontalWeight); 2339 encoder.addProperty("verticalWeight", verticalWeight); 2340 encoder.addProperty("type", type); 2341 encoder.addProperty("flags", flags); 2342 } 2343 } 2344 } 2345