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