WindowManager.java revision ae069f76ee65fd5d9252c8191429fa55296d0208
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.content.pm.ActivityInfo; 20import android.graphics.PixelFormat; 21import android.os.IBinder; 22import android.os.Parcel; 23import android.os.Parcelable; 24import android.text.TextUtils; 25import android.util.Log; 26 27 28/** 29 * The interface that apps use to talk to the window manager. 30 * <p> 31 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these. 32 * 33 * @see android.content.Context#getSystemService 34 * @see android.content.Context#WINDOW_SERVICE 35 */ 36public interface WindowManager extends ViewManager { 37 /** 38 * Exception that is thrown when trying to add view whose 39 * {@link WindowManager.LayoutParams} {@link WindowManager.LayoutParams#token} 40 * is invalid. 41 */ 42 public static class BadTokenException extends RuntimeException { 43 public BadTokenException() { 44 } 45 46 public BadTokenException(String name) { 47 super(name); 48 } 49 } 50 51 /** 52 * Use this method to get the default Display object. 53 * 54 * @return default Display object 55 */ 56 public Display getDefaultDisplay(); 57 58 /** 59 * Special variation of {@link #removeView} that immediately invokes 60 * the given view hierarchy's {@link View#onDetachedFromWindow() 61 * View.onDetachedFromWindow()} methods before returning. This is not 62 * for normal applications; using it correctly requires great care. 63 * 64 * @param view The view to be removed. 65 */ 66 public void removeViewImmediate(View view); 67 68 public static class LayoutParams extends ViewGroup.LayoutParams 69 implements Parcelable { 70 /** 71 * X position for this window. With the default gravity it is ignored. 72 * When using {@link Gravity#LEFT} or {@link Gravity#RIGHT} it provides 73 * an offset from the given edge. 74 */ 75 public int x; 76 77 /** 78 * Y position for this window. With the default gravity it is ignored. 79 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides 80 * an offset from the given edge. 81 */ 82 public int y; 83 84 /** 85 * Indicates how much of the extra space will be allocated horizontally 86 * to the view associated with these LayoutParams. Specify 0 if the view 87 * should not be stretched. Otherwise the extra pixels will be pro-rated 88 * among all views whose weight is greater than 0. 89 */ 90 public float horizontalWeight; 91 92 /** 93 * Indicates how much of the extra space will be allocated vertically 94 * to the view associated with these LayoutParams. Specify 0 if the view 95 * should not be stretched. Otherwise the extra pixels will be pro-rated 96 * among all views whose weight is greater than 0. 97 */ 98 public float verticalWeight; 99 100 /** 101 * The general type of window. There are three main classes of 102 * window types: 103 * <ul> 104 * <li> <strong>Application windows</strong> (ranging from 105 * {@link #FIRST_APPLICATION_WINDOW} to 106 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application 107 * windows. For these types of windows, the {@link #token} must be 108 * set to the token of the activity they are a part of (this will 109 * normally be done for you if {@link #token} is null). 110 * <li> <strong>Sub-windows</strong> (ranging from 111 * {@link #FIRST_SUB_WINDOW} to 112 * {@link #LAST_SUB_WINDOW}) are associated with another top-level 113 * window. For these types of windows, the {@link #token} must be 114 * the token of the window it is attached to. 115 * <li> <strong>System windows</strong> (ranging from 116 * {@link #FIRST_SYSTEM_WINDOW} to 117 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for 118 * use by the system for specific purposes. They should not normally 119 * be used by applications, and a special permission is required 120 * to use them. 121 * </ul> 122 * 123 * @see #TYPE_BASE_APPLICATION 124 * @see #TYPE_APPLICATION 125 * @see #TYPE_APPLICATION_STARTING 126 * @see #TYPE_APPLICATION_PANEL 127 * @see #TYPE_APPLICATION_MEDIA 128 * @see #TYPE_APPLICATION_SUB_PANEL 129 * @see #TYPE_APPLICATION_ATTACHED_DIALOG 130 * @see #TYPE_STATUS_BAR 131 * @see #TYPE_SEARCH_BAR 132 * @see #TYPE_PHONE 133 * @see #TYPE_SYSTEM_ALERT 134 * @see #TYPE_KEYGUARD 135 * @see #TYPE_TOAST 136 * @see #TYPE_SYSTEM_OVERLAY 137 * @see #TYPE_PRIORITY_PHONE 138 * @see #TYPE_STATUS_BAR_PANEL 139 * @see #TYPE_SYSTEM_DIALOG 140 * @see #TYPE_KEYGUARD_DIALOG 141 * @see #TYPE_SYSTEM_ERROR 142 * @see #TYPE_INPUT_METHOD 143 * @see #TYPE_INPUT_METHOD_DIALOG 144 */ 145 @ViewDebug.ExportedProperty(mapping = { 146 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"), 147 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"), 148 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"), 149 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"), 150 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"), 151 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"), 152 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"), 153 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"), 154 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"), 155 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"), 156 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"), 157 @ViewDebug.IntToString(from = TYPE_KEYGUARD, to = "TYPE_KEYGUARD"), 158 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"), 159 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"), 160 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"), 161 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"), 162 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"), 163 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"), 164 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"), 165 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"), 166 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG") 167 }) 168 public int type; 169 170 /** 171 * Start of window types that represent normal application windows. 172 */ 173 public static final int FIRST_APPLICATION_WINDOW = 1; 174 175 /** 176 * Window type: an application window that serves as the "base" window 177 * of the overall application; all other application windows will 178 * appear on top of it. 179 */ 180 public static final int TYPE_BASE_APPLICATION = 1; 181 182 /** 183 * Window type: a normal application window. The {@link #token} must be 184 * an Activity token identifying who the window belongs to. 185 */ 186 public static final int TYPE_APPLICATION = 2; 187 188 /** 189 * Window type: special application window that is displayed while the 190 * application is starting. Not for use by applications themselves; 191 * this is used by the system to display something until the 192 * application can show its own windows. 193 */ 194 public static final int TYPE_APPLICATION_STARTING = 3; 195 196 /** 197 * End of types of application windows. 198 */ 199 public static final int LAST_APPLICATION_WINDOW = 99; 200 201 /** 202 * Start of types of sub-windows. The {@link #token} of these windows 203 * must be set to the window they are attached to. These types of 204 * windows are kept next to their attached window in Z-order, and their 205 * coordinate space is relative to their attached window. 206 */ 207 public static final int FIRST_SUB_WINDOW = 1000; 208 209 /** 210 * Window type: a panel on top of an application window. These windows 211 * appear on top of their attached window. 212 */ 213 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW; 214 215 /** 216 * Window type: window for showing media (e.g. video). These windows 217 * are displayed behind their attached window. 218 */ 219 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1; 220 221 /** 222 * Window type: a sub-panel on top of an application window. These 223 * windows are displayed on top their attached window and any 224 * {@link #TYPE_APPLICATION_PANEL} panels. 225 */ 226 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2; 227 228 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout 229 * of the window happens as that of a top-level window, <em>not</em> 230 * as a child of its container. 231 */ 232 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3; 233 234 /** 235 * Window type: window for showing overlays on top of media windows. 236 * These windows are displayed between TYPE_APPLICATION_MEDIA and the 237 * application window. They should be translucent to be useful. This 238 * is a big ugly hack so: 239 * @hide 240 */ 241 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4; 242 243 /** 244 * End of types of sub-windows. 245 */ 246 public static final int LAST_SUB_WINDOW = 1999; 247 248 /** 249 * Start of system-specific window types. These are not normally 250 * created by applications. 251 */ 252 public static final int FIRST_SYSTEM_WINDOW = 2000; 253 254 /** 255 * Window type: the status bar. There can be only one status bar 256 * window; it is placed at the top of the screen, and all other 257 * windows are shifted down so they are below it. 258 */ 259 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW; 260 261 /** 262 * Window type: the search bar. There can be only one search bar 263 * window; it is placed at the top of the screen. 264 */ 265 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1; 266 267 /** 268 * Window type: phone. These are non-application windows providing 269 * user interaction with the phone (in particular incoming calls). 270 * These windows are normally placed above all applications, but behind 271 * the status bar. 272 */ 273 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; 274 275 /** 276 * Window type: system window, such as low power alert. These windows 277 * are always on top of application windows. 278 */ 279 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3; 280 281 /** 282 * Window type: keyguard window. 283 */ 284 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4; 285 286 /** 287 * Window type: transient notifications. 288 */ 289 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5; 290 291 /** 292 * Window type: system overlay windows, which need to be displayed 293 * on top of everything else. These windows must not take input 294 * focus, or they will interfere with the keyguard. 295 */ 296 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6; 297 298 /** 299 * Window type: priority phone UI, which needs to be displayed even if 300 * the keyguard is active. These windows must not take input 301 * focus, or they will interfere with the keyguard. 302 */ 303 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7; 304 305 /** 306 * Window type: panel that slides out from the status bar 307 */ 308 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8; 309 310 /** 311 * Window type: dialogs that the keyguard shows 312 */ 313 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9; 314 315 /** 316 * Window type: internal system error windows, appear on top of 317 * everything they can. 318 */ 319 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10; 320 321 /** 322 * Window type: internal input methods windows, which appear above 323 * the normal UI. Application windows may be resized or panned to keep 324 * the input focus visible while this window is displayed. 325 */ 326 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11; 327 328 /** 329 * Window type: internal input methods dialog windows, which appear above 330 * the current input method window. 331 */ 332 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12; 333 334 /** 335 * Window type: wallpaper window, placed behind any window that wants 336 * to sit on top of the wallpaper. 337 */ 338 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13; 339 340 /** 341 * Window type: panel that slides out from the status bar 342 */ 343 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; 344 345 /** 346 * End of types of system windows. 347 */ 348 public static final int LAST_SYSTEM_WINDOW = 2999; 349 350 /** 351 * Specifies what type of memory buffers should be used by this window. 352 * Default is normal. 353 * 354 * @see #MEMORY_TYPE_NORMAL 355 * @see #MEMORY_TYPE_PUSH_BUFFERS 356 */ 357 public int memoryType; 358 359 /** Memory type: The window's surface is allocated in main memory. */ 360 public static final int MEMORY_TYPE_NORMAL = 0; 361 /** Memory type: The window's surface is configured to be accessible 362 * by DMA engines and hardware accelerators. 363 * @deprecated this is ignored, this value is set automatically when needed. 364 */ 365 @Deprecated 366 public static final int MEMORY_TYPE_HARDWARE = 1; 367 /** Memory type: The window's surface is configured to be accessible 368 * by graphics accelerators. 369 * @deprecated this is ignored, this value is set automatically when needed. 370 */ 371 @Deprecated 372 public static final int MEMORY_TYPE_GPU = 2; 373 /** Memory type: The window's surface doesn't own its buffers and 374 * therefore cannot be locked. Instead the buffers are pushed to 375 * it through native binder calls. */ 376 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; 377 378 /** 379 * Various behavioral options/flags. Default is none. 380 * 381 * @see #FLAG_BLUR_BEHIND 382 * @see #FLAG_DIM_BEHIND 383 * @see #FLAG_NOT_FOCUSABLE 384 * @see #FLAG_NOT_TOUCHABLE 385 * @see #FLAG_NOT_TOUCH_MODAL 386 * @see #FLAG_LAYOUT_IN_SCREEN 387 * @see #FLAG_DITHER 388 * @see #FLAG_KEEP_SCREEN_ON 389 * @see #FLAG_FULLSCREEN 390 * @see #FLAG_FORCE_NOT_FULLSCREEN 391 * @see #FLAG_IGNORE_CHEEK_PRESSES 392 */ 393 @ViewDebug.ExportedProperty(flagMapping = { 394 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND, 395 name = "FLAG_BLUR_BEHIND"), 396 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND, 397 name = "FLAG_DIM_BEHIND"), 398 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE, 399 name = "FLAG_NOT_FOCUSABLE"), 400 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE, 401 name = "FLAG_NOT_TOUCHABLE"), 402 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL, 403 name = "FLAG_NOT_TOUCH_MODAL"), 404 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN, 405 name = "FLAG_LAYOUT_IN_SCREEN"), 406 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER, 407 name = "FLAG_DITHER"), 408 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON, 409 name = "FLAG_TURN_SCREEN_ON"), 410 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON, 411 name = "FLAG_KEEP_SCREEN_ON"), 412 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED, 413 name = "FLAG_SHOW_WHEN_LOCKED"), 414 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, 415 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"), 416 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD, 417 name = "FLAG_DISMISS_KEYGUARD"), 418 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN, 419 name = "FLAG_FULLSCREEN"), 420 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, 421 equals = FLAG_FORCE_NOT_FULLSCREEN, name = "FLAG_FORCE_NOT_FULLSCREEN"), 422 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, 423 equals = FLAG_IGNORE_CHEEK_PRESSES, name = "FLAG_IGNORE_CHEEK_PRESSES") 424 }) 425 public int flags; 426 427 /** Window flag: as long as this window is visible to the user, allow 428 * the lock screen to activate while the screen is on. 429 * This can be used independently, or in combination with 430 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */ 431 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001; 432 433 /** Window flag: everything behind this window will be dimmed. 434 * Use {@link #dimAmount} to control the amount of dim. */ 435 public static final int FLAG_DIM_BEHIND = 0x00000002; 436 437 /** Window flag: blur everything behind this window. */ 438 public static final int FLAG_BLUR_BEHIND = 0x00000004; 439 440 /** Window flag: this window won't ever get key input focus, so the 441 * user can not send key or other button events to it. Those will 442 * instead go to whatever focusable window is behind it. This flag 443 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that 444 * is explicitly set. 445 * 446 * <p>Setting this flag also implies that the window will not need to 447 * interact with 448 * a soft input method, so it will be Z-ordered and positioned 449 * independently of any active input method (typically this means it 450 * gets Z-ordered on top of the input method, so it can use the full 451 * screen for its content and cover the input method if needed. You 452 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */ 453 public static final int FLAG_NOT_FOCUSABLE = 0x00000008; 454 455 /** Window flag: this window can never receive touch events. */ 456 public static final int FLAG_NOT_TOUCHABLE = 0x00000010; 457 458 /** Window flag: Even when this window is focusable (its 459 * {@link #FLAG_NOT_FOCUSABLE is not set), allow any pointer events 460 * outside of the window to be sent to the windows behind it. Otherwise 461 * it will consume all pointer events itself, regardless of whether they 462 * are inside of the window. */ 463 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020; 464 465 /** Window flag: When set, if the device is asleep when the touch 466 * screen is pressed, you will receive this first touch event. Usually 467 * the first touch event is consumed by the system since the user can 468 * not see what they are pressing on. 469 */ 470 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040; 471 472 /** Window flag: as long as this window is visible to the user, keep 473 * the device's screen turned on and bright. */ 474 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080; 475 476 /** Window flag: place the window within the entire screen, ignoring 477 * decorations around the border (a.k.a. the status bar). The 478 * window must correctly position its contents to take the screen 479 * decoration into account. This flag is normally set for you 480 * by Window as described in {@link Window#setFlags}. */ 481 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100; 482 483 /** Window flag: allow window to extend outside of the screen. */ 484 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200; 485 486 /** Window flag: Hide all screen decorations (e.g. status bar) while 487 * this window is displayed. This allows the window to use the entire 488 * display space for itself -- the status bar will be hidden when 489 * an app window with this flag set is on the top layer. */ 490 public static final int FLAG_FULLSCREEN = 0x00000400; 491 492 /** Window flag: Override {@link #FLAG_FULLSCREEN and force the 493 * screen decorations (such as status bar) to be shown. */ 494 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; 495 496 /** Window flag: turn on dithering when compositing this window to 497 * the screen. */ 498 public static final int FLAG_DITHER = 0x00001000; 499 500 /** Window flag: don't allow screen shots while this window is 501 * displayed. */ 502 public static final int FLAG_SECURE = 0x00002000; 503 504 /** Window flag: a special mode where the layout parameters are used 505 * to perform scaling of the surface when it is composited to the 506 * screen. */ 507 public static final int FLAG_SCALED = 0x00004000; 508 509 /** Window flag: intended for windows that will often be used when the user is 510 * holding the screen against their face, it will aggressively filter the event 511 * stream to prevent unintended presses in this situation that may not be 512 * desired for a particular window, when such an event stream is detected, the 513 * application will receive a CANCEL motion event to indicate this so applications 514 * can handle this accordingly by taking no action on the event 515 * until the finger is released. */ 516 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000; 517 518 /** Window flag: a special option only for use in combination with 519 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the 520 * screen your window may appear on top of or behind screen decorations 521 * such as the status bar. By also including this flag, the window 522 * manager will report the inset rectangle needed to ensure your 523 * content is not covered by screen decorations. This flag is normally 524 * set for you by Window as described in {@link Window#setFlags}.*/ 525 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; 526 527 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with 528 * respect to how this window interacts with the current method. That 529 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the 530 * window will behave as if it needs to interact with the input method 531 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is 532 * not set and this flag is set, then the window will behave as if it 533 * doesn't need to interact with the input method and can be placed 534 * to use more space and cover the input method. 535 */ 536 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; 537 538 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you 539 * can set this flag to receive a single special MotionEvent with 540 * the action 541 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for 542 * touches that occur outside of your window. Note that you will not 543 * receive the full down/move/up gesture, only the location of the 544 * first down as an ACTION_OUTSIDE. 545 */ 546 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000; 547 548 /** Window flag: special flag to let windows be shown when the screen 549 * is locked. This will let application windows take precedence over 550 * key guard or any other lock screens. Can be used with 551 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows 552 * directly before showing the key guard window. Can be used with 553 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss 554 * non-secure keyguards. This flag only applies to the top-most 555 * full-screen window. 556 */ 557 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000; 558 559 /** Window flag: ask that the system wallpaper be shown behind 560 * your window. The window surface must be translucent to be able 561 * to actually see the wallpaper behind it; this flag just ensures 562 * that the wallpaper surface will be there if this window actually 563 * has translucent regions. 564 */ 565 public static final int FLAG_SHOW_WALLPAPER = 0x00100000; 566 567 /** Window flag: when set as a window is being added or made 568 * visible, once the window has been shown then the system will 569 * poke the power manager's user activity (as if the user had woken 570 * up the device) to turn the screen on. */ 571 public static final int FLAG_TURN_SCREEN_ON = 0x00200000; 572 573 /** Window flag: when set the window will cause the keyguard to 574 * be dismissed, only if it is not a secure lock keyguard. Because such 575 * a keyguard is not needed for security, it will never re-appear if 576 * the user navigates to another window (in contrast to 577 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily 578 * hide both secure and non-secure keyguards but ensure they reappear 579 * when the user moves to another UI that doesn't hide them). 580 * If the keyguard is currently active and is secure (requires an 581 * unlock pattern) than the user will still need to confirm it before 582 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has 583 * also been set. 584 */ 585 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000; 586 587 /** Window flag: This window corresponds to an immersive activity 588 * that wishes not to be interrupted with notifications. In general, 589 * applications may simply hide the status bar with 590 * {@link #FLAG_FULLSCREEN} to suppress most notifications, but will 591 * still be interrupted by those with 592 * {@link android.app.Notification#fullScreenIntent fullScreenIntent} 593 * set (example: an incoming call). Setting {@link #FLAG_IMMERSIVE} 594 * will suppress the full-screen intent and show the status bar 595 * briefly for those important notifications instead. 596 * {@see android.app.Notification#FLAG_HIGH_PRIORITY} 597 */ 598 public static final int FLAG_IMMERSIVE = 0x00800000; 599 600 /** Window flag: *sigh* The lock screen wants to continue running its 601 * animation while it is fading. A kind-of hack to allow this. Maybe 602 * in the future we just make this the default behavior. 603 * 604 * {@hide} */ 605 public static final int FLAG_KEEP_SURFACE_WHILE_ANIMATING = 0x10000000; 606 607 /** Window flag: special flag to limit the size of the window to be 608 * original size ([320x480] x density). Used to create window for applications 609 * running under compatibility mode. 610 * 611 * {@hide} */ 612 public static final int FLAG_COMPATIBLE_WINDOW = 0x20000000; 613 614 /** Window flag: a special option intended for system dialogs. When 615 * this flag is set, the window will demand focus unconditionally when 616 * it is created. 617 * {@hide} */ 618 public static final int FLAG_SYSTEM_ERROR = 0x40000000; 619 620 /** 621 * Given a particular set of window manager flags, determine whether 622 * such a window may be a target for an input method when it has 623 * focus. In particular, this checks the 624 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM} 625 * flags and returns true if the combination of the two corresponds 626 * to a window that needs to be behind the input method so that the 627 * user can type into it. 628 * 629 * @param flags The current window manager flags. 630 * 631 * @return Returns true if such a window should be behind/interact 632 * with an input method, false if not. 633 */ 634 public static boolean mayUseInputMethod(int flags) { 635 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) { 636 case 0: 637 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM: 638 return true; 639 } 640 return false; 641 } 642 643 /** 644 * Mask for {@link #softInputMode} of the bits that determine the 645 * desired visibility state of the soft input area for this window. 646 */ 647 public static final int SOFT_INPUT_MASK_STATE = 0x0f; 648 649 /** 650 * Visibility state for {@link #softInputMode}: no state has been specified. 651 */ 652 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; 653 654 /** 655 * Visibility state for {@link #softInputMode}: please don't change the state of 656 * the soft input area. 657 */ 658 public static final int SOFT_INPUT_STATE_UNCHANGED = 1; 659 660 /** 661 * Visibility state for {@link #softInputMode}: please hide any soft input 662 * area when normally appropriate (when the user is navigating 663 * forward to your window). 664 */ 665 public static final int SOFT_INPUT_STATE_HIDDEN = 2; 666 667 /** 668 * Visibility state for {@link #softInputMode}: please always hide any 669 * soft input area when this window receives focus. 670 */ 671 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; 672 673 /** 674 * Visibility state for {@link #softInputMode}: please show the soft 675 * input area when normally appropriate (when the user is navigating 676 * forward to your window). 677 */ 678 public static final int SOFT_INPUT_STATE_VISIBLE = 4; 679 680 /** 681 * Visibility state for {@link #softInputMode}: please always make the 682 * soft input area visible when this window receives input focus. 683 */ 684 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; 685 686 /** 687 * Mask for {@link #softInputMode} of the bits that determine the 688 * way that the window should be adjusted to accommodate the soft 689 * input window. 690 */ 691 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0; 692 693 /** Adjustment option for {@link #softInputMode}: nothing specified. 694 * The system will try to pick one or 695 * the other depending on the contents of the window. 696 */ 697 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00; 698 699 /** Adjustment option for {@link #softInputMode}: set to allow the 700 * window to be resized when an input 701 * method is shown, so that its contents are not covered by the input 702 * method. This can <em>not</em> be combined with 703 * {@link #SOFT_INPUT_ADJUST_PAN}; if 704 * neither of these are set, then the system will try to pick one or 705 * the other depending on the contents of the window. 706 */ 707 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10; 708 709 /** Adjustment option for {@link #softInputMode}: set to have a window 710 * pan when an input method is 711 * shown, so it doesn't need to deal with resizing but just panned 712 * by the framework to ensure the current input focus is visible. This 713 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if 714 * neither of these are set, then the system will try to pick one or 715 * the other depending on the contents of the window. 716 */ 717 public static final int SOFT_INPUT_ADJUST_PAN = 0x20; 718 719 /** 720 * Bit for {@link #softInputMode}: set when the user has navigated 721 * forward to the window. This is normally set automatically for 722 * you by the system, though you may want to set it in certain cases 723 * when you are displaying a window yourself. This flag will always 724 * be cleared automatically after the window is displayed. 725 */ 726 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100; 727 728 /** 729 * Default value for {@link #screenBrightness} and {@link #buttonBrightness} 730 * indicating that the brightness value is not overridden for this window 731 * and normal brightness policy should be used. 732 */ 733 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f; 734 735 /** 736 * Value for {@link #screenBrightness} and {@link #buttonBrightness} 737 * indicating that the screen or button backlight brightness should be set 738 * to the lowest value when this window is in front. 739 */ 740 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f; 741 742 /** 743 * Value for {@link #screenBrightness} and {@link #buttonBrightness} 744 * indicating that the screen or button backlight brightness should be set 745 * to the hightest value when this window is in front. 746 */ 747 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f; 748 749 /** 750 * Desired operating mode for any soft input area. May any combination 751 * of: 752 * 753 * <ul> 754 * <li> One of the visibility states 755 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED}, 756 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or 757 * {@link #SOFT_INPUT_STATE_VISIBLE}. 758 * <li> One of the adjustment options 759 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, 760 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or 761 * {@link #SOFT_INPUT_ADJUST_PAN}. 762 */ 763 public int softInputMode; 764 765 /** 766 * Placement of window within the screen as per {@link Gravity} 767 * 768 * @see Gravity 769 */ 770 public int gravity; 771 772 /** 773 * The horizontal margin, as a percentage of the container's width, 774 * between the container and the widget. 775 */ 776 public float horizontalMargin; 777 778 /** 779 * The vertical margin, as a percentage of the container's height, 780 * between the container and the widget. 781 */ 782 public float verticalMargin; 783 784 /** 785 * The desired bitmap format. May be one of the constants in 786 * {@link android.graphics.PixelFormat}. Default is OPAQUE. 787 */ 788 public int format; 789 790 /** 791 * A style resource defining the animations to use for this window. 792 * This must be a system resource; it can not be an application resource 793 * because the window manager does not have access to applications. 794 */ 795 public int windowAnimations; 796 797 /** 798 * An alpha value to apply to this entire window. 799 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent 800 */ 801 public float alpha = 1.0f; 802 803 /** 804 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming 805 * to apply. Range is from 1.0 for completely opaque to 0.0 for no 806 * dim. 807 */ 808 public float dimAmount = 1.0f; 809 810 /** 811 * This can be used to override the user's preferred brightness of 812 * the screen. A value of less than 0, the default, means to use the 813 * preferred screen brightness. 0 to 1 adjusts the brightness from 814 * dark to full bright. 815 */ 816 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE; 817 818 /** 819 * This can be used to override the standard behavior of the button and 820 * keyboard backlights. A value of less than 0, the default, means to 821 * use the standard backlight behavior. 0 to 1 adjusts the brightness 822 * from dark to full bright. 823 */ 824 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE; 825 826 /** 827 * Identifier for this window. This will usually be filled in for 828 * you. 829 */ 830 public IBinder token = null; 831 832 /** 833 * Name of the package owning this window. 834 */ 835 public String packageName = null; 836 837 /** 838 * Specific orientation value for a window. 839 * May be any of the same values allowed 840 * for {@link android.content.pm.ActivityInfo#screenOrientation}. 841 * If not set, a default value of 842 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED} 843 * will be used. 844 */ 845 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; 846 847 848 public LayoutParams() { 849 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 850 type = TYPE_APPLICATION; 851 format = PixelFormat.OPAQUE; 852 } 853 854 public LayoutParams(int _type) { 855 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 856 type = _type; 857 format = PixelFormat.OPAQUE; 858 } 859 860 public LayoutParams(int _type, int _flags) { 861 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 862 type = _type; 863 flags = _flags; 864 format = PixelFormat.OPAQUE; 865 } 866 867 public LayoutParams(int _type, int _flags, int _format) { 868 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 869 type = _type; 870 flags = _flags; 871 format = _format; 872 } 873 874 public LayoutParams(int w, int h, int _type, int _flags, int _format) { 875 super(w, h); 876 type = _type; 877 flags = _flags; 878 format = _format; 879 } 880 881 public LayoutParams(int w, int h, int xpos, int ypos, int _type, 882 int _flags, int _format) { 883 super(w, h); 884 x = xpos; 885 y = ypos; 886 type = _type; 887 flags = _flags; 888 format = _format; 889 } 890 891 public final void setTitle(CharSequence title) { 892 if (null == title) 893 title = ""; 894 895 mTitle = TextUtils.stringOrSpannedString(title); 896 } 897 898 public final CharSequence getTitle() { 899 return mTitle; 900 } 901 902 public int describeContents() { 903 return 0; 904 } 905 906 public void writeToParcel(Parcel out, int parcelableFlags) { 907 out.writeInt(width); 908 out.writeInt(height); 909 out.writeInt(x); 910 out.writeInt(y); 911 out.writeInt(type); 912 out.writeInt(memoryType); 913 out.writeInt(flags); 914 out.writeInt(softInputMode); 915 out.writeInt(gravity); 916 out.writeFloat(horizontalMargin); 917 out.writeFloat(verticalMargin); 918 out.writeInt(format); 919 out.writeInt(windowAnimations); 920 out.writeFloat(alpha); 921 out.writeFloat(dimAmount); 922 out.writeFloat(screenBrightness); 923 out.writeFloat(buttonBrightness); 924 out.writeStrongBinder(token); 925 out.writeString(packageName); 926 TextUtils.writeToParcel(mTitle, out, parcelableFlags); 927 out.writeInt(screenOrientation); 928 } 929 930 public static final Parcelable.Creator<LayoutParams> CREATOR 931 = new Parcelable.Creator<LayoutParams>() { 932 public LayoutParams createFromParcel(Parcel in) { 933 return new LayoutParams(in); 934 } 935 936 public LayoutParams[] newArray(int size) { 937 return new LayoutParams[size]; 938 } 939 }; 940 941 942 public LayoutParams(Parcel in) { 943 width = in.readInt(); 944 height = in.readInt(); 945 x = in.readInt(); 946 y = in.readInt(); 947 type = in.readInt(); 948 memoryType = in.readInt(); 949 flags = in.readInt(); 950 softInputMode = in.readInt(); 951 gravity = in.readInt(); 952 horizontalMargin = in.readFloat(); 953 verticalMargin = in.readFloat(); 954 format = in.readInt(); 955 windowAnimations = in.readInt(); 956 alpha = in.readFloat(); 957 dimAmount = in.readFloat(); 958 screenBrightness = in.readFloat(); 959 buttonBrightness = in.readFloat(); 960 token = in.readStrongBinder(); 961 packageName = in.readString(); 962 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); 963 screenOrientation = in.readInt(); 964 } 965 966 @SuppressWarnings({"PointlessBitwiseExpression"}) 967 public static final int LAYOUT_CHANGED = 1<<0; 968 public static final int TYPE_CHANGED = 1<<1; 969 public static final int FLAGS_CHANGED = 1<<2; 970 public static final int FORMAT_CHANGED = 1<<3; 971 public static final int ANIMATION_CHANGED = 1<<4; 972 public static final int DIM_AMOUNT_CHANGED = 1<<5; 973 public static final int TITLE_CHANGED = 1<<6; 974 public static final int ALPHA_CHANGED = 1<<7; 975 public static final int MEMORY_TYPE_CHANGED = 1<<8; 976 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9; 977 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10; 978 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11; 979 /** {@hide} */ 980 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<12; 981 982 // internal buffer to backup/restore parameters under compatibility mode. 983 private int[] mCompatibilityParamsBackup = null; 984 985 public final int copyFrom(LayoutParams o) { 986 int changes = 0; 987 988 if (width != o.width) { 989 width = o.width; 990 changes |= LAYOUT_CHANGED; 991 } 992 if (height != o.height) { 993 height = o.height; 994 changes |= LAYOUT_CHANGED; 995 } 996 if (x != o.x) { 997 x = o.x; 998 changes |= LAYOUT_CHANGED; 999 } 1000 if (y != o.y) { 1001 y = o.y; 1002 changes |= LAYOUT_CHANGED; 1003 } 1004 if (horizontalWeight != o.horizontalWeight) { 1005 horizontalWeight = o.horizontalWeight; 1006 changes |= LAYOUT_CHANGED; 1007 } 1008 if (verticalWeight != o.verticalWeight) { 1009 verticalWeight = o.verticalWeight; 1010 changes |= LAYOUT_CHANGED; 1011 } 1012 if (horizontalMargin != o.horizontalMargin) { 1013 horizontalMargin = o.horizontalMargin; 1014 changes |= LAYOUT_CHANGED; 1015 } 1016 if (verticalMargin != o.verticalMargin) { 1017 verticalMargin = o.verticalMargin; 1018 changes |= LAYOUT_CHANGED; 1019 } 1020 if (type != o.type) { 1021 type = o.type; 1022 changes |= TYPE_CHANGED; 1023 } 1024 if (memoryType != o.memoryType) { 1025 memoryType = o.memoryType; 1026 changes |= MEMORY_TYPE_CHANGED; 1027 } 1028 if (flags != o.flags) { 1029 flags = o.flags; 1030 changes |= FLAGS_CHANGED; 1031 } 1032 if (softInputMode != o.softInputMode) { 1033 softInputMode = o.softInputMode; 1034 changes |= SOFT_INPUT_MODE_CHANGED; 1035 } 1036 if (gravity != o.gravity) { 1037 gravity = o.gravity; 1038 changes |= LAYOUT_CHANGED; 1039 } 1040 if (horizontalMargin != o.horizontalMargin) { 1041 horizontalMargin = o.horizontalMargin; 1042 changes |= LAYOUT_CHANGED; 1043 } 1044 if (verticalMargin != o.verticalMargin) { 1045 verticalMargin = o.verticalMargin; 1046 changes |= LAYOUT_CHANGED; 1047 } 1048 if (format != o.format) { 1049 format = o.format; 1050 changes |= FORMAT_CHANGED; 1051 } 1052 if (windowAnimations != o.windowAnimations) { 1053 windowAnimations = o.windowAnimations; 1054 changes |= ANIMATION_CHANGED; 1055 } 1056 if (token == null) { 1057 // NOTE: token only copied if the recipient doesn't 1058 // already have one. 1059 token = o.token; 1060 } 1061 if (packageName == null) { 1062 // NOTE: packageName only copied if the recipient doesn't 1063 // already have one. 1064 packageName = o.packageName; 1065 } 1066 if (!mTitle.equals(o.mTitle)) { 1067 mTitle = o.mTitle; 1068 changes |= TITLE_CHANGED; 1069 } 1070 if (alpha != o.alpha) { 1071 alpha = o.alpha; 1072 changes |= ALPHA_CHANGED; 1073 } 1074 if (dimAmount != o.dimAmount) { 1075 dimAmount = o.dimAmount; 1076 changes |= DIM_AMOUNT_CHANGED; 1077 } 1078 if (screenBrightness != o.screenBrightness) { 1079 screenBrightness = o.screenBrightness; 1080 changes |= SCREEN_BRIGHTNESS_CHANGED; 1081 } 1082 if (buttonBrightness != o.buttonBrightness) { 1083 buttonBrightness = o.buttonBrightness; 1084 changes |= BUTTON_BRIGHTNESS_CHANGED; 1085 } 1086 1087 if (screenOrientation != o.screenOrientation) { 1088 screenOrientation = o.screenOrientation; 1089 changes |= SCREEN_ORIENTATION_CHANGED; 1090 } 1091 return changes; 1092 } 1093 1094 @Override 1095 public String debug(String output) { 1096 output += "Contents of " + this + ":"; 1097 Log.d("Debug", output); 1098 output = super.debug(""); 1099 Log.d("Debug", output); 1100 Log.d("Debug", ""); 1101 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}"); 1102 return ""; 1103 } 1104 1105 @Override 1106 public String toString() { 1107 StringBuilder sb = new StringBuilder(256); 1108 sb.append("WM.LayoutParams{"); 1109 sb.append("("); 1110 sb.append(x); 1111 sb.append(','); 1112 sb.append(y); 1113 sb.append(")("); 1114 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width))); 1115 sb.append('x'); 1116 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height))); 1117 sb.append(")"); 1118 if (softInputMode != 0) { 1119 sb.append(" sim=#"); 1120 sb.append(Integer.toHexString(softInputMode)); 1121 } 1122 if (gravity != 0) { 1123 sb.append(" gr=#"); 1124 sb.append(Integer.toHexString(gravity)); 1125 } 1126 sb.append(" ty="); 1127 sb.append(type); 1128 sb.append(" fl=#"); 1129 sb.append(Integer.toHexString(flags)); 1130 sb.append(" fmt="); 1131 sb.append(format); 1132 if (windowAnimations != 0) { 1133 sb.append(" wanim=0x"); 1134 sb.append(Integer.toHexString(windowAnimations)); 1135 } 1136 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) { 1137 sb.append(" or="); 1138 sb.append(screenOrientation); 1139 } 1140 if ((flags & FLAG_COMPATIBLE_WINDOW) != 0) { 1141 sb.append(" compatible=true"); 1142 } 1143 sb.append('}'); 1144 return sb.toString(); 1145 } 1146 1147 /** 1148 * Scale the layout params' coordinates and size. 1149 * @hide 1150 */ 1151 public void scale(float scale) { 1152 x = (int) (x * scale + 0.5f); 1153 y = (int) (y * scale + 0.5f); 1154 if (width > 0) { 1155 width = (int) (width * scale + 0.5f); 1156 } 1157 if (height > 0) { 1158 height = (int) (height * scale + 0.5f); 1159 } 1160 } 1161 1162 /** 1163 * Backup the layout parameters used in compatibility mode. 1164 * @see LayoutParams#restore() 1165 */ 1166 void backup() { 1167 int[] backup = mCompatibilityParamsBackup; 1168 if (backup == null) { 1169 // we backup 4 elements, x, y, width, height 1170 backup = mCompatibilityParamsBackup = new int[4]; 1171 } 1172 backup[0] = x; 1173 backup[1] = y; 1174 backup[2] = width; 1175 backup[3] = height; 1176 } 1177 1178 /** 1179 * Restore the layout params' coordinates, size and gravity 1180 * @see LayoutParams#backup() 1181 */ 1182 void restore() { 1183 int[] backup = mCompatibilityParamsBackup; 1184 if (backup != null) { 1185 x = backup[0]; 1186 y = backup[1]; 1187 width = backup[2]; 1188 height = backup[3]; 1189 } 1190 } 1191 1192 private CharSequence mTitle = ""; 1193 } 1194} 1195