1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.view; 18 19 import android.annotation.IntDef; 20 import android.annotation.SystemApi; 21 import android.app.ActivityManager.StackId; 22 import android.content.Context; 23 import android.content.pm.ActivityInfo; 24 import android.content.res.CompatibilityInfo; 25 import android.content.res.Configuration; 26 import android.graphics.Point; 27 import android.graphics.Rect; 28 import android.graphics.RectF; 29 import android.os.Bundle; 30 import android.os.IBinder; 31 import android.os.Looper; 32 import android.os.RemoteException; 33 import android.view.animation.Animation; 34 import com.android.internal.policy.IShortcutService; 35 36 import java.io.PrintWriter; 37 import java.lang.annotation.Retention; 38 import java.lang.annotation.RetentionPolicy; 39 40 /** 41 * This interface supplies all UI-specific behavior of the window manager. An 42 * instance of it is created by the window manager when it starts up, and allows 43 * customization of window layering, special window types, key dispatching, and 44 * layout. 45 * 46 * <p>Because this provides deep interaction with the system window manager, 47 * specific methods on this interface can be called from a variety of contexts 48 * with various restrictions on what they can do. These are encoded through 49 * a suffixes at the end of a method encoding the thread the method is called 50 * from and any locks that are held when it is being called; if no suffix 51 * is attached to a method, then it is not called with any locks and may be 52 * called from the main window manager thread or another thread calling into 53 * the window manager. 54 * 55 * <p>The current suffixes are: 56 * 57 * <dl> 58 * <dt> Ti <dd> Called from the input thread. This is the thread that 59 * collects pending input events and dispatches them to the appropriate window. 60 * It may block waiting for events to be processed, so that the input stream is 61 * properly serialized. 62 * <dt> Tq <dd> Called from the low-level input queue thread. This is the 63 * thread that reads events out of the raw input devices and places them 64 * into the global input queue that is read by the <var>Ti</var> thread. 65 * This thread should not block for a long period of time on anything but the 66 * key driver. 67 * <dt> Lw <dd> Called with the main window manager lock held. Because the 68 * window manager is a very low-level system service, there are few other 69 * system services you can call with this lock held. It is explicitly okay to 70 * make calls into the package manager and power manager; it is explicitly not 71 * okay to make calls into the activity manager or most other services. Note that 72 * {@link android.content.Context#checkPermission(String, int, int)} and 73 * variations require calling into the activity manager. 74 * <dt> Li <dd> Called with the input thread lock held. This lock can be 75 * acquired by the window manager while it holds the window lock, so this is 76 * even more restrictive than <var>Lw</var>. 77 * </dl> 78 * 79 * @hide 80 */ 81 public interface WindowManagerPolicy { 82 // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h. 83 public final static int FLAG_WAKE = 0x00000001; 84 public final static int FLAG_VIRTUAL = 0x00000002; 85 86 public final static int FLAG_INJECTED = 0x01000000; 87 public final static int FLAG_TRUSTED = 0x02000000; 88 public final static int FLAG_FILTERED = 0x04000000; 89 public final static int FLAG_DISABLE_KEY_REPEAT = 0x08000000; 90 91 public final static int FLAG_INTERACTIVE = 0x20000000; 92 public final static int FLAG_PASS_TO_USER = 0x40000000; 93 94 // Flags for IActivityManager.keyguardGoingAway() 95 public final static int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0; 96 public final static int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1; 97 public final static int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2; 98 99 // Flags used for indicating whether the internal and/or external input devices 100 // of some type are available. 101 public final static int PRESENCE_INTERNAL = 1 << 0; 102 public final static int PRESENCE_EXTERNAL = 1 << 1; 103 104 public final static boolean WATCH_POINTER = false; 105 106 /** 107 * Sticky broadcast of the current HDMI plugged state. 108 */ 109 public final static String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED"; 110 111 /** 112 * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if 113 * plugged in to HDMI, false if not. 114 */ 115 public final static String EXTRA_HDMI_PLUGGED_STATE = "state"; 116 117 /** 118 * Set to {@code true} when intent was invoked from pressing the home key. 119 * @hide 120 */ 121 @SystemApi 122 public static final String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY"; 123 124 /** 125 * Pass this event to the user / app. To be returned from 126 * {@link #interceptKeyBeforeQueueing}. 127 */ 128 public final static int ACTION_PASS_TO_USER = 0x00000001; 129 130 /** 131 * Register shortcuts for window manager to dispatch. 132 * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode 133 * @hide 134 */ 135 void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver) 136 throws RemoteException; 137 138 /** 139 * @return true if windows with FLAG_DISMISS_KEYGUARD should be allowed to show even if 140 * the keyguard is locked. 141 */ 142 boolean canShowDismissingWindowWhileLockedLw(); 143 144 /** 145 * Interface to the Window Manager state associated with a particular 146 * window. You can hold on to an instance of this interface from the call 147 * to prepareAddWindow() until removeWindow(). 148 */ 149 public interface WindowState { 150 /** 151 * Return the uid of the app that owns this window. 152 */ 153 int getOwningUid(); 154 155 /** 156 * Return the package name of the app that owns this window. 157 */ 158 String getOwningPackage(); 159 160 /** 161 * Perform standard frame computation. The result can be obtained with 162 * getFrame() if so desired. Must be called with the window manager 163 * lock held. 164 * 165 * @param parentFrame The frame of the parent container this window 166 * is in, used for computing its basic position. 167 * @param displayFrame The frame of the overall display in which this 168 * window can appear, used for constraining the overall dimensions 169 * of the window. 170 * @param overlayFrame The frame within the display that is inside 171 * of the overlay region. 172 * @param contentFrame The frame within the display in which we would 173 * like active content to appear. This will cause windows behind to 174 * be resized to match the given content frame. 175 * @param visibleFrame The frame within the display that the window 176 * is actually visible, used for computing its visible insets to be 177 * given to windows behind. 178 * This can be used as a hint for scrolling (avoiding resizing) 179 * the window to make certain that parts of its content 180 * are visible. 181 * @param decorFrame The decor frame specified by policy specific to this window, 182 * to use for proper cropping during animation. 183 * @param stableFrame The frame around which stable system decoration is positioned. 184 * @param outsetFrame The frame that includes areas that aren't part of the surface but we 185 * want to treat them as such. 186 */ 187 public void computeFrameLw(Rect parentFrame, Rect displayFrame, 188 Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame, 189 Rect stableFrame, Rect outsetFrame); 190 191 /** 192 * Retrieve the current frame of the window that has been assigned by 193 * the window manager. Must be called with the window manager lock held. 194 * 195 * @return Rect The rectangle holding the window frame. 196 */ 197 public Rect getFrameLw(); 198 199 /** 200 * Retrieve the current position of the window that is actually shown. 201 * Must be called with the window manager lock held. 202 * 203 * @return Point The point holding the shown window position. 204 */ 205 public Point getShownPositionLw(); 206 207 /** 208 * Retrieve the frame of the display that this window was last 209 * laid out in. Must be called with the 210 * window manager lock held. 211 * 212 * @return Rect The rectangle holding the display frame. 213 */ 214 public Rect getDisplayFrameLw(); 215 216 /** 217 * Retrieve the frame of the area inside the overscan region of the 218 * display that this window was last laid out in. Must be called with the 219 * window manager lock held. 220 * 221 * @return Rect The rectangle holding the display overscan frame. 222 */ 223 public Rect getOverscanFrameLw(); 224 225 /** 226 * Retrieve the frame of the content area that this window was last 227 * laid out in. This is the area in which the content of the window 228 * should be placed. It will be smaller than the display frame to 229 * account for screen decorations such as a status bar or soft 230 * keyboard. Must be called with the 231 * window manager lock held. 232 * 233 * @return Rect The rectangle holding the content frame. 234 */ 235 public Rect getContentFrameLw(); 236 237 /** 238 * Retrieve the frame of the visible area that this window was last 239 * laid out in. This is the area of the screen in which the window 240 * will actually be fully visible. It will be smaller than the 241 * content frame to account for transient UI elements blocking it 242 * such as an input method's candidates UI. Must be called with the 243 * window manager lock held. 244 * 245 * @return Rect The rectangle holding the visible frame. 246 */ 247 public Rect getVisibleFrameLw(); 248 249 /** 250 * Returns true if this window is waiting to receive its given 251 * internal insets from the client app, and so should not impact the 252 * layout of other windows. 253 */ 254 public boolean getGivenInsetsPendingLw(); 255 256 /** 257 * Retrieve the insets given by this window's client for the content 258 * area of windows behind it. Must be called with the 259 * window manager lock held. 260 * 261 * @return Rect The left, top, right, and bottom insets, relative 262 * to the window's frame, of the actual contents. 263 */ 264 public Rect getGivenContentInsetsLw(); 265 266 /** 267 * Retrieve the insets given by this window's client for the visible 268 * area of windows behind it. Must be called with the 269 * window manager lock held. 270 * 271 * @return Rect The left, top, right, and bottom insets, relative 272 * to the window's frame, of the actual visible area. 273 */ 274 public Rect getGivenVisibleInsetsLw(); 275 276 /** 277 * Retrieve the current LayoutParams of the window. 278 * 279 * @return WindowManager.LayoutParams The window's internal LayoutParams 280 * instance. 281 */ 282 public WindowManager.LayoutParams getAttrs(); 283 284 /** 285 * Return whether this window needs the menu key shown. Must be called 286 * with window lock held, because it may need to traverse down through 287 * window list to determine the result. 288 * @param bottom The bottom-most window to consider when determining this. 289 */ 290 public boolean getNeedsMenuLw(WindowState bottom); 291 292 /** 293 * Retrieve the current system UI visibility flags associated with 294 * this window. 295 */ 296 public int getSystemUiVisibility(); 297 298 /** 299 * Get the layer at which this window's surface will be Z-ordered. 300 */ 301 public int getSurfaceLayer(); 302 303 /** 304 * Retrieve the type of the top-level window. 305 * 306 * @return the base type of the parent window if attached or its own type otherwise 307 */ 308 public int getBaseType(); 309 310 /** 311 * Return the token for the application (actually activity) that owns 312 * this window. May return null for system windows. 313 * 314 * @return An IApplicationToken identifying the owning activity. 315 */ 316 public IApplicationToken getAppToken(); 317 318 /** 319 * Return true if this window is participating in voice interaction. 320 */ 321 public boolean isVoiceInteraction(); 322 323 /** 324 * Return true if, at any point, the application token associated with 325 * this window has actually displayed any windows. This is most useful 326 * with the "starting up" window to determine if any windows were 327 * displayed when it is closed. 328 * 329 * @return Returns true if one or more windows have been displayed, 330 * else false. 331 */ 332 public boolean hasAppShownWindows(); 333 334 /** 335 * Is this window visible? It is not visible if there is no 336 * surface, or we are in the process of running an exit animation 337 * that will remove the surface. 338 */ 339 boolean isVisibleLw(); 340 341 /** 342 * Like {@link #isVisibleLw}, but also counts a window that is currently 343 * "hidden" behind the keyguard as visible. This allows us to apply 344 * things like window flags that impact the keyguard. 345 */ 346 boolean isVisibleOrBehindKeyguardLw(); 347 348 /** 349 * Is this window currently visible to the user on-screen? It is 350 * displayed either if it is visible or it is currently running an 351 * animation before no longer being visible. Must be called with the 352 * window manager lock held. 353 */ 354 boolean isDisplayedLw(); 355 356 /** 357 * Return true if this window (or a window it is attached to, but not 358 * considering its app token) is currently animating. 359 */ 360 boolean isAnimatingLw(); 361 362 /** 363 * Is this window considered to be gone for purposes of layout? 364 */ 365 boolean isGoneForLayoutLw(); 366 367 /** 368 * Returns true if the window has a surface that it has drawn a 369 * complete UI in to. Note that this is different from {@link #hasDrawnLw()} 370 * in that it also returns true if the window is READY_TO_SHOW, but was not yet 371 * promoted to HAS_DRAWN. 372 */ 373 boolean isDrawnLw(); 374 375 /** 376 * Returns true if this window has been shown on screen at some time in 377 * the past. Must be called with the window manager lock held. 378 */ 379 public boolean hasDrawnLw(); 380 381 /** 382 * Can be called by the policy to force a window to be hidden, 383 * regardless of whether the client or window manager would like 384 * it shown. Must be called with the window manager lock held. 385 * Returns true if {@link #showLw} was last called for the window. 386 */ 387 public boolean hideLw(boolean doAnimation); 388 389 /** 390 * Can be called to undo the effect of {@link #hideLw}, allowing a 391 * window to be shown as long as the window manager and client would 392 * also like it to be shown. Must be called with the window manager 393 * lock held. 394 * Returns true if {@link #hideLw} was last called for the window. 395 */ 396 public boolean showLw(boolean doAnimation); 397 398 /** 399 * Check whether the process hosting this window is currently alive. 400 */ 401 public boolean isAlive(); 402 403 /** 404 * Check if window is on {@link Display#DEFAULT_DISPLAY}. 405 * @return true if window is on default display. 406 */ 407 public boolean isDefaultDisplay(); 408 409 /** 410 * Check whether the window is currently dimming. 411 */ 412 public boolean isDimming(); 413 414 /** 415 * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if 416 * not attached to any stack. 417 */ 418 int getStackId(); 419 420 /** 421 * Returns true if the window is current in multi-windowing mode. i.e. it shares the 422 * screen with other application windows. 423 */ 424 public boolean isInMultiWindowMode(); 425 426 public int getRotationAnimationHint(); 427 } 428 429 /** 430 * Representation of a input consumer that the policy has added to the 431 * window manager to consume input events going to windows below it. 432 */ 433 public interface InputConsumer { 434 /** 435 * Remove the input consumer from the window manager. 436 */ 437 void dismiss(); 438 } 439 440 /** 441 * Interface for calling back in to the window manager that is private 442 * between it and the policy. 443 */ 444 public interface WindowManagerFuncs { 445 public static final int LID_ABSENT = -1; 446 public static final int LID_CLOSED = 0; 447 public static final int LID_OPEN = 1; 448 449 public static final int CAMERA_LENS_COVER_ABSENT = -1; 450 public static final int CAMERA_LENS_UNCOVERED = 0; 451 public static final int CAMERA_LENS_COVERED = 1; 452 453 /** 454 * Ask the window manager to re-evaluate the system UI flags. 455 */ 456 public void reevaluateStatusBarVisibility(); 457 458 /** 459 * Add a input consumer which will consume all input events going to any window below it. 460 */ 461 public InputConsumer addInputConsumer(Looper looper, 462 InputEventReceiver.Factory inputEventReceiverFactory); 463 464 /** 465 * Returns a code that describes the current state of the lid switch. 466 */ 467 public int getLidState(); 468 469 /** 470 * Lock the device now. 471 */ 472 public void lockDeviceNow(); 473 474 /** 475 * Returns a code that descripbes whether the camera lens is covered or not. 476 */ 477 public int getCameraLensCoverState(); 478 479 /** 480 * Switch the input method, to be precise, input method subtype. 481 * 482 * @param forwardDirection {@code true} to rotate in a forward direction. 483 */ 484 public void switchInputMethod(boolean forwardDirection); 485 486 public void shutdown(boolean confirm); 487 public void reboot(boolean confirm); 488 public void rebootSafeMode(boolean confirm); 489 490 /** 491 * Return the window manager lock needed to correctly call "Lw" methods. 492 */ 493 public Object getWindowManagerLock(); 494 495 /** Register a system listener for touch events */ 496 void registerPointerEventListener(PointerEventListener listener); 497 498 /** Unregister a system listener for touch events */ 499 void unregisterPointerEventListener(PointerEventListener listener); 500 501 /** 502 * @return The content insets of the docked divider window. 503 */ 504 int getDockedDividerInsetsLw(); 505 506 /** 507 * Retrieves the {@param outBounds} from the stack with id {@param stackId}. 508 */ 509 void getStackBounds(int stackId, Rect outBounds); 510 511 /** 512 * Overrides all currently playing app animations with {@param a}. 513 */ 514 void overridePlayingAppAnimationsLw(Animation a); 515 } 516 517 public interface PointerEventListener { 518 /** 519 * 1. onPointerEvent will be called on the service.UiThread. 520 * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a 521 * copy() must be made and the copy must be recycled. 522 **/ 523 public void onPointerEvent(MotionEvent motionEvent); 524 } 525 526 /** Window has been added to the screen. */ 527 public static final int TRANSIT_ENTER = 1; 528 /** Window has been removed from the screen. */ 529 public static final int TRANSIT_EXIT = 2; 530 /** Window has been made visible. */ 531 public static final int TRANSIT_SHOW = 3; 532 /** Window has been made invisible. 533 * TODO: Consider removal as this is unused. */ 534 public static final int TRANSIT_HIDE = 4; 535 /** The "application starting" preview window is no longer needed, and will 536 * animate away to show the real window. */ 537 public static final int TRANSIT_PREVIEW_DONE = 5; 538 539 // NOTE: screen off reasons are in order of significance, with more 540 // important ones lower than less important ones. 541 542 /** Screen turned off because of a device admin */ 543 public final int OFF_BECAUSE_OF_ADMIN = 1; 544 /** Screen turned off because of power button */ 545 public final int OFF_BECAUSE_OF_USER = 2; 546 /** Screen turned off because of timeout */ 547 public final int OFF_BECAUSE_OF_TIMEOUT = 3; 548 549 /** @hide */ 550 @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED}) 551 @Retention(RetentionPolicy.SOURCE) 552 public @interface UserRotationMode {} 553 554 /** When not otherwise specified by the activity's screenOrientation, rotation should be 555 * determined by the system (that is, using sensors). */ 556 public final int USER_ROTATION_FREE = 0; 557 /** When not otherwise specified by the activity's screenOrientation, rotation is set by 558 * the user. */ 559 public final int USER_ROTATION_LOCKED = 1; 560 561 /** 562 * Perform initialization of the policy. 563 * 564 * @param context The system context we are running in. 565 */ 566 public void init(Context context, IWindowManager windowManager, 567 WindowManagerFuncs windowManagerFuncs); 568 569 /** 570 * @return true if com.android.internal.R.bool#config_forceDefaultOrientation is true. 571 */ 572 public boolean isDefaultOrientationForced(); 573 574 /** 575 * Called by window manager once it has the initial, default native 576 * display dimensions. 577 */ 578 public void setInitialDisplaySize(Display display, int width, int height, int density); 579 580 /** 581 * Called by window manager to set the overscan region that should be used for the 582 * given display. 583 */ 584 public void setDisplayOverscan(Display display, int left, int top, int right, int bottom); 585 586 /** 587 * Check permissions when adding a window. 588 * 589 * @param attrs The window's LayoutParams. 590 * @param outAppOp First element will be filled with the app op corresponding to 591 * this window, or OP_NONE. 592 * 593 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed; 594 * else an error code, usually 595 * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add. 596 */ 597 public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp); 598 599 /** 600 * Check permissions when adding a window. 601 * 602 * @param attrs The window's LayoutParams. 603 * 604 * @return True if the window may only be shown to the current user, false if the window can 605 * be shown on all users' windows. 606 */ 607 public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs); 608 609 /** 610 * Sanitize the layout parameters coming from a client. Allows the policy 611 * to do things like ensure that windows of a specific type can't take 612 * input focus. 613 * 614 * @param attrs The window layout parameters to be modified. These values 615 * are modified in-place. 616 */ 617 public void adjustWindowParamsLw(WindowManager.LayoutParams attrs); 618 619 /** 620 * After the window manager has computed the current configuration based 621 * on its knowledge of the display and input devices, it gives the policy 622 * a chance to adjust the information contained in it. If you want to 623 * leave it as-is, simply do nothing. 624 * 625 * <p>This method may be called by any thread in the window manager, but 626 * no internal locks in the window manager will be held. 627 * 628 * @param config The Configuration being computed, for you to change as 629 * desired. 630 * @param keyboardPresence Flags that indicate whether internal or external 631 * keyboards are present. 632 * @param navigationPresence Flags that indicate whether internal or external 633 * navigation devices are present. 634 */ 635 public void adjustConfigurationLw(Configuration config, int keyboardPresence, 636 int navigationPresence); 637 638 /** 639 * Assign a window type to a layer. Allows you to control how different 640 * kinds of windows are ordered on-screen. 641 * 642 * @param type The type of window being assigned. 643 * 644 * @return int An arbitrary integer used to order windows, with lower 645 * numbers below higher ones. 646 */ 647 public int windowTypeToLayerLw(int type); 648 649 /** 650 * Return how to Z-order sub-windows in relation to the window they are 651 * attached to. Return positive to have them ordered in front, negative for 652 * behind. 653 * 654 * @param type The sub-window type code. 655 * 656 * @return int Layer in relation to the attached window, where positive is 657 * above and negative is below. 658 */ 659 public int subWindowTypeToLayerLw(int type); 660 661 /** 662 * Get the highest layer (actually one more than) that the wallpaper is 663 * allowed to be in. 664 */ 665 public int getMaxWallpaperLayer(); 666 667 /** 668 * Return the display width available after excluding any screen 669 * decorations that could never be removed in Honeycomb. That is, system bar or 670 * button bar. 671 */ 672 public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation, 673 int uiMode); 674 675 /** 676 * Return the display height available after excluding any screen 677 * decorations that could never be removed in Honeycomb. That is, system bar or 678 * button bar. 679 */ 680 public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation, 681 int uiMode); 682 683 /** 684 * Return the available screen width that we should report for the 685 * configuration. This must be no larger than 686 * {@link #getNonDecorDisplayWidth(int, int, int)}; it may be smaller than 687 * that to account for more transient decoration like a status bar. 688 */ 689 public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation, 690 int uiMode); 691 692 /** 693 * Return the available screen height that we should report for the 694 * configuration. This must be no larger than 695 * {@link #getNonDecorDisplayHeight(int, int, int)}; it may be smaller than 696 * that to account for more transient decoration like a status bar. 697 */ 698 public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation, 699 int uiMode); 700 701 /** 702 * Return whether the given window is forcibly hiding all windows except windows with 703 * FLAG_SHOW_WHEN_LOCKED set. Typically returns true for the keyguard. 704 */ 705 public boolean isForceHiding(WindowManager.LayoutParams attrs); 706 707 708 /** 709 * Return whether the given window can become one that passes isForceHiding() test. 710 * Typically returns true for the StatusBar. 711 */ 712 public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs); 713 714 /** 715 * Determine if a window that is behind one that is force hiding 716 * (as determined by {@link #isForceHiding}) should actually be hidden. 717 * For example, typically returns false for the status bar. Be careful 718 * to return false for any window that you may hide yourself, since this 719 * will conflict with what you set. 720 */ 721 public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs); 722 723 /** 724 * Return the window that is hiding the keyguard, if such a thing exists. 725 */ 726 public WindowState getWinShowWhenLockedLw(); 727 728 /** 729 * Called when the system would like to show a UI to indicate that an 730 * application is starting. You can use this to add a 731 * APPLICATION_STARTING_TYPE window with the given appToken to the window 732 * manager (using the normal window manager APIs) that will be shown until 733 * the application displays its own window. This is called without the 734 * window manager locked so that you can call back into it. 735 * 736 * @param appToken Token of the application being started. 737 * @param packageName The name of the application package being started. 738 * @param theme Resource defining the application's overall visual theme. 739 * @param nonLocalizedLabel The default title label of the application if 740 * no data is found in the resource. 741 * @param labelRes The resource ID the application would like to use as its name. 742 * @param icon The resource ID the application would like to use as its icon. 743 * @param windowFlags Window layout flags. 744 * @param overrideConfig override configuration to consider when generating 745 * context to for resources. 746 * 747 * @return Optionally you can return the View that was used to create the 748 * window, for easy removal in removeStartingWindow. 749 * 750 * @see #removeStartingWindow 751 */ 752 public View addStartingWindow(IBinder appToken, String packageName, 753 int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, 754 int labelRes, int icon, int logo, int windowFlags, Configuration overrideConfig); 755 756 /** 757 * Called when the first window of an application has been displayed, while 758 * {@link #addStartingWindow} has created a temporary initial window for 759 * that application. You should at this point remove the window from the 760 * window manager. This is called without the window manager locked so 761 * that you can call back into it. 762 * 763 * <p>Note: due to the nature of these functions not being called with the 764 * window manager locked, you must be prepared for this function to be 765 * called multiple times and/or an initial time with a null View window 766 * even if you previously returned one. 767 * 768 * @param appToken Token of the application that has started. 769 * @param window Window View that was returned by createStartingWindow. 770 * 771 * @see #addStartingWindow 772 */ 773 public void removeStartingWindow(IBinder appToken, View window); 774 775 /** 776 * Prepare for a window being added to the window manager. You can throw an 777 * exception here to prevent the window being added, or do whatever setup 778 * you need to keep track of the window. 779 * 780 * @param win The window being added. 781 * @param attrs The window's LayoutParams. 782 * 783 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an 784 * error code to abort the add. 785 */ 786 public int prepareAddWindowLw(WindowState win, 787 WindowManager.LayoutParams attrs); 788 789 /** 790 * Called when a window is being removed from a window manager. Must not 791 * throw an exception -- clean up as much as possible. 792 * 793 * @param win The window being removed. 794 */ 795 public void removeWindowLw(WindowState win); 796 797 /** 798 * Control the animation to run when a window's state changes. Return a 799 * non-0 number to force the animation to a specific resource ID, or 0 800 * to use the default animation. 801 * 802 * @param win The window that is changing. 803 * @param transit What is happening to the window: {@link #TRANSIT_ENTER}, 804 * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or 805 * {@link #TRANSIT_HIDE}. 806 * 807 * @return Resource ID of the actual animation to use, or 0 for none. 808 */ 809 public int selectAnimationLw(WindowState win, int transit); 810 811 /** 812 * Determine the animation to run for a rotation transition based on the 813 * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation} 814 * and whether it is currently fullscreen and frontmost. 815 * 816 * @param anim The exiting animation resource id is stored in anim[0], the 817 * entering animation resource id is stored in anim[1]. 818 */ 819 public void selectRotationAnimationLw(int anim[]); 820 821 /** 822 * Validate whether the current top fullscreen has specified the same 823 * {@link WindowManager.LayoutParams#rotationAnimation} value as that 824 * being passed in from the previous top fullscreen window. 825 * 826 * @param exitAnimId exiting resource id from the previous window. 827 * @param enterAnimId entering resource id from the previous window. 828 * @param forceDefault For rotation animations only, if true ignore the 829 * animation values and just return false. 830 * @return true if the previous values are still valid, false if they 831 * should be replaced with the default. 832 */ 833 public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId, 834 boolean forceDefault); 835 836 /** 837 * Create and return an animation to re-display a force hidden window. 838 */ 839 public Animation createForceHideEnterAnimation(boolean onWallpaper, 840 boolean goingToNotificationShade); 841 842 /** 843 * Create and return an animation to let the wallpaper disappear after being shown on a force 844 * hiding window. 845 */ 846 public Animation createForceHideWallpaperExitAnimation(boolean goingToNotificationShade); 847 848 /** 849 * Called from the input reader thread before a key is enqueued. 850 * 851 * <p>There are some actions that need to be handled here because they 852 * affect the power state of the device, for example, the power keys. 853 * Generally, it's best to keep as little as possible in the queue thread 854 * because it's the most fragile. 855 * @param event The key event. 856 * @param policyFlags The policy flags associated with the key. 857 * 858 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. 859 */ 860 public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); 861 862 /** 863 * Called from the input reader thread before a motion is enqueued when the device is in a 864 * non-interactive state. 865 * 866 * <p>There are some actions that need to be handled here because they 867 * affect the power state of the device, for example, waking on motions. 868 * Generally, it's best to keep as little as possible in the queue thread 869 * because it's the most fragile. 870 * @param policyFlags The policy flags associated with the motion. 871 * 872 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. 873 */ 874 public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); 875 876 /** 877 * Called from the input dispatcher thread before a key is dispatched to a window. 878 * 879 * <p>Allows you to define 880 * behavior for keys that can not be overridden by applications. 881 * This method is called from the input thread, with no locks held. 882 * 883 * @param win The window that currently has focus. This is where the key 884 * event will normally go. 885 * @param event The key event. 886 * @param policyFlags The policy flags associated with the key. 887 * @return 0 if the key should be dispatched immediately, -1 if the key should 888 * not be dispatched ever, or a positive value indicating the number of 889 * milliseconds by which the key dispatch should be delayed before trying 890 * again. 891 */ 892 public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags); 893 894 /** 895 * Called from the input dispatcher thread when an application did not handle 896 * a key that was dispatched to it. 897 * 898 * <p>Allows you to define default global behavior for keys that were not handled 899 * by applications. This method is called from the input thread, with no locks held. 900 * 901 * @param win The window that currently has focus. This is where the key 902 * event will normally go. 903 * @param event The key event. 904 * @param policyFlags The policy flags associated with the key. 905 * @return Returns an alternate key event to redispatch as a fallback, or null to give up. 906 * The caller is responsible for recycling the key event. 907 */ 908 public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags); 909 910 /** 911 * Called when layout of the windows is about to start. 912 * 913 * @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}. 914 * @param displayWidth The current full width of the screen. 915 * @param displayHeight The current full height of the screen. 916 * @param displayRotation The current rotation being applied to the base window. 917 * @param uiMode The current uiMode in configuration. 918 */ 919 public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight, 920 int displayRotation, int uiMode); 921 922 /** 923 * Returns the bottom-most layer of the system decor, above which no policy decor should 924 * be applied. 925 */ 926 public int getSystemDecorLayerLw(); 927 928 /** 929 * Return the rectangle of the screen that is available for applications to run in. 930 * This will be called immediately after {@link #beginLayoutLw}. 931 * 932 * @param r The rectangle to be filled with the boundaries available to applications. 933 */ 934 public void getContentRectLw(Rect r); 935 936 /** 937 * Called for each window attached to the window manager as layout is 938 * proceeding. The implementation of this function must take care of 939 * setting the window's frame, either here or in finishLayout(). 940 * 941 * @param win The window being positioned. 942 * @param attached For sub-windows, the window it is attached to; this 943 * window will already have had layoutWindow() called on it 944 * so you can use its Rect. Otherwise null. 945 */ 946 public void layoutWindowLw(WindowState win, WindowState attached); 947 948 949 /** 950 * Return the insets for the areas covered by system windows. These values 951 * are computed on the most recent layout, so they are not guaranteed to 952 * be correct. 953 * 954 * @param attrs The LayoutParams of the window. 955 * @param taskBounds The bounds of the task this window is on or {@code null} if no task is 956 * associated with the window. 957 * @param displayRotation Rotation of the display. 958 * @param displayWidth The width of the display. 959 * @param displayHeight The height of the display. 960 * @param outContentInsets The areas covered by system windows, expressed as positive insets. 961 * @param outStableInsets The areas covered by stable system windows irrespective of their 962 * current visibility. Expressed as positive insets. 963 * @param outOutsets The areas that are not real display, but we would like to treat as such. 964 * @return Whether to always consume the navigation bar. 965 * See {@link #isNavBarForcedShownLw(WindowState)}. 966 */ 967 public boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds, 968 int displayRotation, int displayWidth, int displayHeight, Rect outContentInsets, 969 Rect outStableInsets, Rect outOutsets); 970 971 /** 972 * Called when layout of the windows is finished. After this function has 973 * returned, all windows given to layoutWindow() <em>must</em> have had a 974 * frame assigned. 975 */ 976 public void finishLayoutLw(); 977 978 /** Layout state may have changed (so another layout will be performed) */ 979 static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001; 980 /** Configuration state may have changed */ 981 static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002; 982 /** Wallpaper may need to move */ 983 static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004; 984 /** Need to recompute animations */ 985 static final int FINISH_LAYOUT_REDO_ANIM = 0x0008; 986 987 /** 988 * Called following layout of all windows before each window has policy applied. 989 * 990 * @param displayWidth The current full width of the screen. 991 * @param displayHeight The current full height of the screen. 992 */ 993 public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight); 994 995 /** 996 * Called following layout of all window to apply policy to each window. 997 * 998 * @param win The window being positioned. 999 * @param attrs The LayoutParams of the window. 1000 * @param attached For sub-windows, the window it is attached to. Otherwise null. 1001 */ 1002 public void applyPostLayoutPolicyLw(WindowState win, 1003 WindowManager.LayoutParams attrs, WindowState attached); 1004 1005 /** 1006 * Called following layout of all windows and after policy has been applied 1007 * to each window. If in this function you do 1008 * something that may have modified the animation state of another window, 1009 * be sure to return non-zero in order to perform another pass through layout. 1010 * 1011 * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}, 1012 * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER}, 1013 * or {@link #FINISH_LAYOUT_REDO_ANIM}. 1014 */ 1015 public int finishPostLayoutPolicyLw(); 1016 1017 /** 1018 * Return true if it is okay to perform animations for an app transition 1019 * that is about to occur. You may return false for this if, for example, 1020 * the lock screen is currently displayed so the switch should happen 1021 * immediately. 1022 */ 1023 public boolean allowAppAnimationsLw(); 1024 1025 1026 /** 1027 * A new window has been focused. 1028 */ 1029 public int focusChangedLw(WindowState lastFocus, WindowState newFocus); 1030 1031 /** 1032 * Called when the device has started waking up. 1033 */ 1034 public void startedWakingUp(); 1035 1036 /** 1037 * Called when the device has finished waking up. 1038 */ 1039 public void finishedWakingUp(); 1040 1041 /** 1042 * Called when the device has started going to sleep. 1043 * 1044 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, 1045 * or {@link #OFF_BECAUSE_OF_TIMEOUT}. 1046 */ 1047 public void startedGoingToSleep(int why); 1048 1049 /** 1050 * Called when the device has finished going to sleep. 1051 * 1052 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, 1053 * or {@link #OFF_BECAUSE_OF_TIMEOUT}. 1054 */ 1055 public void finishedGoingToSleep(int why); 1056 1057 /** 1058 * Called when the device is about to turn on the screen to show content. 1059 * When waking up, this method will be called once after the call to wakingUp(). 1060 * When dozing, the method will be called sometime after the call to goingToSleep() and 1061 * may be called repeatedly in the case where the screen is pulsing on and off. 1062 * 1063 * Must call back on the listener to tell it when the higher-level system 1064 * is ready for the screen to go on (i.e. the lock screen is shown). 1065 */ 1066 public void screenTurningOn(ScreenOnListener screenOnListener); 1067 1068 /** 1069 * Called when the device has actually turned on the screen, i.e. the display power state has 1070 * been set to ON and the screen is unblocked. 1071 */ 1072 public void screenTurnedOn(); 1073 1074 /** 1075 * Called when the device has turned the screen off. 1076 */ 1077 public void screenTurnedOff(); 1078 1079 public interface ScreenOnListener { 1080 void onScreenOn(); 1081 } 1082 1083 /** 1084 * Return whether the default display is on and not blocked by a black surface. 1085 */ 1086 public boolean isScreenOn(); 1087 1088 /** 1089 * Tell the policy that the lid switch has changed state. 1090 * @param whenNanos The time when the change occurred in uptime nanoseconds. 1091 * @param lidOpen True if the lid is now open. 1092 */ 1093 public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen); 1094 1095 /** 1096 * Tell the policy that the camera lens has been covered or uncovered. 1097 * @param whenNanos The time when the change occurred in uptime nanoseconds. 1098 * @param lensCovered True if the lens is covered. 1099 */ 1100 public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered); 1101 1102 /** 1103 * Tell the policy if anyone is requesting that keyguard not come on. 1104 * 1105 * @param enabled Whether keyguard can be on or not. does not actually 1106 * turn it on, unless it was previously disabled with this function. 1107 * 1108 * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard() 1109 * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard() 1110 */ 1111 @SuppressWarnings("javadoc") 1112 public void enableKeyguard(boolean enabled); 1113 1114 /** 1115 * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely} 1116 */ 1117 interface OnKeyguardExitResult { 1118 void onKeyguardExitResult(boolean success); 1119 } 1120 1121 /** 1122 * Tell the policy if anyone is requesting the keyguard to exit securely 1123 * (this would be called after the keyguard was disabled) 1124 * @param callback Callback to send the result back. 1125 * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult) 1126 */ 1127 @SuppressWarnings("javadoc") 1128 void exitKeyguardSecurely(OnKeyguardExitResult callback); 1129 1130 /** 1131 * isKeyguardLocked 1132 * 1133 * Return whether the keyguard is currently locked. 1134 * 1135 * @return true if in keyguard is locked. 1136 */ 1137 public boolean isKeyguardLocked(); 1138 1139 /** 1140 * isKeyguardSecure 1141 * 1142 * Return whether the keyguard requires a password to unlock. 1143 * @param userId 1144 * 1145 * @return true if in keyguard is secure. 1146 */ 1147 public boolean isKeyguardSecure(int userId); 1148 1149 /** 1150 * Return whether the keyguard is on. 1151 * 1152 * @return true if in keyguard is on. 1153 */ 1154 public boolean isKeyguardShowingOrOccluded(); 1155 1156 /** 1157 * inKeyguardRestrictedKeyInputMode 1158 * 1159 * if keyguard screen is showing or in restricted key input mode (i.e. in 1160 * keyguard password emergency screen). When in such mode, certain keys, 1161 * such as the Home key and the right soft keys, don't work. 1162 * 1163 * @return true if in keyguard restricted input mode. 1164 */ 1165 public boolean inKeyguardRestrictedKeyInputMode(); 1166 1167 /** 1168 * Ask the policy to dismiss the keyguard, if it is currently shown. 1169 */ 1170 public void dismissKeyguardLw(); 1171 1172 /** 1173 * Notifies the keyguard that the activity has drawn it was waiting for. 1174 */ 1175 public void notifyActivityDrawnForKeyguardLw(); 1176 1177 /** 1178 * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method 1179 * returns true as soon as we know that Keyguard is disabled. 1180 * 1181 * @return true if the keyguard has drawn. 1182 */ 1183 public boolean isKeyguardDrawnLw(); 1184 1185 /** 1186 * Given an orientation constant, returns the appropriate surface rotation, 1187 * taking into account sensors, docking mode, rotation lock, and other factors. 1188 * 1189 * @param orientation An orientation constant, such as 1190 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}. 1191 * @param lastRotation The most recently used rotation. 1192 * @return The surface rotation to use. 1193 */ 1194 public int rotationForOrientationLw(@ActivityInfo.ScreenOrientation int orientation, 1195 int lastRotation); 1196 1197 /** 1198 * Given an orientation constant and a rotation, returns true if the rotation 1199 * has compatible metrics to the requested orientation. For example, if 1200 * the application requested landscape and got seascape, then the rotation 1201 * has compatible metrics; if the application requested portrait and got landscape, 1202 * then the rotation has incompatible metrics; if the application did not specify 1203 * a preference, then anything goes. 1204 * 1205 * @param orientation An orientation constant, such as 1206 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}. 1207 * @param rotation The rotation to check. 1208 * @return True if the rotation is compatible with the requested orientation. 1209 */ 1210 public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation int orientation, 1211 int rotation); 1212 1213 /** 1214 * Called by the window manager when the rotation changes. 1215 * 1216 * @param rotation The new rotation. 1217 */ 1218 public void setRotationLw(int rotation); 1219 1220 /** 1221 * Called when the system is mostly done booting to set whether 1222 * the system should go into safe mode. 1223 */ 1224 public void setSafeMode(boolean safeMode); 1225 1226 /** 1227 * Called when the system is mostly done booting. 1228 */ 1229 public void systemReady(); 1230 1231 /** 1232 * Called when the system is done booting to the point where the 1233 * user can start interacting with it. 1234 */ 1235 public void systemBooted(); 1236 1237 /** 1238 * Show boot time message to the user. 1239 */ 1240 public void showBootMessage(final CharSequence msg, final boolean always); 1241 1242 /** 1243 * Hide the UI for showing boot messages, never to be displayed again. 1244 */ 1245 public void hideBootMessages(); 1246 1247 /** 1248 * Called when userActivity is signalled in the power manager. 1249 * This is safe to call from any thread, with any window manager locks held or not. 1250 */ 1251 public void userActivity(); 1252 1253 /** 1254 * Called when we have finished booting and can now display the home 1255 * screen to the user. This will happen after systemReady(), and at 1256 * this point the display is active. 1257 */ 1258 public void enableScreenAfterBoot(); 1259 1260 public void setCurrentOrientationLw(@ActivityInfo.ScreenOrientation int newOrientation); 1261 1262 /** 1263 * Call from application to perform haptic feedback on its window. 1264 */ 1265 public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always); 1266 1267 /** 1268 * Called when we have started keeping the screen on because a window 1269 * requesting this has become visible. 1270 */ 1271 public void keepScreenOnStartedLw(); 1272 1273 /** 1274 * Called when we have stopped keeping the screen on because the last window 1275 * requesting this is no longer visible. 1276 */ 1277 public void keepScreenOnStoppedLw(); 1278 1279 /** 1280 * Gets the current user rotation mode. 1281 * 1282 * @return The rotation mode. 1283 * 1284 * @see WindowManagerPolicy#USER_ROTATION_LOCKED 1285 * @see WindowManagerPolicy#USER_ROTATION_FREE 1286 */ 1287 @UserRotationMode 1288 public int getUserRotationMode(); 1289 1290 /** 1291 * Inform the policy that the user has chosen a preferred orientation ("rotation lock"). 1292 * 1293 * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or 1294 * {@link WindowManagerPolicy#USER_ROTATION_FREE}. 1295 * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90}, 1296 * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}. 1297 */ 1298 public void setUserRotationMode(@UserRotationMode int mode, @Surface.Rotation int rotation); 1299 1300 /** 1301 * Called when a new system UI visibility is being reported, allowing 1302 * the policy to adjust what is actually reported. 1303 * @param visibility The raw visibility reported by the status bar. 1304 * @return The new desired visibility. 1305 */ 1306 public int adjustSystemUiVisibilityLw(int visibility); 1307 1308 /** 1309 * Called by System UI to notify of changes to the visibility of Recents. 1310 */ 1311 public void setRecentsVisibilityLw(boolean visible); 1312 1313 /** 1314 * Called by System UI to notify of changes to the visibility of PIP. 1315 */ 1316 public void setTvPipVisibilityLw(boolean visible); 1317 1318 /** 1319 * Specifies whether there is an on-screen navigation bar separate from the status bar. 1320 */ 1321 public boolean hasNavigationBar(); 1322 1323 /** 1324 * Lock the device now. 1325 */ 1326 public void lockNow(Bundle options); 1327 1328 /** 1329 * Set the last used input method window state. This state is used to make IME transition 1330 * smooth. 1331 * @hide 1332 */ 1333 public void setLastInputMethodWindowLw(WindowState ime, WindowState target); 1334 1335 /** 1336 * Show the recents task list app. 1337 * @hide 1338 */ 1339 public void showRecentApps(boolean fromHome); 1340 1341 /** 1342 * Show the global actions dialog. 1343 * @hide 1344 */ 1345 public void showGlobalActions(); 1346 1347 /** 1348 * @return The current height of the input method window. 1349 */ 1350 public int getInputMethodWindowVisibleHeightLw(); 1351 1352 /** 1353 * Called when the current user changes. Guaranteed to be called before the broadcast 1354 * of the new user id is made to all listeners. 1355 * 1356 * @param newUserId The id of the incoming user. 1357 */ 1358 public void setCurrentUserLw(int newUserId); 1359 1360 /** 1361 * Print the WindowManagerPolicy's state into the given stream. 1362 * 1363 * @param prefix Text to print at the front of each line. 1364 * @param writer The PrintWriter to which you should dump your state. This will be 1365 * closed for you after you return. 1366 * @param args additional arguments to the dump request. 1367 */ 1368 public void dump(String prefix, PrintWriter writer, String[] args); 1369 1370 /** 1371 * Returns whether a given window type can be magnified. 1372 * 1373 * @param windowType The window type. 1374 * @return True if the window can be magnified. 1375 */ 1376 public boolean canMagnifyWindow(int windowType); 1377 1378 /** 1379 * Returns whether a given window type is considered a top level one. 1380 * A top level window does not have a container, i.e. attached window, 1381 * or if it has a container it is laid out as a top-level window, not 1382 * as a child of its container. 1383 * 1384 * @param windowType The window type. 1385 * @return True if the window is a top level one. 1386 */ 1387 public boolean isTopLevelWindow(int windowType); 1388 1389 /** 1390 * Notifies the keyguard to start fading out. 1391 * 1392 * @param startTime the start time of the animation in uptime milliseconds 1393 * @param fadeoutDuration the duration of the exit animation, in milliseconds 1394 */ 1395 public void startKeyguardExitAnimation(long startTime, long fadeoutDuration); 1396 1397 /** 1398 * Calculates the stable insets without running a layout. 1399 * 1400 * @param displayRotation the current display rotation 1401 * @param displayWidth the current display width 1402 * @param displayHeight the current display height 1403 * @param outInsets the insets to return 1404 */ 1405 public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight, 1406 Rect outInsets); 1407 1408 1409 /** 1410 * @return true if the navigation bar is forced to stay visible 1411 */ 1412 public boolean isNavBarForcedShownLw(WindowState win); 1413 1414 /** 1415 * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system 1416 * bar or button bar. See {@link #getNonDecorDisplayWidth}. 1417 * 1418 * @param displayRotation the current display rotation 1419 * @param displayWidth the current display width 1420 * @param displayHeight the current display height 1421 * @param outInsets the insets to return 1422 */ 1423 public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, 1424 Rect outInsets); 1425 1426 /** 1427 * @return True if a specified {@param dockSide} is allowed on the current device, or false 1428 * otherwise. It is guaranteed that at least one dock side for a particular orientation 1429 * is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed. 1430 */ 1431 public boolean isDockSideAllowed(int dockSide); 1432 1433 /** 1434 * Called when the configuration has changed, and it's safe to load new values from resources. 1435 */ 1436 public void onConfigurationChanged(); 1437 1438 public boolean shouldRotateSeamlessly(int oldRotation, int newRotation); 1439 } 1440