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 static java.lang.annotation.RetentionPolicy.SOURCE; 20 21 import android.annotation.IntDef; 22 import android.annotation.NonNull; 23 import android.annotation.Nullable; 24 import android.annotation.UserIdInt; 25 import android.content.ClipData; 26 import android.content.Context; 27 import android.graphics.Matrix; 28 import android.graphics.Point; 29 import android.graphics.Rect; 30 import android.graphics.Region; 31 import android.hardware.display.DisplayManagerInternal; 32 import android.hardware.display.VirtualDisplayConfig; 33 import android.os.Bundle; 34 import android.os.IBinder; 35 import android.os.Message; 36 import android.util.ArraySet; 37 import android.util.Pair; 38 import android.util.SparseArray; 39 import android.view.ContentRecordingSession; 40 import android.view.Display; 41 import android.view.IInputFilter; 42 import android.view.IRemoteAnimationFinishedCallback; 43 import android.view.IWindow; 44 import android.view.MagnificationSpec; 45 import android.view.RemoteAnimationTarget; 46 import android.view.Surface; 47 import android.view.SurfaceControl; 48 import android.view.SurfaceControlViewHost; 49 import android.view.WindowManager.DisplayImePolicy; 50 import android.view.inputmethod.ImeTracker; 51 import android.window.ScreenCapture; 52 import android.window.ScreenCapture.ScreenshotHardwareBuffer; 53 54 import com.android.internal.policy.KeyInterceptionInfo; 55 import com.android.server.input.InputManagerService; 56 import com.android.server.policy.WindowManagerPolicy; 57 import com.android.server.wm.SensitiveContentPackages.PackageInfo; 58 59 import java.lang.annotation.Retention; 60 import java.util.List; 61 import java.util.Set; 62 import java.util.concurrent.CompletableFuture; 63 64 /** 65 * Window manager local system service interface. 66 * 67 * @hide Only for use within the system server. 68 */ 69 public abstract class WindowManagerInternal { 70 71 /** 72 * Interface for accessibility features implemented by AccessibilityController inside 73 * WindowManager. 74 */ 75 public interface AccessibilityControllerInternal { 76 /** 77 * Start tracing for the given logging types. 78 * @param loggingTypeFlags flags of the logging types enabled. 79 */ startTrace(long loggingTypeFlags)80 void startTrace(long loggingTypeFlags); 81 82 /** 83 * Disable accessibility tracing for all logging types. 84 */ stopTrace()85 void stopTrace(); 86 87 /** 88 * Is tracing enabled for any logging type. 89 */ isAccessibilityTracingEnabled()90 boolean isAccessibilityTracingEnabled(); 91 92 /** 93 * Add an accessibility trace entry. 94 * 95 * @param where A string to identify this log entry, which can be used to filter/search 96 * through the tracing file. 97 * @param loggingTypeFlags The flags for the logging types this log entry belongs to. 98 * @param callingParams The parameters for the method to be logged. 99 * @param a11yDump The proto byte array for a11y state when the entry is generated 100 * @param callingUid The calling uid. 101 * @param stackTrace The stack trace, null if not needed. 102 * @param ignoreStackEntries The stack entries can be removed 103 */ logTrace( String where, long loggingTypeFlags, String callingParams, byte[] a11yDump, int callingUid, StackTraceElement[] stackTrace, Set<String> ignoreStackEntries)104 void logTrace( 105 String where, long loggingTypeFlags, String callingParams, byte[] a11yDump, 106 int callingUid, StackTraceElement[] stackTrace, Set<String> ignoreStackEntries); 107 108 /** 109 * Add an accessibility trace entry. 110 * 111 * @param where A string to identify this log entry, which can be used to filter/search 112 * through the tracing file. 113 * @param loggingTypeFlags The flags for the logging types this log entry belongs to. 114 * @param callingParams The parameters for the method to be logged. 115 * @param a11yDump The proto byte array for a11y state when the entry is generated. 116 * @param callingUid The calling uid. 117 * @param callStack The call stack of the method to be logged. 118 * @param timeStamp The time when the method to be logged is called. 119 * @param processId The calling process Id. 120 * @param threadId The calling thread Id. 121 * @param ignoreStackEntries The stack entries can be removed 122 */ logTrace(String where, long loggingTypeFlags, String callingParams, byte[] a11yDump, int callingUid, StackTraceElement[] callStack, long timeStamp, int processId, long threadId, Set<String> ignoreStackEntries)123 void logTrace(String where, long loggingTypeFlags, String callingParams, 124 byte[] a11yDump, int callingUid, StackTraceElement[] callStack, long timeStamp, 125 int processId, long threadId, Set<String> ignoreStackEntries); 126 127 /** 128 * Set by the accessibility related modules which want to listen the event dispatched from 129 * window manager. Accessibility modules can use these callbacks to handle some display 130 * manipulations. 131 * @param callbacks The callbacks to invoke. 132 */ setUiChangesForAccessibilityCallbacks(UiChangesForAccessibilityCallbacks callbacks)133 void setUiChangesForAccessibilityCallbacks(UiChangesForAccessibilityCallbacks callbacks); 134 135 /** 136 * This interface is used by window manager to dispatch some ui change events which may 137 * affect the screen accessibility features. 138 */ 139 interface UiChangesForAccessibilityCallbacks { 140 /** 141 * Called when an application requests a rectangle focus on the screen. 142 * 143 * @param displayId The logical display id 144 * @param left The rectangle left. 145 * @param top The rectangle top. 146 * @param right The rectangle right. 147 * @param bottom The rectangle bottom. 148 */ onRectangleOnScreenRequested(int displayId, int left, int top, int right, int bottom)149 void onRectangleOnScreenRequested(int displayId, int left, int top, int right, 150 int bottom); 151 } 152 } 153 154 /** Interface for clients to receive callbacks related to window change. */ 155 public interface WindowFocusChangeListener { 156 /** 157 * Notify on focus changed. 158 * 159 * @param focusedWindowToken the token of the newly focused window. 160 */ focusChanged(@onNull IBinder focusedWindowToken)161 void focusChanged(@NonNull IBinder focusedWindowToken); 162 } 163 164 /** 165 * Registers a listener to be notified about window focus changes. 166 * 167 * @param listener the {@link WindowFocusChangeListener} to register. 168 */ registerWindowFocusChangeListener(WindowFocusChangeListener listener)169 public abstract void registerWindowFocusChangeListener(WindowFocusChangeListener listener); 170 171 /** 172 * Unregisters a listener that was registered via {@link #registerWindowFocusChangeListener}. 173 * 174 * @param listener the {@link WindowFocusChangeListener} to unregister. 175 */ unregisterWindowFocusChangeListener(WindowFocusChangeListener listener)176 public abstract void unregisterWindowFocusChangeListener(WindowFocusChangeListener listener); 177 178 /** 179 * Interface to receive a callback when the windows reported for 180 * accessibility changed. 181 */ 182 public interface WindowsForAccessibilityCallback { 183 /** 184 * Called when the windows for accessibility changed. 185 * 186 * @param forceSend Send the windows for accessibility even if they haven't changed. 187 * @param topFocusedDisplayId The display Id which has the top focused window. 188 * @param topFocusedWindowToken The window token of top focused window. 189 * @param screenSize The size of the display that the change happened. 190 * @param windows The windows for accessibility. 191 */ onAccessibilityWindowsChanged(boolean forceSend, int topFocusedDisplayId, @NonNull IBinder topFocusedWindowToken, @NonNull Point screenSize, @NonNull List<AccessibilityWindowsPopulator.AccessibilityWindow> windows)192 void onAccessibilityWindowsChanged(boolean forceSend, int topFocusedDisplayId, 193 @NonNull IBinder topFocusedWindowToken, @NonNull Point screenSize, 194 @NonNull List<AccessibilityWindowsPopulator.AccessibilityWindow> windows); 195 } 196 197 /** 198 * Callbacks for contextual changes that affect the screen magnification 199 * feature. 200 */ 201 public interface MagnificationCallbacks { 202 203 /** 204 * Called when the region where magnification operates changes. Note that this isn't the 205 * entire screen. For example, IMEs are not magnified. 206 * 207 * @param magnificationRegion the current magnification region 208 */ onMagnificationRegionChanged(Region magnificationRegion)209 void onMagnificationRegionChanged(Region magnificationRegion); 210 211 /** 212 * Called when an application requests a rectangle on the screen to allow 213 * the client to apply the appropriate pan and scale. 214 * 215 * @param left The rectangle left. 216 * @param top The rectangle top. 217 * @param right The rectangle right. 218 * @param bottom The rectangle bottom. 219 */ onRectangleOnScreenRequested(int left, int top, int right, int bottom)220 void onRectangleOnScreenRequested(int left, int top, int right, int bottom); 221 222 /** 223 * Notifies that the display size is changed when rotation or the 224 * logical display is changed. 225 * 226 */ onDisplaySizeChanged()227 void onDisplaySizeChanged(); 228 229 /** 230 * Notifies that the context of the user changed. For example, an application 231 * was started. 232 */ onUserContextChanged()233 void onUserContextChanged(); 234 235 /** 236 * Notifies that the IME window visibility changed. 237 * @param shown {@code true} means the IME window shows on the screen. Otherwise it's 238 * hidden. 239 */ onImeWindowVisibilityChanged(boolean shown)240 void onImeWindowVisibilityChanged(boolean shown); 241 } 242 243 /** 244 * Abstract class to be notified about {@link com.android.server.wm.AppTransition} events. Held 245 * as an abstract class so a listener only needs to implement the methods of its interest. 246 */ 247 public static abstract class AppTransitionListener { 248 249 /** 250 * The display this listener is interested in. If it is INVALID_DISPLAY, then which display 251 * should be notified depends on the dispatcher. 252 */ 253 public final int mTargetDisplayId; 254 255 /** Let transition controller decide which display should receive the callbacks. */ AppTransitionListener()256 public AppTransitionListener() { 257 this(Display.INVALID_DISPLAY); 258 } 259 260 /** It will listen the transition on the given display. */ AppTransitionListener(int displayId)261 public AppTransitionListener(int displayId) { 262 mTargetDisplayId = displayId; 263 } 264 265 /** 266 * Called when an app transition is being setup and about to be executed. 267 */ onAppTransitionPendingLocked()268 public void onAppTransitionPendingLocked() {} 269 270 /** 271 * Called when a pending app transition gets cancelled. 272 * 273 * @param keyguardGoingAwayCancelled {@code true} if keyguard going away transition was 274 * cancelled. 275 */ onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled)276 public void onAppTransitionCancelledLocked(boolean keyguardGoingAwayCancelled) {} 277 278 /** 279 * Called when an app transition is timed out. 280 */ onAppTransitionTimeoutLocked()281 public void onAppTransitionTimeoutLocked() {} 282 283 /** 284 * Called when an app transition gets started 285 * 286 * @param statusBarAnimationStartTime the desired start time for all visual animations in 287 * the status bar caused by this app transition in uptime millis 288 * @param statusBarAnimationDuration the duration for all visual animations in the status 289 * bar caused by this app transition in millis 290 * 291 * @return Return any bit set of {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_LAYOUT}, 292 * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_CONFIG}, 293 * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_WALLPAPER}, 294 * or {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_ANIM}. 295 */ onAppTransitionStartingLocked(long statusBarAnimationStartTime, long statusBarAnimationDuration)296 public int onAppTransitionStartingLocked(long statusBarAnimationStartTime, 297 long statusBarAnimationDuration) { 298 return 0; 299 } 300 301 /** 302 * Called when an app transition is finished running. 303 * 304 * @param token the token for app whose transition has finished 305 */ onAppTransitionFinishedLocked(IBinder token)306 public void onAppTransitionFinishedLocked(IBinder token) {} 307 } 308 309 /** 310 * An interface to be notified when the system bars for a task change. 311 */ 312 public interface TaskSystemBarsListener { 313 314 /** 315 * Called when the visibility of the system bars of a task change. 316 * 317 * @param taskId the identifier of the task. 318 * @param visible if the transient system bars are visible. 319 * @param wereRevealedFromSwipeOnSystemBar if the transient bars were revealed due to a 320 * swipe gesture on a system bar. 321 */ onTransientSystemBarsVisibilityChanged( int taskId, boolean visible, boolean wereRevealedFromSwipeOnSystemBar)322 void onTransientSystemBarsVisibilityChanged( 323 int taskId, 324 boolean visible, 325 boolean wereRevealedFromSwipeOnSystemBar); 326 } 327 328 /** 329 * An interface to be notified on window removal. 330 */ 331 public interface OnWindowRemovedListener { 332 /** 333 * Called when a window is removed. 334 * 335 * @param token the client token 336 */ onWindowRemoved(IBinder token)337 void onWindowRemoved(IBinder token); 338 } 339 340 /** 341 * An interface to be notified when keyguard exit animation should start. 342 */ 343 public interface KeyguardExitAnimationStartListener { 344 /** 345 * Called when keyguard exit animation should start. 346 * @param apps The list of apps to animate. 347 * @param wallpapers The list of wallpapers to animate. 348 * @param finishedCallback The callback to invoke when the animation is finished. 349 */ onAnimationStart(RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers, IRemoteAnimationFinishedCallback finishedCallback)350 void onAnimationStart(RemoteAnimationTarget[] apps, 351 RemoteAnimationTarget[] wallpapers, 352 IRemoteAnimationFinishedCallback finishedCallback); 353 } 354 355 /** 356 * An interface to be notified about hardware keyboard status. 357 */ 358 public interface OnHardKeyboardStatusChangeListener { onHardKeyboardStatusChange(boolean available)359 public void onHardKeyboardStatusChange(boolean available); 360 } 361 362 /** 363 * An interface to be notified about requested changes in the IME visibility. 364 */ 365 public interface OnImeRequestedChangedListener { 366 /** 367 * Called when the requested IME visibility is changed. 368 * 369 * @param windowToken The window token 370 * @param imeVisible {@code true} if the IME should be shown, {@code false} to hide 371 * @param statsToken the token tracking the current IME request. 372 */ onImeRequestedChanged(IBinder windowToken, boolean imeVisible, @NonNull ImeTracker.Token statsToken)373 void onImeRequestedChanged(IBinder windowToken, boolean imeVisible, 374 @NonNull ImeTracker.Token statsToken); 375 } 376 377 /** 378 * An interface to customize drag and drop behaviors. 379 */ 380 public interface IDragDropCallback { registerInputChannel( DragState state, Display display, InputManagerService service, IBinder sourceInputChannelToken)381 default CompletableFuture<Boolean> registerInputChannel( 382 DragState state, Display display, InputManagerService service, 383 IBinder sourceInputChannelToken) { 384 return state.register(display) 385 .thenApply(unused -> 386 service.startDragAndDrop(sourceInputChannelToken, state.getInputToken())); 387 } 388 389 /** 390 * Called when drag operation is starting. 391 */ prePerformDrag(IWindow window, IBinder dragToken, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data)392 default boolean prePerformDrag(IWindow window, IBinder dragToken, 393 int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, 394 ClipData data) { 395 return true; 396 } 397 398 /** 399 * Called when drag operation is started. 400 */ postPerformDrag()401 default void postPerformDrag() {} 402 403 /** 404 * Called when drop result is being reported. 405 */ preReportDropResult(IWindow window, boolean consumed)406 default void preReportDropResult(IWindow window, boolean consumed) {} 407 408 /** 409 * Called when drop result was reported. 410 */ postReportDropResult()411 default void postReportDropResult() {} 412 413 /** 414 * Called when drag operation is being cancelled. 415 */ preCancelDragAndDrop(IBinder dragToken)416 default void preCancelDragAndDrop(IBinder dragToken) {} 417 418 /** 419 * Called when drag operation was cancelled. 420 */ postCancelDragAndDrop()421 default void postCancelDragAndDrop() {} 422 423 /** 424 * Called when it has entered a View that is willing to accept the drop. 425 */ dragRecipientEntered(IWindow window)426 default void dragRecipientEntered(IWindow window) {} 427 428 /** 429 * Called when it has exited a View that is willing to accept the drop. 430 */ dragRecipientExited(IWindow window)431 default void dragRecipientExited(IWindow window) {} 432 } 433 434 /** 435 * Request the interface to access features implemented by AccessibilityController. 436 */ getAccessibilityController()437 public abstract AccessibilityControllerInternal getAccessibilityController(); 438 439 /** 440 * Request that the window manager call 441 * {@link DisplayManagerInternal#performTraversalInTransactionFromWindowManager} 442 * within a surface transaction at a later time. 443 */ requestTraversalFromDisplayManager()444 public abstract void requestTraversalFromDisplayManager(); 445 446 /** 447 * Called just before display manager has applied the device state to the displays 448 * @param deviceState device state as defined by 449 * {@link android.hardware.devicestate.DeviceStateManager} 450 */ onDisplayManagerReceivedDeviceState(int deviceState)451 public abstract void onDisplayManagerReceivedDeviceState(int deviceState); 452 453 /** 454 * Set by the accessibility layer to observe changes in the magnified region, 455 * rotation, and other window transformations related to display magnification 456 * as the window manager is responsible for doing the actual magnification 457 * and has access to the raw window data while the accessibility layer serves 458 * as a controller. 459 * 460 * @param displayId The logical display id. 461 * @param callbacks The callbacks to invoke. 462 * @return {@code false} if display id is not valid or an embedded display. 463 */ setMagnificationCallbacks(int displayId, @Nullable MagnificationCallbacks callbacks)464 public abstract boolean setMagnificationCallbacks(int displayId, 465 @Nullable MagnificationCallbacks callbacks); 466 467 /** 468 * Set by the accessibility layer to specify the magnification and panning to 469 * be applied to all windows that should be magnified. 470 * 471 * @param displayId The logical display id. 472 * @param spec The MagnficationSpec to set. 473 * 474 * @see #setMagnificationCallbacks(int, MagnificationCallbacks) 475 */ setMagnificationSpec(int displayId, MagnificationSpec spec)476 public abstract void setMagnificationSpec(int displayId, MagnificationSpec spec); 477 478 /** 479 * Set by the accessibility framework to indicate whether fullscreen magnification is activated. 480 * 481 * @param displayId The logical display id. 482 * @param activated The activation of fullscreen magnification 483 */ setFullscreenMagnificationActivated(int displayId, boolean activated)484 public abstract void setFullscreenMagnificationActivated(int displayId, boolean activated); 485 486 /** 487 * Obtains the magnification regions. 488 * 489 * @param displayId The logical display id. 490 * @param magnificationRegion the current magnification region 491 */ getMagnificationRegion(int displayId, @NonNull Region magnificationRegion)492 public abstract void getMagnificationRegion(int displayId, @NonNull Region magnificationRegion); 493 494 /** 495 * Sets a callback for observing which windows are touchable for the purposes 496 * of accessibility on specified display. 497 * 498 * @param displayId The logical display id. 499 * @param callback The callback. 500 */ setWindowsForAccessibilityCallback(int displayId, WindowsForAccessibilityCallback callback)501 public abstract void setWindowsForAccessibilityCallback(int displayId, 502 WindowsForAccessibilityCallback callback); 503 504 /** 505 * Sets a filter for manipulating the input event stream. 506 * 507 * @param filter The filter implementation. 508 */ setInputFilter(IInputFilter filter)509 public abstract void setInputFilter(IInputFilter filter); 510 511 /** 512 * Gets the token of the window that has input focus. 513 * 514 * @return The token. 515 */ getFocusedWindowToken()516 public abstract IBinder getFocusedWindowToken(); 517 518 /** 519 * Gets the token of the window that has input focus. It is from the focused 520 * {@link WindowState}. 521 * 522 * @return The token. 523 */ getFocusedWindowTokenFromWindowStates()524 public abstract IBinder getFocusedWindowTokenFromWindowStates(); 525 526 /** 527 * Moves the given display to the top. 528 */ moveDisplayToTopIfAllowed(int displayId)529 public abstract void moveDisplayToTopIfAllowed(int displayId); 530 531 /** 532 * Request to move window input focus to the window with the provided window token. 533 * 534 * <p> 535 * It is necessary to move window input focus before certain actions on views in a window can 536 * be performed, such as opening an IME. Input normally requests to move focus on window touch 537 * so this method should not be necessary in most cases; only features that bypass normal touch 538 * behavior (like Accessibility actions) require this method. 539 * </p> 540 * @param windowToken The window token. 541 */ requestWindowFocus(IBinder windowToken)542 public abstract void requestWindowFocus(IBinder windowToken); 543 544 /** 545 * @return Whether the keyguard is engaged. 546 */ isKeyguardLocked()547 public abstract boolean isKeyguardLocked(); 548 549 /** 550 * @return Whether the keyguard is showing and not occluded. 551 */ isKeyguardShowingAndNotOccluded()552 public abstract boolean isKeyguardShowingAndNotOccluded(); 553 554 /** 555 * Return whether the keyguard is secured by a PIN, pattern or password or a SIM card is 556 * currently locked. 557 * 558 * @param userId User ID to be queried about. 559 * @return {@code true} if a PIN, pattern or password is set or a SIM card is locked. 560 */ isKeyguardSecure(@serIdInt int userId)561 public abstract boolean isKeyguardSecure(@UserIdInt int userId); 562 563 /** 564 * Gets the frame of a window given its token. 565 * 566 * @param token The token. 567 * @param outBounds The frame to populate. 568 */ getWindowFrame(IBinder token, Rect outBounds)569 public abstract void getWindowFrame(IBinder token, Rect outBounds); 570 571 /** 572 * Get the transformation matrix and MagnificationSpec given its token. 573 * 574 * @param token The token. 575 * @return The pair of the transformation matrix and magnification spec. 576 */ 577 // TODO (b/231663133): Long term solution for tracking window when the 578 // FLAG_RETRIEVE_INTERACTIVE_WINDOWS is unset. 579 public abstract Pair<Matrix, MagnificationSpec> getWindowTransformationMatrixAndMagnificationSpec(IBinder token)580 getWindowTransformationMatrixAndMagnificationSpec(IBinder token); 581 582 /** 583 * Opens the global actions dialog. 584 */ showGlobalActions()585 public abstract void showGlobalActions(); 586 587 /** 588 * Invalidate all visible windows on a given display, and report back on the callback when all 589 * windows have redrawn. 590 * 591 * @param message The message will be sent when all windows have redrawn. Note that the message 592 * must be obtained from handler, otherwise it will throw NPE. 593 * @param timeout calls the callback anyway after the timeout. 594 * @param displayId waits for the windows on the given display, INVALID_DISPLAY to wait for all 595 * windows on all displays. 596 */ waitForAllWindowsDrawn(Message message, long timeout, int displayId)597 public abstract void waitForAllWindowsDrawn(Message message, long timeout, int displayId); 598 599 /** 600 * Overrides the display size. 601 * 602 * @param displayId The display to override the display size. 603 * @param width The width to override. 604 * @param height The height to override. 605 */ setForcedDisplaySize(int displayId, int width, int height)606 public abstract void setForcedDisplaySize(int displayId, int width, int height); 607 608 /** 609 * Recover the display size to real display size. 610 * 611 * @param displayId The display to recover the display size. 612 */ clearForcedDisplaySize(int displayId)613 public abstract void clearForcedDisplaySize(int displayId); 614 615 /** 616 * Adds a window token for a given window type. 617 * 618 * @param token The token to add. 619 * @param type The window type. 620 * @param displayId The display to add the token to. 621 * @param options A bundle used to pass window-related options. 622 */ addWindowToken(@onNull android.os.IBinder token, int type, int displayId, @Nullable Bundle options)623 public abstract void addWindowToken(@NonNull android.os.IBinder token, int type, int displayId, 624 @Nullable Bundle options); 625 626 /** 627 * Removes a window token. 628 * 629 * @param token The toke to remove. 630 * @param removeWindows Whether to also remove the windows associated with the token. 631 * @param displayId The display to remove the token from. 632 */ removeWindowToken(android.os.IBinder token, boolean removeWindows, int displayId)633 public final void removeWindowToken(android.os.IBinder token, boolean removeWindows, 634 int displayId) { 635 removeWindowToken(token, removeWindows, true /* animateExit */, displayId); 636 } 637 638 /** 639 * Removes a window token. 640 * 641 * @param token The toke to remove. 642 * @param removeWindows Whether to also remove the windows associated with the token. 643 * @param animateExit Whether to play the windows exit animation after the token removal. 644 * @param displayId The display to remove the token from. 645 */ removeWindowToken(android.os.IBinder token, boolean removeWindows, boolean animateExit, int displayId)646 public abstract void removeWindowToken(android.os.IBinder token, boolean removeWindows, 647 boolean animateExit, int displayId); 648 649 /** 650 * Registers a listener to be notified about app transition events. 651 * 652 * @param listener The listener to register. 653 */ registerAppTransitionListener(AppTransitionListener listener)654 public abstract void registerAppTransitionListener(AppTransitionListener listener); 655 656 /** 657 * Registers a listener to be notified to when the system bars of a task changes. 658 * 659 * @param listener The listener to register. 660 */ registerTaskSystemBarsListener(TaskSystemBarsListener listener)661 public abstract void registerTaskSystemBarsListener(TaskSystemBarsListener listener); 662 663 /** 664 * Registers a listener to be notified to when the system bars of a task changes. 665 * 666 * @param listener The listener to unregister. 667 */ unregisterTaskSystemBarsListener(TaskSystemBarsListener listener)668 public abstract void unregisterTaskSystemBarsListener(TaskSystemBarsListener listener); 669 670 /** 671 * Reports that the password for the given user has changed. 672 */ reportPasswordChanged(int userId)673 public abstract void reportPasswordChanged(int userId); 674 675 /** 676 * Retrieves a height of input method window for given display. 677 */ getInputMethodWindowVisibleHeight(int displayId)678 public abstract int getInputMethodWindowVisibleHeight(int displayId); 679 680 /** 681 * Notifies WindowManagerService that the expected back-button behavior might have changed. 682 * 683 * <p>Only {@link com.android.server.inputmethod.InputMethodManagerService} is the expected and 684 * tested caller of this method.</p> 685 * 686 * @param dismissImeOnBackKeyPressed {@code true} if the software keyboard is shown and the back 687 * key is expected to dismiss the software keyboard. 688 */ setDismissImeOnBackKeyPressed(boolean dismissImeOnBackKeyPressed)689 public abstract void setDismissImeOnBackKeyPressed(boolean dismissImeOnBackKeyPressed); 690 691 /** 692 * Notifies WindowManagerService that the current IME window status is being changed. 693 * 694 * <p>Only {@link com.android.server.inputmethod.InputMethodManagerService} is the expected and 695 * tested caller of this method.</p> 696 * 697 * @param imeTargetWindowToken token to identify the target window that the IME is associated 698 * with 699 */ updateInputMethodTargetWindow(@onNull IBinder imeTargetWindowToken)700 public abstract void updateInputMethodTargetWindow(@NonNull IBinder imeTargetWindowToken); 701 702 /** 703 * Returns true when the hardware keyboard is available. 704 */ isHardKeyboardAvailable()705 public abstract boolean isHardKeyboardAvailable(); 706 707 /** 708 * Sets the callback listener for hardware keyboard status changes. 709 * 710 * @param listener The listener to set. 711 */ setOnHardKeyboardStatusChangeListener( OnHardKeyboardStatusChangeListener listener)712 public abstract void setOnHardKeyboardStatusChangeListener( 713 OnHardKeyboardStatusChangeListener listener); 714 715 716 /** 717 * Sets the callback listener for requested IME visibility changes in ImeInsetsSourceProvider 718 * 719 * @param listener The listener to set 720 */ setOnImeRequestedChangedListener(OnImeRequestedChangedListener listener)721 public abstract void setOnImeRequestedChangedListener(OnImeRequestedChangedListener listener); 722 723 /** 724 * Requests the window manager to resend the windows for accessibility on specified display. 725 * 726 * @param displayId Display ID to be computed its windows for accessibility 727 */ computeWindowsForAccessibility(int displayId)728 public abstract void computeWindowsForAccessibility(int displayId); 729 730 /** 731 * Called after virtual display Id is updated by 732 * {@link com.android.server.vr.Vr2dDisplay} with a specific 733 * {@param vr2dDisplayId}. 734 */ setVr2dDisplayId(int vr2dDisplayId)735 public abstract void setVr2dDisplayId(int vr2dDisplayId); 736 737 /** 738 * Sets callback to DragDropController. 739 */ registerDragDropControllerCallback(IDragDropCallback callback)740 public abstract void registerDragDropControllerCallback(IDragDropCallback callback); 741 742 /** 743 * @see android.view.IWindowManager#lockNow 744 */ lockNow()745 public abstract void lockNow(); 746 747 /** 748 * Return the user that owns the given window, {@link android.os.UserHandle#USER_NULL} if 749 * the window token is not found. 750 */ getWindowOwnerUserId(IBinder windowToken)751 public abstract int getWindowOwnerUserId(IBinder windowToken); 752 753 /** 754 * Control visilibility of a {@link WallpaperWindowToken} {@code} binder on the lock screen. 755 * 756 * <p>This will also affect its Z-ordering as {@code showWhenLocked} wallpaper tokens are 757 * arranged underneath non-{@code showWhenLocked} wallpaper tokens. 758 * 759 * @param windowToken wallpaper token previously added via {@link #addWindowToken} 760 * @param showWhenLocked whether {@param token} can continue to be shown on the lock screen. 761 */ setWallpaperShowWhenLocked(IBinder windowToken, boolean showWhenLocked)762 public abstract void setWallpaperShowWhenLocked(IBinder windowToken, boolean showWhenLocked); 763 764 /** 765 * Sets the crop hints of a {@link WallpaperWindowToken}. Only effective for image wallpapers. 766 * 767 * @param windowToken wallpaper token previously added via {@link #addWindowToken} 768 * @param cropHints a map that represents which part of the wallpaper should be shown, for 769 * each type of {@link android.app.WallpaperManager.ScreenOrientation}. 770 */ setWallpaperCropHints(IBinder windowToken, SparseArray<Rect> cropHints)771 public abstract void setWallpaperCropHints(IBinder windowToken, SparseArray<Rect> cropHints); 772 773 /** 774 * Returns {@code true} if a Window owned by {@code uid} has focus. 775 */ isUidFocused(int uid)776 public abstract boolean isUidFocused(int uid); 777 778 /** 779 * Checks whether the specified IME client has IME focus or not. 780 * 781 * @param windowToken The window token of the input method client 782 * @param uid UID of the process to be queried 783 * @param pid PID of the process to be queried 784 * @param displayId Display ID reported from the client. Note that this method also verifies 785 * whether the specified process is allowed to access to this display or not 786 * @return {@code true} if the IME client specified with {@code uid}, {@code pid}, and 787 * {@code displayId} has IME focus 788 */ hasInputMethodClientFocus(IBinder windowToken, int uid, int pid, int displayId)789 public abstract @ImeClientFocusResult int hasInputMethodClientFocus(IBinder windowToken, 790 int uid, int pid, int displayId); 791 792 @Retention(SOURCE) 793 @IntDef({ 794 ImeClientFocusResult.HAS_IME_FOCUS, 795 ImeClientFocusResult.NOT_IME_TARGET_WINDOW, 796 ImeClientFocusResult.DISPLAY_ID_MISMATCH, 797 ImeClientFocusResult.INVALID_DISPLAY_ID 798 }) 799 public @interface ImeClientFocusResult { 800 int HAS_IME_FOCUS = 0; 801 int NOT_IME_TARGET_WINDOW = -1; 802 int DISPLAY_ID_MISMATCH = -2; 803 int INVALID_DISPLAY_ID = -3; 804 } 805 806 /** 807 * Checks whether the given {@code uid} is allowed to use the given {@code displayId} or not. 808 * 809 * @param displayId Display ID to be checked 810 * @param uid UID to be checked. 811 * @return {@code true} if the given {@code uid} is allowed to use the given {@code displayId} 812 */ isUidAllowedOnDisplay(int displayId, int uid)813 public abstract boolean isUidAllowedOnDisplay(int displayId, int uid); 814 815 /** 816 * Return the display Id for given window. 817 */ getDisplayIdForWindow(IBinder windowToken)818 public abstract int getDisplayIdForWindow(IBinder windowToken); 819 820 /** 821 * @return The top focused display ID. 822 */ getTopFocusedDisplayId()823 public abstract int getTopFocusedDisplayId(); 824 825 /** 826 * @return The UI context of top focused display. 827 */ getTopFocusedDisplayUiContext()828 public abstract Context getTopFocusedDisplayUiContext(); 829 830 /** 831 * Sets the rotation of a non-default display. 832 * 833 * @param displayId The id of the display 834 * @param rotation The new rotation value. 835 * @param caller The requester of the rotation change, used for bookkeeping. 836 */ setNonDefaultDisplayRotation(int displayId, @Surface.Rotation int rotation, @NonNull String caller)837 public abstract void setNonDefaultDisplayRotation(int displayId, @Surface.Rotation int rotation, 838 @NonNull String caller); 839 840 /** 841 * Sets whether the relevant display content can host the relevant home activity and wallpaper. 842 * 843 * @param displayUniqueId The unique ID of the display. Note that the display may not yet be 844 * created, but whenever it is, this property will be applied. 845 * @param displayType The type of the display, e.g. {@link Display#TYPE_VIRTUAL}. 846 * @param supported Whether home and wallpaper are supported on this display. 847 */ setHomeSupportedOnDisplay( @onNull String displayUniqueId, int displayType, boolean supported)848 public abstract void setHomeSupportedOnDisplay( 849 @NonNull String displayUniqueId, int displayType, boolean supported); 850 851 /** 852 * Checks if this display is configured and allowed to show home activity and wallpaper. 853 * 854 * <p>This is implied for displays that have {@link Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS} 855 * and can also be set via {@link VirtualDisplayConfig.Builder#setHomeSupported}.</p> 856 */ isHomeSupportedOnDisplay(int displayId)857 public abstract boolean isHomeSupportedOnDisplay(int displayId); 858 859 /** 860 * Sets whether the relevant display content ignores fixed orientation, aspect ratio 861 * and resizability of apps. 862 * 863 * @param displayUniqueId The unique ID of the display. Note that the display may not yet be 864 * created, but whenever it is, this property will be applied. 865 * @param displayType The type of the display, e.g. {@link Display#TYPE_VIRTUAL}. 866 * @param enabled Whether app is universal resizable on this display. 867 */ setIgnoreActivitySizeRestrictionsOnDisplay( @onNull String displayUniqueId, int displayType, boolean enabled)868 public abstract void setIgnoreActivitySizeRestrictionsOnDisplay( 869 @NonNull String displayUniqueId, int displayType, boolean enabled); 870 871 /** 872 * Removes any settings relevant to the given display. 873 * 874 * <p>This may be used when a property is set for a display unique ID before the display 875 * creation but the actual display creation failed for some reason.</p> 876 */ clearDisplaySettings(@onNull String displayUniqueId, int displayType)877 public abstract void clearDisplaySettings(@NonNull String displayUniqueId, int displayType); 878 879 /** 880 * Indicates the policy for how the display should show IME. 881 * 882 * @param displayId The id of the display. 883 * @return The policy for how the display should show IME. 884 */ getDisplayImePolicy(int displayId)885 public abstract @DisplayImePolicy int getDisplayImePolicy(int displayId); 886 887 /** 888 * Show IME on imeTargetWindow once IME has finished layout. 889 * 890 * @param imeTargetWindowToken token of the (IME target) window which IME should be shown. 891 * @param statsToken the token tracking the current IME request. 892 */ showImePostLayout(IBinder imeTargetWindowToken, @NonNull ImeTracker.Token statsToken)893 public abstract void showImePostLayout(IBinder imeTargetWindowToken, 894 @NonNull ImeTracker.Token statsToken); 895 896 /** 897 * Hide IME using imeTargetWindow when requested. 898 * 899 * @param imeTargetWindowToken token of the (IME target) window which requests hiding IME. 900 * @param displayId the id of the display the IME is on. 901 * @param statsToken the token tracking the current IME request. 902 */ hideIme(IBinder imeTargetWindowToken, int displayId, @NonNull ImeTracker.Token statsToken)903 public abstract void hideIme(IBinder imeTargetWindowToken, int displayId, 904 @NonNull ImeTracker.Token statsToken); 905 906 /** 907 * Tell window manager about a package that should be running with a restricted range of 908 * refresh rate setting until removeRefreshRateRangeForPackage is called for the same package. 909 * 910 * This must not be called again for the same package. 911 */ addRefreshRateRangeForPackage(@onNull String packageName, float minRefreshRate, float maxRefreshRate)912 public abstract void addRefreshRateRangeForPackage(@NonNull String packageName, 913 float minRefreshRate, float maxRefreshRate); 914 915 /** 916 * Tell window manager to stop constraining refresh rate for the given package. 917 */ removeRefreshRateRangeForPackage(@onNull String packageName)918 public abstract void removeRefreshRateRangeForPackage(@NonNull String packageName); 919 920 /** 921 * Checks if the device supports touch or faketouch. 922 */ isTouchOrFaketouchDevice()923 public abstract boolean isTouchOrFaketouchDevice(); 924 925 /** 926 * Returns the info associated with the input token used to determine if a key should be 927 * intercepted. This info can be accessed without holding the global wm lock. 928 */ 929 public abstract @Nullable KeyInterceptionInfo getKeyInterceptionInfoFromToken(IBinder inputToken)930 getKeyInterceptionInfoFromToken(IBinder inputToken); 931 932 /** 933 * Clears the snapshot cache of running activities so they show the splash-screen 934 * the next time the activities are opened. 935 */ clearSnapshotCache()936 public abstract void clearSnapshotCache(); 937 938 /** 939 * Assigns accessibility ID a window surface as a layer metadata. 940 */ setAccessibilityIdToSurfaceMetadata( IBinder windowToken, int accessibilityWindowId)941 public abstract void setAccessibilityIdToSurfaceMetadata( 942 IBinder windowToken, int accessibilityWindowId); 943 944 /** 945 * 946 * Returns the window name associated to the given binder. 947 * 948 * @param binder The {@link IBinder} object 949 * @return The corresponding {@link WindowState#getName()} 950 */ getWindowName(@onNull IBinder binder)951 public abstract String getWindowName(@NonNull IBinder binder); 952 953 /** 954 * The callback after the request of show/hide input method is sent. 955 * 956 * @param show Whether to show or hide input method. 957 * @param focusedToken The token of focused window. 958 * @param requestToken The token of window who requests the change. 959 * @param displayId The ID of the display which input method is currently focused. 960 * @return The information of the input method target. 961 */ onToggleImeRequested(boolean show, @NonNull IBinder focusedToken, @NonNull IBinder requestToken, int displayId)962 public abstract ImeTargetInfo onToggleImeRequested(boolean show, 963 @NonNull IBinder focusedToken, @NonNull IBinder requestToken, int displayId); 964 965 /** 966 * Returns the token to identify the target window that the IME is associated with. 967 */ getTargetWindowTokenFromInputToken(IBinder inputToken)968 public abstract @Nullable IBinder getTargetWindowTokenFromInputToken(IBinder inputToken); 969 970 /** The information of input method target when IME is requested to show or hide. */ 971 public static class ImeTargetInfo { 972 public final String focusedWindowName; 973 public final String requestWindowName; 974 975 /** The window name of IME Insets control target. */ 976 public final String imeControlTargetName; 977 978 /** 979 * The current window name of the input method is on top of. 980 * <p> 981 * Note that the concept of this window is only used to reparent the target window behind 982 * the input method window, it may be different from the window reported by 983 * {@link com.android.server.inputmethod.InputMethodManagerService#reportStartInput} which 984 * has input connection. 985 */ 986 public final String imeLayerTargetName; 987 988 /** The surface parent of the IME container. */ 989 public final String imeSurfaceParentName; 990 ImeTargetInfo(String focusedWindowName, String requestWindowName, String imeControlTargetName, String imeLayerTargetName, String imeSurfaceParentName)991 public ImeTargetInfo(String focusedWindowName, String requestWindowName, 992 String imeControlTargetName, String imeLayerTargetName, 993 String imeSurfaceParentName) { 994 this.focusedWindowName = focusedWindowName; 995 this.requestWindowName = requestWindowName; 996 this.imeControlTargetName = imeControlTargetName; 997 this.imeLayerTargetName = imeLayerTargetName; 998 this.imeSurfaceParentName = imeSurfaceParentName; 999 } 1000 } 1001 1002 /** 1003 * Moves the {@link WindowToken} {@code binder} to the display specified by {@code displayId}. 1004 */ moveWindowTokenToDisplay(IBinder binder, int displayId)1005 public abstract void moveWindowTokenToDisplay(IBinder binder, int displayId); 1006 1007 /** 1008 * Checks whether the given window should restore the last IME visibility. 1009 * 1010 * @param imeTargetWindowToken The token of the (IME target) window 1011 * @return {@code true} when the system allows to restore the IME visibility, 1012 * {@code false} otherwise. 1013 */ shouldRestoreImeVisibility(IBinder imeTargetWindowToken)1014 public abstract boolean shouldRestoreImeVisibility(IBinder imeTargetWindowToken); 1015 1016 /** 1017 * Internal methods for other parts of SystemServer to manage 1018 * SurfacePackage based overlays on tasks. 1019 * 1020 * Since these overlays will overlay application content, they exist 1021 * in a container with setTrustedOverlay(true). This means its imperative 1022 * that this overlay feature only be used with UI completely under the control 1023 * of the system, without 3rd party content. 1024 * 1025 * Callers prepare a view hierarchy with SurfaceControlViewHost 1026 * and send the package to WM here. The remote view hierarchy will receive 1027 * configuration change, lifecycle events, etc, forwarded over the 1028 * ISurfaceControlViewHost interface inside the SurfacePackage. Embedded 1029 * hierarchies will receive inset changes, including transient inset changes 1030 * (to avoid the status bar in immersive mode). 1031 * 1032 * The embedded hierarchy exists in a coordinate space relative to the task 1033 * bounds. 1034 */ addTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay)1035 public abstract void addTrustedTaskOverlay(int taskId, 1036 SurfaceControlViewHost.SurfacePackage overlay); removeTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay)1037 public abstract void removeTrustedTaskOverlay(int taskId, 1038 SurfaceControlViewHost.SurfacePackage overlay); 1039 1040 /** 1041 * Get a SurfaceControl that is the container layer that should be used to receive input to 1042 * support handwriting (Scribe) by the IME. 1043 */ getHandwritingSurfaceForDisplay(int displayId)1044 public abstract SurfaceControl getHandwritingSurfaceForDisplay(int displayId); 1045 1046 /** 1047 * Returns {@code true} if the given point is within the window bounds of the given window. 1048 * 1049 * @param windowToken the window whose bounds should be used for the hit test. 1050 * @param displayX the x coordinate of the test point in the display's coordinate space. 1051 * @param displayY the y coordinate of the test point in the display's coordinate space. 1052 */ isPointInsideWindow( @onNull IBinder windowToken, int displayId, float displayX, float displayY)1053 public abstract boolean isPointInsideWindow( 1054 @NonNull IBinder windowToken, int displayId, float displayX, float displayY); 1055 1056 /** 1057 * Updates the content recording session. If a different session is already in progress, then 1058 * the pre-existing session is stopped, and the new incoming session takes over. 1059 * 1060 * The DisplayContent for the new session will begin recording when 1061 * {@link RootWindowContainer#onDisplayChanged} is invoked for the new {@link VirtualDisplay}. 1062 * Must be invoked for a valid MediaProjection session. 1063 * 1064 * @param incomingSession the nullable incoming content recording session 1065 * @return {@code true} if successfully set the session, or {@code false} if the session 1066 * could not be prepared and the session needs to be torn down. 1067 */ setContentRecordingSession(ContentRecordingSession incomingSession)1068 public abstract boolean setContentRecordingSession(ContentRecordingSession incomingSession); 1069 1070 /** Returns the SurfaceControl accessibility services should use for accessibility overlays. */ getA11yOverlayLayer(int displayId)1071 public abstract SurfaceControl getA11yOverlayLayer(int displayId); 1072 1073 /** 1074 * Captures the entire display specified by the displayId using the args provided. If the args 1075 * are null or if the sourceCrop is invalid or null, the entire display bounds will be captured. 1076 */ captureDisplay(int displayId, @Nullable ScreenCapture.CaptureArgs captureArgs, ScreenCapture.ScreenCaptureListener listener)1077 public abstract void captureDisplay(int displayId, 1078 @Nullable ScreenCapture.CaptureArgs captureArgs, 1079 ScreenCapture.ScreenCaptureListener listener); 1080 1081 /** 1082 * Device has a software navigation bar (separate from the status bar) on specific display. 1083 * 1084 * @param displayId the id of display to check if there is a software navigation bar. 1085 */ hasNavigationBar(int displayId)1086 public abstract boolean hasNavigationBar(int displayId); 1087 1088 /** 1089 * Controls whether the app-requested screen orientation is always respected. 1090 * 1091 * @param respected If {@code true}, the app requested orientation is always respected. 1092 * Otherwise, the system might ignore the request due to 1093 * {@link com.android.server.wm.DisplayArea#getIgnoreOrientationRequest}. 1094 * @param fromOrientations The orientations we want to map to the correspondent orientations 1095 * in toOrientation. 1096 * @param toOrientations The orientations we map to the ones in fromOrientations at the same 1097 * index 1098 */ setOrientationRequestPolicy(boolean respected, int[] fromOrientations, int[] toOrientations)1099 public abstract void setOrientationRequestPolicy(boolean respected, 1100 int[] fromOrientations, int[] toOrientations); 1101 1102 /** 1103 * Set current screen capture session id that will be used during sensitive content protections. 1104 * 1105 * @param sessionId Session id for this screen capture protection 1106 */ setBlockScreenCaptureForAppsSessionId(long sessionId)1107 public abstract void setBlockScreenCaptureForAppsSessionId(long sessionId); 1108 1109 /** 1110 * Set whether screen capture should be disabled for all windows of a specific app windows based 1111 * on sensitive content protections. 1112 * 1113 * @param packageInfos set of {@link PackageInfo} whose windows should be blocked from capture 1114 */ addBlockScreenCaptureForApps(@onNull ArraySet<PackageInfo> packageInfos)1115 public abstract void addBlockScreenCaptureForApps(@NonNull ArraySet<PackageInfo> packageInfos); 1116 1117 /** 1118 * Clears apps added to collection of apps in which screen capture should be disabled. 1119 * 1120 * @param packageInfos set of {@link PackageInfo} whose windows should be unblocked 1121 * from capture. 1122 */ removeBlockScreenCaptureForApps( @onNull ArraySet<PackageInfo> packageInfos)1123 public abstract void removeBlockScreenCaptureForApps( 1124 @NonNull ArraySet<PackageInfo> packageInfos); 1125 1126 /** 1127 * Clears all apps added to collection of apps in which screen capture should be disabled. 1128 * 1129 * <p> This clears and resets any existing set or added applications from 1130 * * {@link #addBlockScreenCaptureForApps(ArraySet)} 1131 */ clearBlockedApps()1132 public abstract void clearBlockedApps(); 1133 1134 /** 1135 * Register a listener to receive a callback on window removal. 1136 * 1137 * @param listener the listener to be registered. 1138 */ registerOnWindowRemovedListener(OnWindowRemovedListener listener)1139 public abstract void registerOnWindowRemovedListener(OnWindowRemovedListener listener); 1140 1141 /** 1142 * Removes the listener. 1143 * 1144 * @param listener the listener to be removed. 1145 */ unregisterOnWindowRemovedListener(OnWindowRemovedListener listener)1146 public abstract void unregisterOnWindowRemovedListener(OnWindowRemovedListener listener); 1147 1148 /** 1149 * Moves the current focus to the adjacent activity if it has the latest created window. 1150 */ moveFocusToAdjacentEmbeddedActivityIfNeeded()1151 public abstract boolean moveFocusToAdjacentEmbeddedActivityIfNeeded(); 1152 1153 /** 1154 * Returns an instance of {@link ScreenshotHardwareBuffer} containing the current 1155 * screenshot. 1156 */ takeAssistScreenshot()1157 public abstract ScreenshotHardwareBuffer takeAssistScreenshot(); 1158 1159 /** 1160 * Returns an instance of {@link ScreenshotHardwareBuffer} containing the current 1161 * screenshot, excluding layers that are not appropriate to pass to contextual search 1162 * services - such as the cursor or any current contextual search window. 1163 * 1164 * @param uid the UID of the contextual search application. System alert windows belonging 1165 * to this UID will be excluded from the screenshot. 1166 */ takeContextualSearchScreenshot(int uid)1167 public abstract ScreenshotHardwareBuffer takeContextualSearchScreenshot(int uid); 1168 } 1169