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