1 /* 2 * Copyright (C) 2017 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 com.android.server.wm; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.content.ClipData; 22 import android.content.Context; 23 import android.graphics.Rect; 24 import android.graphics.Region; 25 import android.hardware.display.DisplayManagerInternal; 26 import android.os.Bundle; 27 import android.os.IBinder; 28 import android.view.Display; 29 import android.view.IInputFilter; 30 import android.view.IRemoteAnimationFinishedCallback; 31 import android.view.IWindow; 32 import android.view.InputChannel; 33 import android.view.MagnificationSpec; 34 import android.view.RemoteAnimationTarget; 35 import android.view.WindowInfo; 36 import android.view.WindowManager.DisplayImePolicy; 37 38 import com.android.internal.policy.KeyInterceptionInfo; 39 import com.android.server.input.InputManagerService; 40 import com.android.server.policy.WindowManagerPolicy; 41 42 import java.util.List; 43 44 /** 45 * Window manager local system service interface. 46 * 47 * @hide Only for use within the system server. 48 */ 49 public abstract class WindowManagerInternal { 50 51 /** 52 * Interface for accessibility features implemented by AccessibilityController inside 53 * WindowManager. 54 */ 55 public interface AccessibilityControllerInternal { 56 /** 57 * Enable the accessibility trace logging. 58 */ startTrace()59 void startTrace(); 60 61 /** 62 * Disable the accessibility trace logging. 63 */ stopTrace()64 void stopTrace(); 65 66 /** 67 * Is trace enabled or not. 68 */ isAccessibilityTracingEnabled()69 boolean isAccessibilityTracingEnabled(); 70 71 /** 72 * Add an accessibility trace entry. 73 * 74 * @param where A string to identify this log entry, which can be used to filter/search 75 * through the tracing file. 76 * @param callingParams The parameters for the method to be logged. 77 * @param a11yDump The proto byte array for a11y state when the entry is generated. 78 * @param callingUid The calling uid. 79 * @param stackTrace The stack trace, null if not needed. 80 */ logTrace( String where, String callingParams, byte[] a11yDump, int callingUid, StackTraceElement[] stackTrace)81 void logTrace( 82 String where, String callingParams, byte[] a11yDump, int callingUid, 83 StackTraceElement[] stackTrace); 84 85 /** 86 * Add an accessibility trace entry. 87 * 88 * @param where A string to identify this log entry, which can be used to filter/search 89 * through the tracing file. 90 * @param callingParams The parameters for the method to be logged. 91 * @param a11yDump The proto byte array for a11y state when the entry is generated. 92 * @param callingUid The calling uid. 93 * @param callStack The call stack of the method to be logged. 94 * @param timeStamp The time when the method to be logged is called. 95 * @param processId The calling process Id. 96 * @param threadId The calling thread Id. 97 */ logTrace(String where, String callingParams, byte[] a11yDump, int callingUid, StackTraceElement[] callStack, long timeStamp, int processId, long threadId)98 void logTrace(String where, String callingParams, byte[] a11yDump, int callingUid, 99 StackTraceElement[] callStack, long timeStamp, int processId, long threadId); 100 } 101 102 /** 103 * Interface to receive a callback when the windows reported for 104 * accessibility changed. 105 */ 106 public interface WindowsForAccessibilityCallback { 107 108 /** 109 * Called when the windows for accessibility changed. 110 * 111 * @param forceSend Send the windows for accessibility even if they haven't changed. 112 * @param topFocusedDisplayId The display Id which has the top focused window. 113 * @param topFocusedWindowToken The window token of top focused window. 114 * @param windows The windows for accessibility. 115 */ onWindowsForAccessibilityChanged(boolean forceSend, int topFocusedDisplayId, IBinder topFocusedWindowToken, @NonNull List<WindowInfo> windows)116 void onWindowsForAccessibilityChanged(boolean forceSend, int topFocusedDisplayId, 117 IBinder topFocusedWindowToken, @NonNull List<WindowInfo> windows); 118 } 119 120 /** 121 * Callbacks for contextual changes that affect the screen magnification 122 * feature. 123 */ 124 public interface MagnificationCallbacks { 125 126 /** 127 * Called when the region where magnification operates changes. Note that this isn't the 128 * entire screen. For example, IMEs are not magnified. 129 * 130 * @param magnificationRegion the current magnification region 131 */ onMagnificationRegionChanged(Region magnificationRegion)132 void onMagnificationRegionChanged(Region magnificationRegion); 133 134 /** 135 * Called when an application requests a rectangle on the screen to allow 136 * the client to apply the appropriate pan and scale. 137 * 138 * @param left The rectangle left. 139 * @param top The rectangle top. 140 * @param right The rectangle right. 141 * @param bottom The rectangle bottom. 142 */ onRectangleOnScreenRequested(int left, int top, int right, int bottom)143 void onRectangleOnScreenRequested(int left, int top, int right, int bottom); 144 145 /** 146 * Notifies that the rotation changed. 147 * 148 * @param rotation The current rotation. 149 */ onRotationChanged(int rotation)150 void onRotationChanged(int rotation); 151 152 /** 153 * Notifies that the context of the user changed. For example, an application 154 * was started. 155 */ onUserContextChanged()156 void onUserContextChanged(); 157 158 /** 159 * Notifies that the IME window visibility changed. 160 * @param shown {@code true} means the IME window shows on the screen. Otherwise it's 161 * hidden. 162 */ onImeWindowVisibilityChanged(boolean shown)163 void onImeWindowVisibilityChanged(boolean shown); 164 } 165 166 /** 167 * Abstract class to be notified about {@link com.android.server.wm.AppTransition} events. Held 168 * as an abstract class so a listener only needs to implement the methods of its interest. 169 */ 170 public static abstract class AppTransitionListener { 171 172 /** 173 * Called when an app transition is being setup and about to be executed. 174 */ onAppTransitionPendingLocked()175 public void onAppTransitionPendingLocked() {} 176 177 /** 178 * Called when a pending app transition gets cancelled. 179 * 180 * @param keyguardGoingAway true if keyguard going away transition transition got cancelled. 181 */ onAppTransitionCancelledLocked(boolean keyguardGoingAway)182 public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {} 183 184 /** 185 * Called when an app transition is timed out. 186 */ onAppTransitionTimeoutLocked()187 public void onAppTransitionTimeoutLocked() {} 188 189 /** 190 * Called when an app transition gets started 191 * 192 * @param keyguardGoingAway true if keyguard going away transition is started. 193 * @param duration the total duration of the transition 194 * @param statusBarAnimationStartTime the desired start time for all visual animations in 195 * the status bar caused by this app transition in uptime millis 196 * @param statusBarAnimationDuration the duration for all visual animations in the status 197 * bar caused by this app transition in millis 198 * 199 * @return Return any bit set of {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_LAYOUT}, 200 * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_CONFIG}, 201 * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_WALLPAPER}, 202 * or {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_ANIM}. 203 */ onAppTransitionStartingLocked(boolean keyguardGoingAway, long duration, long statusBarAnimationStartTime, long statusBarAnimationDuration)204 public int onAppTransitionStartingLocked(boolean keyguardGoingAway, long duration, 205 long statusBarAnimationStartTime, long statusBarAnimationDuration) { 206 return 0; 207 } 208 209 /** 210 * Called when an app transition is finished running. 211 * 212 * @param token the token for app whose transition has finished 213 */ onAppTransitionFinishedLocked(IBinder token)214 public void onAppTransitionFinishedLocked(IBinder token) {} 215 } 216 217 /** 218 * An interface to be notified when keyguard exit animation should start. 219 */ 220 public interface KeyguardExitAnimationStartListener { 221 /** 222 * Called when keyguard exit animation should start. 223 * @param apps The list of apps to animate. 224 * @param wallpapers The list of wallpapers to animate. 225 * @param finishedCallback The callback to invoke when the animation is finished. 226 */ onAnimationStart(RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers, IRemoteAnimationFinishedCallback finishedCallback)227 void onAnimationStart(RemoteAnimationTarget[] apps, 228 RemoteAnimationTarget[] wallpapers, 229 IRemoteAnimationFinishedCallback finishedCallback); 230 } 231 232 /** 233 * An interface to be notified about hardware keyboard status. 234 */ 235 public interface OnHardKeyboardStatusChangeListener { onHardKeyboardStatusChange(boolean available)236 public void onHardKeyboardStatusChange(boolean available); 237 } 238 239 /** 240 * An interface to customize drag and drop behaviors. 241 */ 242 public interface IDragDropCallback { registerInputChannel( DragState state, Display display, InputManagerService service, InputChannel source)243 default boolean registerInputChannel( 244 DragState state, Display display, InputManagerService service, 245 InputChannel source) { 246 state.register(display); 247 return service.transferTouchFocus(source, state.getInputChannel(), 248 true /* isDragDrop */); 249 } 250 251 /** 252 * Called when drag operation is starting. 253 */ prePerformDrag(IWindow window, IBinder dragToken, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data)254 default boolean prePerformDrag(IWindow window, IBinder dragToken, 255 int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, 256 ClipData data) { 257 return true; 258 } 259 260 /** 261 * Called when drag operation is started. 262 */ postPerformDrag()263 default void postPerformDrag() {} 264 265 /** 266 * Called when drop result is being reported. 267 */ preReportDropResult(IWindow window, boolean consumed)268 default void preReportDropResult(IWindow window, boolean consumed) {} 269 270 /** 271 * Called when drop result was reported. 272 */ postReportDropResult()273 default void postReportDropResult() {} 274 275 /** 276 * Called when drag operation is being cancelled. 277 */ preCancelDragAndDrop(IBinder dragToken)278 default void preCancelDragAndDrop(IBinder dragToken) {} 279 280 /** 281 * Called when drag operation was cancelled. 282 */ postCancelDragAndDrop()283 default void postCancelDragAndDrop() {} 284 } 285 286 /** 287 * Request the interface to access features implemented by AccessibilityController. 288 */ getAccessibilityController()289 public abstract AccessibilityControllerInternal getAccessibilityController(); 290 291 /** 292 * Request that the window manager call 293 * {@link DisplayManagerInternal#performTraversalInTransactionFromWindowManager} 294 * within a surface transaction at a later time. 295 */ requestTraversalFromDisplayManager()296 public abstract void requestTraversalFromDisplayManager(); 297 298 /** 299 * Set by the accessibility layer to observe changes in the magnified region, 300 * rotation, and other window transformations related to display magnification 301 * as the window manager is responsible for doing the actual magnification 302 * and has access to the raw window data while the accessibility layer serves 303 * as a controller. 304 * 305 * @param displayId The logical display id. 306 * @param callbacks The callbacks to invoke. 307 * @return {@code false} if display id is not valid or an embedded display. 308 */ setMagnificationCallbacks(int displayId, @Nullable MagnificationCallbacks callbacks)309 public abstract boolean setMagnificationCallbacks(int displayId, 310 @Nullable MagnificationCallbacks callbacks); 311 312 /** 313 * Set by the accessibility layer to specify the magnification and panning to 314 * be applied to all windows that should be magnified. 315 * 316 * @param displayId The logical display id. 317 * @param spec The MagnficationSpec to set. 318 * 319 * @see #setMagnificationCallbacks(int, MagnificationCallbacks) 320 */ setMagnificationSpec(int displayId, MagnificationSpec spec)321 public abstract void setMagnificationSpec(int displayId, MagnificationSpec spec); 322 323 /** 324 * Set by the accessibility framework to indicate whether the magnifiable regions of the display 325 * should be shown. 326 * 327 * @param displayId The logical display id. 328 * @param show {@code true} to show magnifiable region bounds, {@code false} to hide 329 */ setForceShowMagnifiableBounds(int displayId, boolean show)330 public abstract void setForceShowMagnifiableBounds(int displayId, boolean show); 331 332 /** 333 * Obtains the magnification regions. 334 * 335 * @param displayId The logical display id. 336 * @param magnificationRegion the current magnification region 337 */ getMagnificationRegion(int displayId, @NonNull Region magnificationRegion)338 public abstract void getMagnificationRegion(int displayId, @NonNull Region magnificationRegion); 339 340 /** 341 * Gets the magnification and translation applied to a window given its token. 342 * Not all windows are magnified and the window manager policy determines which 343 * windows are magnified. The returned result also takes into account the compat 344 * scale if necessary. 345 * 346 * @param windowToken The window's token. 347 * 348 * @return The magnification spec for the window. 349 * 350 * @see #setMagnificationCallbacks(int, MagnificationCallbacks) 351 */ getCompatibleMagnificationSpecForWindow( IBinder windowToken)352 public abstract MagnificationSpec getCompatibleMagnificationSpecForWindow( 353 IBinder windowToken); 354 355 /** 356 * Sets a callback for observing which windows are touchable for the purposes 357 * of accessibility on specified display. 358 * 359 * @param displayId The logical display id. 360 * @param callback The callback. 361 * @return {@code false} if display id is not valid. 362 */ setWindowsForAccessibilityCallback(int displayId, WindowsForAccessibilityCallback callback)363 public abstract boolean setWindowsForAccessibilityCallback(int displayId, 364 WindowsForAccessibilityCallback callback); 365 366 /** 367 * Sets a filter for manipulating the input event stream. 368 * 369 * @param filter The filter implementation. 370 */ setInputFilter(IInputFilter filter)371 public abstract void setInputFilter(IInputFilter filter); 372 373 /** 374 * Gets the token of the window that has input focus. 375 * 376 * @return The token. 377 */ getFocusedWindowToken()378 public abstract IBinder getFocusedWindowToken(); 379 380 /** 381 * @return Whether the keyguard is engaged. 382 */ isKeyguardLocked()383 public abstract boolean isKeyguardLocked(); 384 385 /** 386 * @return Whether the keyguard is showing and not occluded. 387 */ isKeyguardShowingAndNotOccluded()388 public abstract boolean isKeyguardShowingAndNotOccluded(); 389 390 /** 391 * Gets the frame of a window given its token. 392 * 393 * @param token The token. 394 * @param outBounds The frame to populate. 395 */ getWindowFrame(IBinder token, Rect outBounds)396 public abstract void getWindowFrame(IBinder token, Rect outBounds); 397 398 /** 399 * Opens the global actions dialog. 400 */ showGlobalActions()401 public abstract void showGlobalActions(); 402 403 /** 404 * Invalidate all visible windows on a given display, and report back on the callback when all 405 * windows have redrawn. 406 * 407 * @param callback reporting callback to be called when all windows have redrawn. 408 * @param timeout calls the callback anyway after the timeout. 409 * @param displayId waits for the windows on the given display, INVALID_DISPLAY to wait for all 410 * windows on all displays. 411 */ waitForAllWindowsDrawn(Runnable callback, long timeout, int displayId)412 public abstract void waitForAllWindowsDrawn(Runnable callback, long timeout, int displayId); 413 414 /** 415 * Overrides the display size. 416 * 417 * @param displayId The display to override the display size. 418 * @param width The width to override. 419 * @param height The height to override. 420 */ setForcedDisplaySize(int displayId, int width, int height)421 public abstract void setForcedDisplaySize(int displayId, int width, int height); 422 423 /** 424 * Recover the display size to real display size. 425 * 426 * @param displayId The display to recover the display size. 427 */ clearForcedDisplaySize(int displayId)428 public abstract void clearForcedDisplaySize(int displayId); 429 430 /** 431 * Adds a window token for a given window type. 432 * 433 * @param token The token to add. 434 * @param type The window type. 435 * @param displayId The display to add the token to. 436 * @param options A bundle used to pass window-related options. 437 */ addWindowToken(@onNull android.os.IBinder token, int type, int displayId, @Nullable Bundle options)438 public abstract void addWindowToken(@NonNull android.os.IBinder token, int type, int displayId, 439 @Nullable Bundle options); 440 441 /** 442 * Removes a window token. 443 * 444 * @param token The toke to remove. 445 * @param removeWindows Whether to also remove the windows associated with the token. 446 * @param displayId The display to remove the token from. 447 */ removeWindowToken(android.os.IBinder token, boolean removeWindows, int displayId)448 public abstract void removeWindowToken(android.os.IBinder token, boolean removeWindows, 449 int displayId); 450 451 /** 452 * Registers a listener to be notified about app transition events. 453 * 454 * @param listener The listener to register. 455 */ registerAppTransitionListener(AppTransitionListener listener)456 public abstract void registerAppTransitionListener(AppTransitionListener listener); 457 458 /** 459 * Registers a listener to be notified to start the keyguard exit animation. 460 * 461 * @param listener The listener to register. 462 */ registerKeyguardExitAnimationStartListener( KeyguardExitAnimationStartListener listener)463 public abstract void registerKeyguardExitAnimationStartListener( 464 KeyguardExitAnimationStartListener listener); 465 466 /** 467 * Reports that the password for the given user has changed. 468 */ reportPasswordChanged(int userId)469 public abstract void reportPasswordChanged(int userId); 470 471 /** 472 * Retrieves a height of input method window for given display. 473 */ getInputMethodWindowVisibleHeight(int displayId)474 public abstract int getInputMethodWindowVisibleHeight(int displayId); 475 476 /** 477 * Notifies WindowManagerService that the expected back-button behavior might have changed. 478 * 479 * <p>Only {@link com.android.server.inputmethod.InputMethodManagerService} is the expected and 480 * tested caller of this method.</p> 481 * 482 * @param dismissImeOnBackKeyPressed {@code true} if the software keyboard is shown and the back 483 * key is expected to dismiss the software keyboard. 484 */ setDismissImeOnBackKeyPressed(boolean dismissImeOnBackKeyPressed)485 public abstract void setDismissImeOnBackKeyPressed(boolean dismissImeOnBackKeyPressed); 486 487 /** 488 * Notifies WindowManagerService that the current IME window status is being changed. 489 * 490 * <p>Only {@link com.android.server.inputmethod.InputMethodManagerService} is the expected and 491 * tested caller of this method.</p> 492 * 493 * @param imeToken token to track the active input method. Corresponding IME windows can be 494 * identified by checking {@link android.view.WindowManager.LayoutParams#token}. 495 * Note that there is no guarantee that the corresponding window is already 496 * created 497 * @param imeTargetWindowToken token to identify the target window that the IME is associated 498 * with 499 */ updateInputMethodTargetWindow(@onNull IBinder imeToken, @NonNull IBinder imeTargetWindowToken)500 public abstract void updateInputMethodTargetWindow(@NonNull IBinder imeToken, 501 @NonNull IBinder imeTargetWindowToken); 502 503 /** 504 * Returns true when the hardware keyboard is available. 505 */ isHardKeyboardAvailable()506 public abstract boolean isHardKeyboardAvailable(); 507 508 /** 509 * Sets the callback listener for hardware keyboard status changes. 510 * 511 * @param listener The listener to set. 512 */ setOnHardKeyboardStatusChangeListener( OnHardKeyboardStatusChangeListener listener)513 public abstract void setOnHardKeyboardStatusChangeListener( 514 OnHardKeyboardStatusChangeListener listener); 515 516 /** 517 * Requests the window manager to resend the windows for accessibility on specified display. 518 * 519 * @param displayId Display ID to be computed its windows for accessibility 520 */ computeWindowsForAccessibility(int displayId)521 public abstract void computeWindowsForAccessibility(int displayId); 522 523 /** 524 * Called after virtual display Id is updated by 525 * {@link com.android.server.vr.Vr2dDisplay} with a specific 526 * {@param vr2dDisplayId}. 527 */ setVr2dDisplayId(int vr2dDisplayId)528 public abstract void setVr2dDisplayId(int vr2dDisplayId); 529 530 /** 531 * Sets callback to DragDropController. 532 */ registerDragDropControllerCallback(IDragDropCallback callback)533 public abstract void registerDragDropControllerCallback(IDragDropCallback callback); 534 535 /** 536 * @see android.view.IWindowManager#lockNow 537 */ lockNow()538 public abstract void lockNow(); 539 540 /** 541 * Return the user that owns the given window, {@link android.os.UserHandle#USER_NULL} if 542 * the window token is not found. 543 */ getWindowOwnerUserId(IBinder windowToken)544 public abstract int getWindowOwnerUserId(IBinder windowToken); 545 546 /** 547 * Returns {@code true} if a Window owned by {@code uid} has focus. 548 */ isUidFocused(int uid)549 public abstract boolean isUidFocused(int uid); 550 551 /** 552 * Checks whether the specified IME client has IME focus or not. 553 * 554 * @param uid UID of the process to be queried 555 * @param pid PID of the process to be queried 556 * @param displayId Display ID reported from the client. Note that this method also verifies 557 * whether the specified process is allowed to access to this display or not 558 * @return {@code true} if the IME client specified with {@code uid}, {@code pid}, and 559 * {@code displayId} has IME focus 560 */ isInputMethodClientFocus(int uid, int pid, int displayId)561 public abstract boolean isInputMethodClientFocus(int uid, int pid, int displayId); 562 563 /** 564 * Checks whether the given {@code uid} is allowed to use the given {@code displayId} or not. 565 * 566 * @param displayId Display ID to be checked 567 * @param uid UID to be checked. 568 * @return {@code true} if the given {@code uid} is allowed to use the given {@code displayId} 569 */ isUidAllowedOnDisplay(int displayId, int uid)570 public abstract boolean isUidAllowedOnDisplay(int displayId, int uid); 571 572 /** 573 * Return the display Id for given window. 574 */ getDisplayIdForWindow(IBinder windowToken)575 public abstract int getDisplayIdForWindow(IBinder windowToken); 576 577 /** 578 * @return The top focused display ID. 579 */ getTopFocusedDisplayId()580 public abstract int getTopFocusedDisplayId(); 581 582 /** 583 * @return The UI context of top focused display. 584 */ getTopFocusedDisplayUiContext()585 public abstract Context getTopFocusedDisplayUiContext(); 586 587 /** 588 * Checks if this display is configured and allowed to show system decorations. 589 */ shouldShowSystemDecorOnDisplay(int displayId)590 public abstract boolean shouldShowSystemDecorOnDisplay(int displayId); 591 592 /** 593 * Indicates the policy for how the display should show IME. 594 * 595 * @param displayId The id of the display. 596 * @return The policy for how the display should show IME. 597 */ getDisplayImePolicy(int displayId)598 public abstract @DisplayImePolicy int getDisplayImePolicy(int displayId); 599 600 /** 601 * Show IME on imeTargetWindow once IME has finished layout. 602 * 603 * @param imeTargetWindowToken token of the (IME target) window on which IME should be shown. 604 */ showImePostLayout(IBinder imeTargetWindowToken)605 public abstract void showImePostLayout(IBinder imeTargetWindowToken); 606 607 /** 608 * Hide IME using imeTargetWindow when requested. 609 * 610 * @param imeTargetWindowToken token of the (IME target) window on which IME should be hidden. 611 * @param displayId the id of the display the IME is on. 612 */ hideIme(IBinder imeTargetWindowToken, int displayId)613 public abstract void hideIme(IBinder imeTargetWindowToken, int displayId); 614 615 /** 616 * Tell window manager about a package that should not be running with high refresh rate 617 * setting until removeNonHighRefreshRatePackage is called for the same package. 618 * 619 * This must not be called again for the same package. 620 */ addNonHighRefreshRatePackage(@onNull String packageName)621 public abstract void addNonHighRefreshRatePackage(@NonNull String packageName); 622 623 /** 624 * Tell window manager to stop constraining refresh rate for the given package. 625 */ removeNonHighRefreshRatePackage(@onNull String packageName)626 public abstract void removeNonHighRefreshRatePackage(@NonNull String packageName); 627 628 /** 629 * Checks if the device supports touch or faketouch. 630 */ isTouchOrFaketouchDevice()631 public abstract boolean isTouchOrFaketouchDevice(); 632 633 /** 634 * Returns the info associated with the input token used to determine if a key should be 635 * intercepted. This info can be accessed without holding the global wm lock. 636 */ 637 public abstract @Nullable KeyInterceptionInfo getKeyInterceptionInfoFromToken(IBinder inputToken)638 getKeyInterceptionInfoFromToken(IBinder inputToken); 639 640 /** 641 * Clears the snapshot cache of running activities so they show the splash-screen 642 * the next time the activities are opened. 643 */ clearSnapshotCache()644 public abstract void clearSnapshotCache(); 645 646 /** 647 * Assigns accessibility ID a window surface as a layer metadata. 648 */ setAccessibilityIdToSurfaceMetadata( IBinder windowToken, int accessibilityWindowId)649 public abstract void setAccessibilityIdToSurfaceMetadata( 650 IBinder windowToken, int accessibilityWindowId); 651 652 /** 653 * 654 * Returns the window name associated to the given binder. 655 * 656 * @param binder The {@link IBinder} object 657 * @return The corresponding {@link WindowState#getName()} 658 */ getWindowName(@onNull IBinder binder)659 public abstract String getWindowName(@NonNull IBinder binder); 660 661 /** 662 * Return the window name of IME Insets control target. 663 * 664 * @param displayId The ID of the display which input method is currently focused. 665 * @return The corresponding {@link WindowState#getName()} 666 */ getImeControlTargetNameForLogging(int displayId)667 public abstract @Nullable String getImeControlTargetNameForLogging(int displayId); 668 669 /** 670 * Return the current window name of the input method is on top of. 671 * 672 * Note that the concept of this window is only reparent the target window behind the input 673 * method window, it may different with the window which reported by 674 * {@code InputMethodManagerService#reportStartInput} which has input connection. 675 * 676 * @param displayId The ID of the display which input method is currently focused. 677 * @return The corresponding {@link WindowState#getName()} 678 */ getImeTargetNameForLogging(int displayId)679 public abstract @Nullable String getImeTargetNameForLogging(int displayId); 680 681 /** 682 * Moves the {@link WindowToken} {@code binder} to the display specified by {@code displayId}. 683 */ moveWindowTokenToDisplay(IBinder binder, int displayId)684 public abstract void moveWindowTokenToDisplay(IBinder binder, int displayId); 685 686 /** 687 * Checks whether the given window should restore the last IME visibility. 688 * 689 * @param imeTargetWindowToken The token of the (IME target) window 690 * @return {@code true} when the system allows to restore the IME visibility, 691 * {@code false} otherwise. 692 */ shouldRestoreImeVisibility(IBinder imeTargetWindowToken)693 public abstract boolean shouldRestoreImeVisibility(IBinder imeTargetWindowToken); 694 } 695