1 /* 2 ** Copyright 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 com.android.internal.os.IResultReceiver; 20 import com.android.internal.policy.IKeyguardDismissCallback; 21 import com.android.internal.policy.IShortcutService; 22 23 import android.app.IAssistDataReceiver; 24 import android.content.res.CompatibilityInfo; 25 import android.content.res.Configuration; 26 import android.graphics.Bitmap; 27 import android.graphics.GraphicBuffer; 28 import android.graphics.Insets; 29 import android.graphics.Point; 30 import android.graphics.Rect; 31 import android.graphics.Region; 32 import android.os.Bundle; 33 import android.os.IRemoteCallback; 34 import android.os.ParcelFileDescriptor; 35 import android.view.DisplayCutout; 36 import android.view.IApplicationToken; 37 import android.view.IAppTransitionAnimationSpecsFuture; 38 import android.view.IDockedStackListener; 39 import android.view.IDisplayWindowInsetsController; 40 import android.view.IDisplayWindowListener; 41 import android.view.IDisplayFoldListener; 42 import android.view.IDisplayWindowRotationController; 43 import android.view.IOnKeyguardExitResult; 44 import android.view.IPinnedStackListener; 45 import android.view.IScrollCaptureController; 46 import android.view.RemoteAnimationAdapter; 47 import android.view.IRotationWatcher; 48 import android.view.ISystemGestureExclusionListener; 49 import android.view.IWallpaperVisibilityListener; 50 import android.view.IWindow; 51 import android.view.IWindowSession; 52 import android.view.IWindowSessionCallback; 53 import android.view.KeyEvent; 54 import android.view.InputEvent; 55 import android.view.InsetsState; 56 import android.view.MagnificationSpec; 57 import android.view.MotionEvent; 58 import android.view.InputChannel; 59 import android.view.InputDevice; 60 import android.view.IInputFilter; 61 import android.view.AppTransitionAnimationSpec; 62 import android.view.WindowContentFrameStats; 63 import android.view.WindowManager; 64 import android.view.SurfaceControl; 65 66 /** 67 * System private interface to the window manager. 68 * 69 * {@hide} 70 */ 71 interface IWindowManager 72 { 73 /** 74 * No overridden behavior is provided in terms of fixing rotation to user rotation. Use 75 * other flags to derive the default behavior, such as {@link WindowManagerService#mIsPc} 76 * and {@link WindowManagerService#mForceDesktopModeOnExternalDisplays}. 77 */ 78 const int FIXED_TO_USER_ROTATION_DEFAULT = 0; 79 /** 80 * Don't fix display rotation to {@link DisplayRotation#mUserRotation} only. Always allow 81 * other factors to play a role in deciding display rotation. 82 */ 83 const int FIXED_TO_USER_ROTATION_DISABLED = 1; 84 /** 85 * Only use {@link DisplayRotation#mUserRotation} as the display rotation. 86 */ 87 const int FIXED_TO_USER_ROTATION_ENABLED = 2; 88 89 /** 90 * ===== NOTICE ===== 91 * The first three methods must remain the first three methods. Scripts 92 * and tools rely on their transaction number to work properly. 93 */ 94 // This is used for debugging startViewServer(int port)95 boolean startViewServer(int port); // Transaction #1 stopViewServer()96 boolean stopViewServer(); // Transaction #2 isViewServerRunning()97 boolean isViewServerRunning(); // Transaction #3 98 openSession(in IWindowSessionCallback callback)99 IWindowSession openSession(in IWindowSessionCallback callback); 100 useBLAST()101 boolean useBLAST(); 102 103 @UnsupportedAppUsage getInitialDisplaySize(int displayId, out Point size)104 void getInitialDisplaySize(int displayId, out Point size); 105 @UnsupportedAppUsage getBaseDisplaySize(int displayId, out Point size)106 void getBaseDisplaySize(int displayId, out Point size); setForcedDisplaySize(int displayId, int width, int height)107 void setForcedDisplaySize(int displayId, int width, int height); clearForcedDisplaySize(int displayId)108 void clearForcedDisplaySize(int displayId); 109 @UnsupportedAppUsage getInitialDisplayDensity(int displayId)110 int getInitialDisplayDensity(int displayId); getBaseDisplayDensity(int displayId)111 int getBaseDisplayDensity(int displayId); setForcedDisplayDensityForUser(int displayId, int density, int userId)112 void setForcedDisplayDensityForUser(int displayId, int density, int userId); clearForcedDisplayDensityForUser(int displayId, int userId)113 void clearForcedDisplayDensityForUser(int displayId, int userId); setForcedDisplayScalingMode(int displayId, int mode)114 void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable 115 116 // These can only be called when holding the MANAGE_APP_TOKENS permission. setEventDispatching(boolean enabled)117 void setEventDispatching(boolean enabled); 118 119 /** @return {@code true} if this binder is a registered window token. */ isWindowToken(in IBinder binder)120 boolean isWindowToken(in IBinder binder); 121 /** 122 * Adds window token for a given type. 123 * 124 * @param token Token to be registered. 125 * @param type Window type to be used with this token. 126 * @param options A bundle used to pass window-related options. 127 * @param displayId The ID of the display where this token should be added. 128 * @param packageName The name of package to request to add window token. Could be {@code null} 129 * if callers holds the MANAGE_APP_TOKENS permission. 130 * @return {@link WindowManagerGlobal#ADD_OKAY} if the addition was successful, an error code 131 * otherwise. 132 */ addWindowTokenWithOptions(IBinder token, int type, int displayId, in Bundle options, String packageName)133 int addWindowTokenWithOptions(IBinder token, int type, int displayId, in Bundle options, 134 String packageName); addWindowToken(IBinder token, int type, int displayId)135 void addWindowToken(IBinder token, int type, int displayId); 136 /** 137 * Remove window token on a specific display. 138 * 139 * @param token Token to be removed 140 * @displayId The ID of the display where this token should be removed. 141 */ removeWindowToken(IBinder token, int displayId)142 void removeWindowToken(IBinder token, int displayId); prepareAppTransition(int transit, boolean alwaysKeepCurrent)143 void prepareAppTransition(int transit, boolean alwaysKeepCurrent); 144 145 /** 146 * Sets a singular remote controller of display rotations. There can only be one. The 147 * controller is called after the display has "frozen" for a rotation and display rotation will 148 * only continue once the controller has finished calculating associated configurations. 149 */ setDisplayWindowRotationController(IDisplayWindowRotationController controller)150 void setDisplayWindowRotationController(IDisplayWindowRotationController controller); 151 152 /** 153 * Adds a root container that a client shell can populate with its own windows (usually via 154 * WindowlessWindowManager). 155 * 156 * @param client an IWindow used for window-level communication (ime, finish draw, etc.). 157 * @param windowType used by WM to determine the z-order. This is the same as the window type 158 * used in {@link WindowManager.LayoutParams}. 159 * @return a SurfaceControl to add things to. 160 */ addShellRoot(int displayId, IWindow client, int windowType)161 SurfaceControl addShellRoot(int displayId, IWindow client, int windowType); 162 163 /** 164 * Sets the window token sent to accessibility for a particular shell root. The 165 * displayId and windowType identify which shell-root to update. 166 * 167 * @param target The IWindow that accessibility service interfaces with. 168 */ setShellRootAccessibilityWindow(int displayId, int windowType, IWindow target)169 void setShellRootAccessibilityWindow(int displayId, int windowType, IWindow target); 170 171 /** 172 * Like overridePendingAppTransitionMultiThumb, but uses a future to supply the specs. This is 173 * used for recents, where generating the thumbnails of the specs takes a non-trivial amount of 174 * time, so we want to move that off the critical path for starting the new activity. 175 */ 176 @UnsupportedAppUsage overridePendingAppTransitionMultiThumbFuture( IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback, boolean scaleUp, int displayId)177 void overridePendingAppTransitionMultiThumbFuture( 178 IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback, 179 boolean scaleUp, int displayId); 180 @UnsupportedAppUsage overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter, int displayId)181 void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter, 182 int displayId); 183 @UnsupportedAppUsage executeAppTransition()184 void executeAppTransition(); 185 186 /** 187 * Used by system ui to report that recents has shown itself. 188 * @deprecated to be removed once prebuilts are updated 189 */ 190 @UnsupportedAppUsage endProlongedAnimations()191 void endProlongedAnimations(); 192 startFreezingScreen(int exitAnim, int enterAnim)193 void startFreezingScreen(int exitAnim, int enterAnim); stopFreezingScreen()194 void stopFreezingScreen(); 195 196 // these require DISABLE_KEYGUARD permission 197 /** @deprecated use Activity.setShowWhenLocked instead. */ disableKeyguard(IBinder token, String tag, int userId)198 void disableKeyguard(IBinder token, String tag, int userId); 199 /** @deprecated use Activity.setShowWhenLocked instead. */ reenableKeyguard(IBinder token, int userId)200 void reenableKeyguard(IBinder token, int userId); exitKeyguardSecurely(IOnKeyguardExitResult callback)201 void exitKeyguardSecurely(IOnKeyguardExitResult callback); 202 @UnsupportedAppUsage isKeyguardLocked()203 boolean isKeyguardLocked(); 204 @UnsupportedAppUsage isKeyguardSecure(int userId)205 boolean isKeyguardSecure(int userId); dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message)206 void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message); 207 208 // Requires INTERACT_ACROSS_USERS_FULL permission setSwitchingUser(boolean switching)209 void setSwitchingUser(boolean switching); 210 closeSystemDialogs(String reason)211 void closeSystemDialogs(String reason); 212 213 // These can only be called with the SET_ANIMATON_SCALE permission. 214 @UnsupportedAppUsage getAnimationScale(int which)215 float getAnimationScale(int which); 216 @UnsupportedAppUsage getAnimationScales()217 float[] getAnimationScales(); 218 @UnsupportedAppUsage setAnimationScale(int which, float scale)219 void setAnimationScale(int which, float scale); 220 @UnsupportedAppUsage setAnimationScales(in float[] scales)221 void setAnimationScales(in float[] scales); 222 getCurrentAnimatorScale()223 float getCurrentAnimatorScale(); 224 225 // For testing 226 @UnsupportedAppUsage(maxTargetSdk = 28) setInTouchMode(boolean showFocus)227 void setInTouchMode(boolean showFocus); 228 229 // For StrictMode flashing a red border on violations from the UI 230 // thread. The uid/pid is implicit from the Binder call, and the Window 231 // Manager uses that to determine whether or not the red border should 232 // actually be shown. (it will be ignored that pid doesn't have windows 233 // on screen) 234 @UnsupportedAppUsage(maxTargetSdk = 28) showStrictModeViolation(boolean on)235 void showStrictModeViolation(boolean on); 236 237 // Proxy to set the system property for whether the flashing 238 // should be enabled. The 'enabled' value is null or blank for 239 // the system default (differs per build variant) or any valid 240 // boolean string as parsed by SystemProperties.getBoolean(). 241 @UnsupportedAppUsage setStrictModeVisualIndicatorPreference(String enabled)242 void setStrictModeVisualIndicatorPreference(String enabled); 243 244 /** 245 * Set whether screen capture is disabled for all windows of a specific user from 246 * the device policy cache. 247 */ refreshScreenCaptureDisabled(int userId)248 void refreshScreenCaptureDisabled(int userId); 249 250 // These can only be called with the SET_ORIENTATION permission. 251 /** 252 * Update the current screen rotation based on the current state of 253 * the world. 254 * @param alwaysSendConfiguration Flag to force a new configuration to 255 * be evaluated. This can be used when there are other parameters in 256 * configuration that are changing. 257 * @param forceRelayout If true, the window manager will always do a relayout 258 * of its windows even if the rotation hasn't changed. 259 */ updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout)260 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout); 261 262 /** 263 * Retrieve the current orientation of the primary screen. 264 * @return Constant as per {@link android.view.Surface.Rotation}. 265 * 266 * @see android.view.Display#DEFAULT_DISPLAY 267 */ getDefaultDisplayRotation()268 int getDefaultDisplayRotation(); 269 270 /** 271 * Watch the rotation of the specified screen. Returns the current rotation, 272 * calls back when it changes. 273 */ watchRotation(IRotationWatcher watcher, int displayId)274 int watchRotation(IRotationWatcher watcher, int displayId); 275 276 /** 277 * Remove a rotation watcher set using watchRotation. 278 * @hide 279 */ 280 @UnsupportedAppUsage removeRotationWatcher(IRotationWatcher watcher)281 void removeRotationWatcher(IRotationWatcher watcher); 282 283 /** 284 * Determine the preferred edge of the screen to pin the compact options menu against. 285 * 286 * @param displayId Id of the display where the menu window currently resides. 287 * @return a Gravity value for the options menu panel. 288 * @hide 289 */ getPreferredOptionsPanelGravity(int displayId)290 int getPreferredOptionsPanelGravity(int displayId); 291 292 /** 293 * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link 294 * android.view.Display#DEFAULT_DISPLAY} and given rotation. 295 */ 296 @UnsupportedAppUsage freezeRotation(int rotation)297 void freezeRotation(int rotation); 298 299 /** 300 * Equivalent to calling {@link #thawDisplayRotation(int)} with {@link 301 * android.view.Display#DEFAULT_DISPLAY}. 302 */ 303 @UnsupportedAppUsage thawRotation()304 void thawRotation(); 305 306 /** 307 * Equivelant to call {@link #isDisplayRotationFrozen(int)} with {@link 308 * android.view.Display#DEFAULT_DISPLAY}. 309 */ isRotationFrozen()310 boolean isRotationFrozen(); 311 312 /** 313 * Lock the display orientation to the specified rotation, or to the current 314 * rotation if -1. Sensor input will be ignored until thawRotation() is called. 315 * 316 * @param displayId the ID of display which rotation should be frozen. 317 * @param rotation one of {@link android.view.Surface#ROTATION_0}, 318 * {@link android.view.Surface#ROTATION_90}, {@link android.view.Surface#ROTATION_180}, 319 * {@link android.view.Surface#ROTATION_270} or -1 to freeze it to current rotation. 320 * @hide 321 */ freezeDisplayRotation(int displayId, int rotation)322 void freezeDisplayRotation(int displayId, int rotation); 323 324 /** 325 * Release the orientation lock imposed by freezeRotation() on the display. 326 * 327 * @param displayId the ID of display which rotation should be thawed. 328 * @hide 329 */ thawDisplayRotation(int displayId)330 void thawDisplayRotation(int displayId); 331 332 /** 333 * Gets whether the rotation is frozen on the display. 334 * 335 * @param displayId the ID of display which frozen is needed. 336 * @return Whether the rotation is frozen. 337 */ isDisplayRotationFrozen(int displayId)338 boolean isDisplayRotationFrozen(int displayId); 339 340 /** 341 * Sets if display rotation is fixed to user specified value for given displayId. 342 */ setFixedToUserRotation(int displayId, int fixedToUserRotation)343 void setFixedToUserRotation(int displayId, int fixedToUserRotation); 344 345 /** 346 * Screenshot the current wallpaper layer, including the whole screen. 347 */ screenshotWallpaper()348 Bitmap screenshotWallpaper(); 349 350 /** 351 * Registers a wallpaper visibility listener. 352 * @return Current visibility. 353 */ registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener, int displayId)354 boolean registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener, 355 int displayId); 356 357 /** 358 * Remove a visibility watcher that was added using registerWallpaperVisibilityListener. 359 */ unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener, int displayId)360 void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener, 361 int displayId); 362 363 /** 364 * Registers a system gesture exclusion listener for a given display. 365 */ registerSystemGestureExclusionListener(ISystemGestureExclusionListener listener, int displayId)366 void registerSystemGestureExclusionListener(ISystemGestureExclusionListener listener, 367 int displayId); 368 369 /** 370 * Unregisters a system gesture exclusion listener for a given display. 371 */ unregisterSystemGestureExclusionListener(ISystemGestureExclusionListener listener, int displayId)372 void unregisterSystemGestureExclusionListener(ISystemGestureExclusionListener listener, 373 int displayId); 374 375 /** 376 * Used only for assist -- request a screenshot of the current application. 377 */ requestAssistScreenshot(IAssistDataReceiver receiver)378 boolean requestAssistScreenshot(IAssistDataReceiver receiver); 379 380 /** 381 * Called by the status bar to notify Views of changes to System UI visiblity. 382 */ statusBarVisibilityChanged(int displayId, int visibility)383 oneway void statusBarVisibilityChanged(int displayId, int visibility); 384 385 /** 386 * Called by System UI to notify Window Manager to hide transient bars. 387 */ hideTransientBars(int displayId)388 oneway void hideTransientBars(int displayId); 389 390 /** 391 * Called by System UI to notify of changes to the visibility of Recents. 392 */ setRecentsVisibility(boolean visible)393 oneway void setRecentsVisibility(boolean visible); 394 395 /** 396 * Called by System UI to notify of changes to the visibility of PIP. 397 */ setPipVisibility(boolean visible)398 oneway void setPipVisibility(boolean visible); 399 400 /** 401 * Called by System UI to enable or disable haptic feedback on the navigation bar buttons. 402 */ 403 @UnsupportedAppUsage setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled)404 void setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled); 405 406 /** 407 * Device has a software navigation bar (separate from the status bar) on specific display. 408 * 409 * @param displayId the id of display to check if there is a software navigation bar. 410 */ 411 @UnsupportedAppUsage hasNavigationBar(int displayId)412 boolean hasNavigationBar(int displayId); 413 414 /** 415 * Get the position of the nav bar 416 */ getNavBarPosition(int displayId)417 int getNavBarPosition(int displayId); 418 419 /** 420 * Lock the device immediately with the specified options (can be null). 421 */ 422 @UnsupportedAppUsage lockNow(in Bundle options)423 void lockNow(in Bundle options); 424 425 /** 426 * Device is in safe mode. 427 */ 428 @UnsupportedAppUsage isSafeModeEnabled()429 boolean isSafeModeEnabled(); 430 431 /** 432 * Enables the screen if all conditions are met. 433 */ enableScreenIfNeeded()434 void enableScreenIfNeeded(); 435 436 /** 437 * Clears the frame statistics for a given window. 438 * 439 * @param token The window token. 440 * @return Whether the frame statistics were cleared. 441 */ clearWindowContentFrameStats(IBinder token)442 boolean clearWindowContentFrameStats(IBinder token); 443 444 /** 445 * Gets the content frame statistics for a given window. 446 * 447 * @param token The window token. 448 * @return The frame statistics or null if the window does not exist. 449 */ getWindowContentFrameStats(IBinder token)450 WindowContentFrameStats getWindowContentFrameStats(IBinder token); 451 452 /** 453 * This is a no-op. 454 */ 455 @UnsupportedAppUsage getDockedStackSide()456 int getDockedStackSide(); 457 458 /** 459 * Sets the region the user can touch the divider. This region will be excluded from the region 460 * which is used to cause a focus switch when dispatching touch. 461 */ setDockedStackDividerTouchRegion(in Rect touchableRegion)462 void setDockedStackDividerTouchRegion(in Rect touchableRegion); 463 464 /** 465 * Registers a listener that will be called when the pinned stack state changes. 466 */ registerPinnedStackListener(int displayId, IPinnedStackListener listener)467 void registerPinnedStackListener(int displayId, IPinnedStackListener listener); 468 469 /** 470 * Requests Keyboard Shortcuts from the displayed window. 471 * 472 * @param receiver The receiver to deliver the results to. 473 */ requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId)474 void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId); 475 476 /** 477 * Retrieves the current stable insets from the primary display. 478 */ 479 @UnsupportedAppUsage getStableInsets(int displayId, out Rect outInsets)480 void getStableInsets(int displayId, out Rect outInsets); 481 482 /** 483 * Set the forwarded insets on the display. 484 * <p> 485 * This is only used in case a virtual display is displayed on another display that has insets, 486 * and the bounds of the virtual display is overlapping with the insets from the host display. 487 * In that case, the contents on the virtual display won't be placed over the forwarded insets. 488 * Only the owner of the display is permitted to set the forwarded insets on it. 489 */ setForwardedInsets(int displayId, in Insets insets)490 void setForwardedInsets(int displayId, in Insets insets); 491 492 /** 493 * Register shortcut key. Shortcut code is packed as: 494 * (MetaState << Integer.SIZE) | KeyCode 495 * @hide 496 */ registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber)497 void registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber); 498 499 /** 500 * Create an input consumer by name and display id. 501 */ 502 @UnsupportedAppUsage createInputConsumer(IBinder token, String name, int displayId, out InputChannel inputChannel)503 void createInputConsumer(IBinder token, String name, int displayId, 504 out InputChannel inputChannel); 505 506 /** 507 * Destroy an input consumer by name and display id. 508 * This method will also dispose the input channels associated with that InputConsumer. 509 */ 510 @UnsupportedAppUsage destroyInputConsumer(String name, int displayId)511 boolean destroyInputConsumer(String name, int displayId); 512 513 /** 514 * Return the touch region for the current IME window, or an empty region if there is none. 515 */ getCurrentImeTouchRegion()516 Region getCurrentImeTouchRegion(); 517 518 /** 519 * Registers an IDisplayFoldListener. 520 */ registerDisplayFoldListener(IDisplayFoldListener listener)521 void registerDisplayFoldListener(IDisplayFoldListener listener); 522 523 /** 524 * Unregisters an IDisplayFoldListener. 525 */ unregisterDisplayFoldListener(IDisplayFoldListener listener)526 void unregisterDisplayFoldListener(IDisplayFoldListener listener); 527 528 /** 529 * Registers an IDisplayContainerListener 530 */ registerDisplayWindowListener(IDisplayWindowListener listener)531 void registerDisplayWindowListener(IDisplayWindowListener listener); 532 533 /** 534 * Unregisters an IDisplayContainerListener. 535 */ unregisterDisplayWindowListener(IDisplayWindowListener listener)536 void unregisterDisplayWindowListener(IDisplayWindowListener listener); 537 538 /** 539 * Starts a window trace. 540 */ startWindowTrace()541 void startWindowTrace(); 542 543 /** 544 * Stops a window trace. 545 */ stopWindowTrace()546 void stopWindowTrace(); 547 548 /** 549 * Returns true if window trace is enabled. 550 */ isWindowTraceEnabled()551 boolean isWindowTraceEnabled(); 552 553 /** 554 * Notify WindowManager that it should not override the info in DisplayManager for the specified 555 * display. This can disable letter- or pillar-boxing applied in DisplayManager when the metrics 556 * of the logical display reported from WindowManager do not correspond to the metrics of the 557 * physical display it is based on. 558 * 559 * @param displayId The id of the display. 560 */ dontOverrideDisplayInfo(int displayId)561 void dontOverrideDisplayInfo(int displayId); 562 563 /** 564 * Gets the windowing mode of the display. 565 * 566 * @param displayId The id of the display. 567 * @return {@link WindowConfiguration.WindowingMode} 568 */ getWindowingMode(int displayId)569 int getWindowingMode(int displayId); 570 571 /** 572 * Sets the windowing mode of the display. 573 * 574 * @param displayId The id of the display. 575 * @param mode {@link WindowConfiguration.WindowingMode} 576 */ setWindowingMode(int displayId, int mode)577 void setWindowingMode(int displayId, int mode); 578 579 /** 580 * Gets current remove content mode of the display. 581 * <p> 582 * What actions should be performed with the display's content when it is removed. Default 583 * behavior for public displays in this case is to move all activities to the primary display 584 * and make it focused. For private display is to destroy all activities. 585 * </p> 586 * 587 * @param displayId The id of the display. 588 * @return The remove content mode of the display. 589 * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY 590 * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY 591 */ getRemoveContentMode(int displayId)592 int getRemoveContentMode(int displayId); 593 594 /** 595 * Sets the remove content mode of the display. 596 * <p> 597 * This mode indicates what actions should be performed with the display's content when it is 598 * removed. 599 * </p> 600 * 601 * @param displayId The id of the display. 602 * @param mode Remove content mode. 603 * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY 604 * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY 605 */ setRemoveContentMode(int displayId, int mode)606 void setRemoveContentMode(int displayId, int mode); 607 608 /** 609 * Indicates that the display should show its content when non-secure keyguard is shown. 610 * <p> 611 * This flag identifies secondary displays that will continue showing content if keyguard can be 612 * dismissed without entering credentials. 613 * </p><p> 614 * An example of usage is a virtual display which content is displayed on external hardware 615 * display that is not visible to the system directly. 616 * </p> 617 * 618 * @param displayId The id of the display. 619 * @return {@code true} if the display should show its content when non-secure keyguard is 620 * shown. 621 * @see KeyguardManager#isDeviceSecure() 622 * @see KeyguardManager#isDeviceLocked() 623 */ shouldShowWithInsecureKeyguard(int displayId)624 boolean shouldShowWithInsecureKeyguard(int displayId); 625 626 /** 627 * Sets that the display should show its content when non-secure keyguard is shown. 628 * 629 * @param displayId The id of the display. 630 * @param shouldShow Indicates that the display should show its content when non-secure keyguard 631 * is shown. 632 * @see KeyguardManager#isDeviceSecure() 633 * @see KeyguardManager#isDeviceLocked() 634 */ setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow)635 void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow); 636 637 /** 638 * Indicates the display should show system decors. 639 * <p> 640 * System decors include status bar, navigation bar, launcher. 641 * </p> 642 * 643 * @param displayId The id of the display. 644 * @return {@code true} if the display should show system decors. 645 */ shouldShowSystemDecors(int displayId)646 boolean shouldShowSystemDecors(int displayId); 647 648 /** 649 * Sets that the display should show system decors. 650 * <p> 651 * System decors include status bar, navigation bar, launcher. 652 * </p> 653 * 654 * @param displayId The id of the display. 655 * @param shouldShow Indicates that the display should show system decors. 656 */ setShouldShowSystemDecors(int displayId, boolean shouldShow)657 void setShouldShowSystemDecors(int displayId, boolean shouldShow); 658 659 /** 660 * Indicates that the display should show IME. 661 * 662 * @param displayId The id of the display. 663 * @return {@code true} if the display should show IME. 664 * @see KeyguardManager#isDeviceSecure() 665 * @see KeyguardManager#isDeviceLocked() 666 */ shouldShowIme(int displayId)667 boolean shouldShowIme(int displayId); 668 669 /** 670 * Sets that the display should show IME. 671 * 672 * @param displayId The id of the display. 673 * @param shouldShow Indicates that the display should show IME. 674 * @see KeyguardManager#isDeviceSecure() 675 * @see KeyguardManager#isDeviceLocked() 676 */ setShouldShowIme(int displayId, boolean shouldShow)677 void setShouldShowIme(int displayId, boolean shouldShow); 678 679 /** 680 * Waits for transactions to get applied before injecting input. 681 * This includes waiting for the input windows to get sent to InputManager. 682 * 683 * This is needed for testing since the system add windows and injects input 684 * quick enough that the windows don't have time to get sent to InputManager. 685 */ injectInputAfterTransactionsApplied(in InputEvent ev, int mode)686 boolean injectInputAfterTransactionsApplied(in InputEvent ev, int mode); 687 688 /** 689 * Waits until all animations have completed and input information has been sent from 690 * WindowManager to native InputManager. 691 * 692 * This is needed for testing since we need to ensure input information has been propagated to 693 * native InputManager before proceeding with tests. 694 */ syncInputTransactions()695 void syncInputTransactions(); 696 697 /** 698 * Returns whether SurfaceFlinger layer tracing is enabled. 699 */ isLayerTracing()700 boolean isLayerTracing(); 701 702 /** 703 * Enables/disables SurfaceFlinger layer tracing. 704 */ setLayerTracing(boolean enabled)705 void setLayerTracing(boolean enabled); 706 707 /** 708 * Mirrors a specified display. The root of the mirrored hierarchy will be stored in 709 * outSurfaceControl. 710 * Requires the ACCESS_SURFACE_FLINGER permission. 711 * 712 * @param displayId The id of the display to mirror 713 * @param outSurfaceControl The SurfaceControl for the root of the mirrored hierarchy. 714 * 715 * @return true if the display was successfully mirrored. 716 */ mirrorDisplay(int displayId, out SurfaceControl outSurfaceControl)717 boolean mirrorDisplay(int displayId, out SurfaceControl outSurfaceControl); 718 719 /** 720 * When in multi-window mode, the provided displayWindowInsetsController will control insets 721 * animations. 722 */ setDisplayWindowInsetsController( int displayId, in IDisplayWindowInsetsController displayWindowInsetsController)723 void setDisplayWindowInsetsController( 724 int displayId, in IDisplayWindowInsetsController displayWindowInsetsController); 725 726 /** 727 * Called when a remote process modifies insets on a display window container. 728 */ modifyDisplayWindowInsets(int displayId, in InsetsState state)729 void modifyDisplayWindowInsets(int displayId, in InsetsState state); 730 731 /** 732 * Called to get the expected window insets. 733 * 734 * @return {@code true} if system bars are always comsumed. 735 */ getWindowInsets(in WindowManager.LayoutParams attrs, int displayId, out Rect outContentInsets, out Rect outStableInsets, out DisplayCutout.ParcelableWrapper outDisplayCutout, out InsetsState outInsetsState)736 boolean getWindowInsets(in WindowManager.LayoutParams attrs, int displayId, 737 out Rect outContentInsets, out Rect outStableInsets, 738 out DisplayCutout.ParcelableWrapper outDisplayCutout, out InsetsState outInsetsState); 739 740 /** 741 * Called to show global actions. 742 */ showGlobalActions()743 void showGlobalActions(); 744 745 /** 746 * Sets layer tracing flags for SurfaceFlingerTrace. 747 * 748 * @param flags see definition in SurfaceTracing.cpp 749 */ setLayerTracingFlags(int flags)750 void setLayerTracingFlags(int flags); 751 752 /** 753 * Forwards a scroll capture request to the appropriate window, if available. 754 * 755 * @param displayId the id of the display to target 756 * @param behindClient token for a window, used to filter the search to windows behind it, or 757 * {@code null} to accept a window at any zOrder 758 * @param taskId specifies the id of a task the result must belong to, or -1 to ignore task ids 759 * @param controller the controller to receive results, a call to either 760 * {@link IScrollCaptureController#onClientConnected} or 761 * {@link IScrollCaptureController#onClientUnavailable}. 762 */ requestScrollCapture(int displayId, IBinder behindClient, int taskId, IScrollCaptureController controller)763 void requestScrollCapture(int displayId, IBinder behindClient, int taskId, 764 IScrollCaptureController controller); 765 } 766