• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.IKeyguardLockedStateListener;
22 import com.android.internal.policy.IShortcutService;
23 
24 import android.app.IApplicationThread;
25 import android.app.IAssistDataReceiver;
26 import android.content.ComponentName;
27 import android.content.res.CompatibilityInfo;
28 import android.content.res.Configuration;
29 import android.graphics.Bitmap;
30 import android.graphics.GraphicBuffer;
31 import android.graphics.Point;
32 import android.graphics.Rect;
33 import android.graphics.Region;
34 import android.os.Bundle;
35 import android.os.IRemoteCallback;
36 import android.os.ParcelFileDescriptor;
37 import android.view.DisplayCutout;
38 import android.view.DisplayInfo;
39 import android.view.IAppTransitionAnimationSpecsFuture;
40 import android.view.ICrossWindowBlurEnabledListener;
41 import android.view.IDisplayWindowInsetsController;
42 import android.view.IDisplayWindowListener;
43 import android.view.IDisplayFoldListener;
44 import android.view.IDisplayChangeWindowController;
45 import android.view.IOnKeyguardExitResult;
46 import android.view.IPinnedTaskListener;
47 import android.view.IScrollCaptureResponseListener;
48 import android.view.RemoteAnimationAdapter;
49 import android.view.IRotationWatcher;
50 import android.view.ISystemGestureExclusionListener;
51 import android.view.IDecorViewGestureListener;
52 import android.view.IWallpaperVisibilityListener;
53 import android.view.IWindow;
54 import android.view.IWindowSession;
55 import android.view.IWindowSessionCallback;
56 import android.view.KeyboardShortcutGroup;
57 import android.view.KeyEvent;
58 import android.view.InputEvent;
59 import android.view.InsetsState;
60 import android.view.MagnificationSpec;
61 import android.view.MotionEvent;
62 import android.view.InputChannel;
63 import android.view.InputDevice;
64 import android.view.IInputFilter;
65 import android.view.inputmethod.ImeTracker;
66 import android.view.AppTransitionAnimationSpec;
67 import android.view.WindowContentFrameStats;
68 import android.view.WindowManager;
69 import android.view.SurfaceControl;
70 import android.view.displayhash.DisplayHash;
71 import android.view.displayhash.VerifiedDisplayHash;
72 import android.window.AddToSurfaceSyncGroupResult;
73 import android.window.ConfigurationChangeSetting;
74 import android.window.IGlobalDragListener;
75 import android.window.IScreenRecordingCallback;
76 import android.window.ISurfaceSyncGroupCompletedListener;
77 import android.window.ITaskFpsCallback;
78 import android.window.ITrustedPresentationListener;
79 import android.window.InputTransferToken;
80 import android.window.ScreenCapture;
81 import android.window.TrustedPresentationThresholds;
82 import android.window.WindowContextInfo;
83 
84 /**
85  * System private interface to the window manager.
86  *
87  * {@hide}
88  */
89 interface IWindowManager
90 {
91     /**
92      * No overridden behavior is provided in terms of fixing rotation to user rotation. Use
93      * other flags to derive the default behavior, such as {@link WindowManagerService#mIsPc}
94      * and {@link WindowManagerService#mForceDesktopModeOnExternalDisplays}.
95      */
96     const int FIXED_TO_USER_ROTATION_DEFAULT = 0;
97     /**
98      * Don't fix display rotation to {@link DisplayRotation#mUserRotation} only. Always allow
99      * other factors to play a role in deciding display rotation.
100      */
101     const int FIXED_TO_USER_ROTATION_DISABLED = 1;
102     /**
103      * Only use {@link DisplayRotation#mUserRotation} as the display rotation.
104      */
105     const int FIXED_TO_USER_ROTATION_ENABLED = 2;
106     /**
107      * If auto-rotation is not supported, {@link DisplayRotation#mUserRotation} will be used.
108      * Otherwise the behavior is same as {link #FIXED_TO_USER_ROTATION_DISABLED}.
109      */
110     const int FIXED_TO_USER_ROTATION_IF_NO_AUTO_ROTATION = 3;
111 
112     /**
113      * ===== NOTICE =====
114      * The first three methods must remain the first three methods. Scripts
115      * and tools rely on their transaction number to work properly.
116      */
117     // This is used for debugging
startViewServer(int port)118     boolean startViewServer(int port);   // Transaction #1
stopViewServer()119     boolean stopViewServer();            // Transaction #2
isViewServerRunning()120     boolean isViewServerRunning();       // Transaction #3
121 
openSession(in IWindowSessionCallback callback)122     IWindowSession openSession(in IWindowSessionCallback callback);
123 
124     @UnsupportedAppUsage
getInitialDisplaySize(int displayId, out Point size)125     void getInitialDisplaySize(int displayId, out Point size);
126     @UnsupportedAppUsage
getBaseDisplaySize(int displayId, out Point size)127     void getBaseDisplaySize(int displayId, out Point size);
128     @EnforcePermission("WRITE_SECURE_SETTINGS")
setForcedDisplaySize(int displayId, int width, int height)129     void setForcedDisplaySize(int displayId, int width, int height);
130     @EnforcePermission("WRITE_SECURE_SETTINGS")
clearForcedDisplaySize(int displayId)131     void clearForcedDisplaySize(int displayId);
132     @UnsupportedAppUsage
getInitialDisplayDensity(int displayId)133     int getInitialDisplayDensity(int displayId);
getBaseDisplayDensity(int displayId)134     int getBaseDisplayDensity(int displayId);
getDisplayIdByUniqueId(String uniqueId)135     int getDisplayIdByUniqueId(String uniqueId);
136     @EnforcePermission("WRITE_SECURE_SETTINGS")
setForcedDisplayDensityForUser(int displayId, int density, int userId)137     void setForcedDisplayDensityForUser(int displayId, int density, int userId);
138     /**
139     * Clears forced density and forced density ratio in DisplayWindowSettings for the given
140     * displayId.
141     *
142     * @param displayId Id of the display.
143     * @param userId Id of the user.
144     */
145     @EnforcePermission("WRITE_SECURE_SETTINGS")
clearForcedDisplayDensityForUser(int displayId, int userId)146     void clearForcedDisplayDensityForUser(int displayId, int userId);
147     /**
148     * Sets display forced density ratio and forced density in DisplayWindowSettings for
149     * the given displayId. Ratio is used to update forced density to persist display size when
150     * resolution change happens. Use {@link #setForcedDisplayDensityForUser} when there is no need
151     * to handle resolution changes for the display. If setForcedDisplayDensityForUser is used after,
152     * this the ratio will be updated to use the last set forced density. Use
153     * {@link #clearForcedDisplayDensityForUser} to reset.
154     *
155     * @param displayId Id of the display.
156     * @param ratio The ratio of forced density to the default density.
157     * @param userId Id of the user.
158     */
159     @EnforcePermission("WRITE_SECURE_SETTINGS")
setForcedDisplayDensityRatio(int displayId, float ratio, int userId)160     void setForcedDisplayDensityRatio(int displayId, float ratio, int userId);
161 
162     /**
163      * Sets settings for a specific user in a batch to minimize configuration updates.
164      *
165      * <p>This method allows for applying multiple settings changes as a batch, which can
166      * help avoid multiple configuration updates.
167      *
168      * @param settings list of {@link android.window.ConfigurationChangeSetting} objects
169      *                 representing the settings to be applied.
170      * @param userId   the ID of the user whose settings should be applied.
171      * @throws SecurityException if the caller does not have the {@link WRITE_SECURE_SETTINGS}
172      *                           permission.
173      * @hide
174      */
175     @EnforcePermission("WRITE_SECURE_SETTINGS")
setConfigurationChangeSettingsForUser( in List<ConfigurationChangeSetting> settings, int userId)176     void setConfigurationChangeSettingsForUser(
177             in List<ConfigurationChangeSetting> settings, int userId);
178 
179     @EnforcePermission("WRITE_SECURE_SETTINGS")
setForcedDisplayScalingMode(int displayId, int mode)180     void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable
181 
182     // These can only be called when holding the MANAGE_APP_TOKENS permission.
setEventDispatching(boolean enabled)183     void setEventDispatching(boolean enabled);
184 
185     /** Returns {@code true} if this binder is a registered window token. */
isWindowToken(in IBinder binder)186     boolean isWindowToken(in IBinder binder);
187     /**
188      * Adds window token for a given type.
189      *
190      * @param token Token to be registered.
191      * @param type Window type to be used with this token.
192      * @param displayId The ID of the display where this token should be added.
193      * @param options A bundle used to pass window-related options.
194      */
addWindowToken(IBinder token, int type, int displayId, in Bundle options)195     void addWindowToken(IBinder token, int type, int displayId, in Bundle options);
196     /**
197      * Remove window token on a specific display.
198      *
199      * @param token Token to be removed
200      * @displayId The ID of the display where this token should be removed.
201      */
removeWindowToken(IBinder token, int displayId)202     void removeWindowToken(IBinder token, int displayId);
203 
204     /**
205      * Sets a singular remote controller of display rotations. There can only be one. The
206      * controller is called after the display has "frozen" for a rotation and display rotation will
207      * only continue once the controller has finished calculating associated configurations.
208      */
setDisplayChangeWindowController(IDisplayChangeWindowController controller)209     void setDisplayChangeWindowController(IDisplayChangeWindowController controller);
210 
211     /**
212      * Adds a root container that a client shell can populate with its own windows (usually via
213      * WindowlessWindowManager).
214      *
215      * @param client an IWindow used for window-level communication (ime, finish draw, etc.).
216      * @param shellRootLayer The container's layer. See WindowManager#ShellRootLayer.
217      * @return a SurfaceControl to add things to.
218      */
219     @EnforcePermission("MANAGE_APP_TOKENS")
addShellRoot(int displayId, IWindow client, int shellRootLayer)220     SurfaceControl addShellRoot(int displayId, IWindow client, int shellRootLayer);
221 
222     /**
223      * Sets the window token sent to accessibility for a particular shell root. The
224      * displayId and windowType identify which shell-root to update.
225      *
226      * @param target The IWindow that accessibility service interfaces with.
227      */
228     @EnforcePermission("MANAGE_APP_TOKENS")
setShellRootAccessibilityWindow(int displayId, int shellRootLayer, IWindow target)229     void setShellRootAccessibilityWindow(int displayId, int shellRootLayer, IWindow target);
230 
231     /**
232      * Like overridePendingAppTransitionMultiThumb, but uses a future to supply the specs. This is
233      * used for recents, where generating the thumbnails of the specs takes a non-trivial amount of
234      * time, so we want to move that off the critical path for starting the new activity.
235      */
236     @UnsupportedAppUsage
overridePendingAppTransitionMultiThumbFuture( IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback, boolean scaleUp, int displayId)237     void overridePendingAppTransitionMultiThumbFuture(
238             IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
239             boolean scaleUp, int displayId);
240     @UnsupportedAppUsage
overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter, int displayId)241     void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter,
242             int displayId);
243 
244     /**
245       * Used by system ui to report that recents has shown itself.
246       * @deprecated to be removed once prebuilts are updated
247       */
248     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
endProlongedAnimations()249     void endProlongedAnimations();
250 
251     // these require DISABLE_KEYGUARD permission
252     /** @deprecated use Activity.setShowWhenLocked instead. */
disableKeyguard(IBinder token, String tag, int userId)253     void disableKeyguard(IBinder token, String tag, int userId);
254     /** @deprecated use Activity.setShowWhenLocked instead. */
reenableKeyguard(IBinder token, int userId)255     void reenableKeyguard(IBinder token, int userId);
256     @EnforcePermission("DISABLE_KEYGUARD")
exitKeyguardSecurely(IOnKeyguardExitResult callback)257     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
258     @UnsupportedAppUsage
isKeyguardLocked()259     boolean isKeyguardLocked();
260     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
isKeyguardSecure(int userId)261     boolean isKeyguardSecure(int userId);
dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message)262     void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message);
263 
264     @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
265             + ".permission.SUBSCRIBE_TO_KEYGUARD_LOCKED_STATE)")
addKeyguardLockedStateListener(in IKeyguardLockedStateListener listener)266     void addKeyguardLockedStateListener(in IKeyguardLockedStateListener listener);
267 
268     @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
269             + ".permission.SUBSCRIBE_TO_KEYGUARD_LOCKED_STATE)")
removeKeyguardLockedStateListener(in IKeyguardLockedStateListener listener)270     void removeKeyguardLockedStateListener(in IKeyguardLockedStateListener listener);
271 
272     // Requires INTERACT_ACROSS_USERS_FULL permission
setSwitchingUser(boolean switching)273     void setSwitchingUser(boolean switching);
274 
closeSystemDialogs(String reason)275     void closeSystemDialogs(String reason);
276 
277     // These can only be called with the SET_ANIMATON_SCALE permission.
278     @UnsupportedAppUsage
getAnimationScale(int which)279     float getAnimationScale(int which);
280     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
getAnimationScales()281     float[] getAnimationScales();
282     @UnsupportedAppUsage
setAnimationScale(int which, float scale)283     void setAnimationScale(int which, float scale);
284     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
setAnimationScales(in float[] scales)285     void setAnimationScales(in float[] scales);
286 
getCurrentAnimatorScale()287     float getCurrentAnimatorScale();
288 
289     // Request to change the touch mode on the display represented by the displayId parameter.
290     //
291     // If com.android.internal.R.bool.config_perDisplayFocusEnabled is false, then it will request
292     // to change the touch mode on all displays (disregarding displayId parameter).
setInTouchMode(boolean inTouch, int displayId)293     void setInTouchMode(boolean inTouch, int displayId);
294 
295     // Request to change the touch mode on all displays (disregarding the value
296     // com.android.internal.R.bool.config_perDisplayFocusEnabled).
setInTouchModeOnAllDisplays(boolean inTouch)297     void setInTouchModeOnAllDisplays(boolean inTouch);
298 
299     // Returns the touch mode state for the display represented by the displayId parameter.
isInTouchMode(int displayId)300     boolean isInTouchMode(int displayId);
301 
302     // For StrictMode flashing a red border on violations from the UI
303     // thread.  The uid/pid is implicit from the Binder call, and the Window
304     // Manager uses that to determine whether or not the red border should
305     // actually be shown.  (it will be ignored that pid doesn't have windows
306     // on screen)
307     @UnsupportedAppUsage(maxTargetSdk = 28)
showStrictModeViolation(boolean on)308     void showStrictModeViolation(boolean on);
309 
310     // Proxy to set the system property for whether the flashing
311     // should be enabled.  The 'enabled' value is null or blank for
312     // the system default (differs per build variant) or any valid
313     // boolean string as parsed by SystemProperties.getBoolean().
314     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
setStrictModeVisualIndicatorPreference(String enabled)315     void setStrictModeVisualIndicatorPreference(String enabled);
316 
317     /**
318      * Set whether screen capture is disabled for all windows of a specific user from
319      * the device policy cache.
320      */
refreshScreenCaptureDisabled()321     void refreshScreenCaptureDisabled();
322 
323     /**
324      * Retrieve the current orientation of the primary screen.
325      * @return Constant as per {@link android.view.Surface.Rotation}.
326      *
327      * @see android.view.Display#DEFAULT_DISPLAY
328      */
getDefaultDisplayRotation()329     int getDefaultDisplayRotation();
330 
331     /**
332      * Retrieve the display user rotation.
333      * @param displayId Id of the display
334      * @return Rotation one of {@link android.view.Surface#ROTATION_0},
335      *        {@link android.view.Surface#ROTATION_90}, {@link android.view.Surface#ROTATION_180},
336      *        {@link android.view.Surface#ROTATION_270} or -1 if display is not found.
337      */
getDisplayUserRotation(int displayId)338     int getDisplayUserRotation(int displayId);
339 
340     /**
341      * Watch the rotation of the specified screen.  Returns the current rotation,
342      * calls back when it changes.
343      */
watchRotation(IRotationWatcher watcher, int displayId)344     int watchRotation(IRotationWatcher watcher, int displayId);
345 
346     /**
347      * Remove a rotation watcher set using watchRotation.
348      * @hide
349      */
350     @UnsupportedAppUsage
removeRotationWatcher(IRotationWatcher watcher)351     void removeRotationWatcher(IRotationWatcher watcher);
352 
353     /** Registers the listener to the context token and returns the current proposed rotation. */
registerProposedRotationListener(IBinder contextToken, IRotationWatcher listener)354     int registerProposedRotationListener(IBinder contextToken, IRotationWatcher listener);
355 
356     /**
357      * Determine the preferred edge of the screen to pin the compact options menu against.
358      *
359      * @param displayId Id of the display where the menu window currently resides.
360      * @return a Gravity value for the options menu panel.
361      * @hide
362      */
getPreferredOptionsPanelGravity(int displayId)363     int getPreferredOptionsPanelGravity(int displayId);
364 
365     /**
366      * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link
367      * android.view.Display#DEFAULT_DISPLAY} and given rotation.
368      */
369     @UnsupportedAppUsage
freezeRotation(int rotation, String caller)370     void freezeRotation(int rotation, String caller);
371 
372     /**
373      * Equivalent to calling {@link #thawDisplayRotation(int)} with {@link
374      * android.view.Display#DEFAULT_DISPLAY}.
375      */
376     @UnsupportedAppUsage
thawRotation(String caller)377     void thawRotation(String caller);
378 
379     /**
380      * Equivelant to call {@link #isDisplayRotationFrozen(int)} with {@link
381      * android.view.Display#DEFAULT_DISPLAY}.
382      */
isRotationFrozen()383     boolean isRotationFrozen();
384 
385     /**
386      * Lock the display orientation to the specified rotation, or to the current
387      * rotation if -1. Sensor input will be ignored until thawRotation() is called.
388      *
389      * @param displayId the ID of display which rotation should be frozen.
390      * @param rotation one of {@link android.view.Surface#ROTATION_0},
391      *        {@link android.view.Surface#ROTATION_90}, {@link android.view.Surface#ROTATION_180},
392      *        {@link android.view.Surface#ROTATION_270} or -1 to freeze it to current rotation.
393      * @hide
394      */
freezeDisplayRotation(int displayId, int rotation, String caller)395     void freezeDisplayRotation(int displayId, int rotation, String caller);
396 
397     /**
398      * Release the orientation lock imposed by freezeRotation() on the display.
399      *
400      * @param displayId the ID of display which rotation should be thawed.
401      * @hide
402      */
thawDisplayRotation(int displayId, String caller)403     void thawDisplayRotation(int displayId, String caller);
404 
405     /**
406      * Gets whether the rotation is frozen on the display.
407      *
408      * @param displayId the ID of display which frozen is needed.
409      * @return Whether the rotation is frozen.
410      */
isDisplayRotationFrozen(int displayId)411     boolean isDisplayRotationFrozen(int displayId);
412 
413    /**
414     *  Sets if display rotation is fixed to user specified value for given displayId.
415     */
setFixedToUserRotation(int displayId, int fixedToUserRotation)416     void setFixedToUserRotation(int displayId, int fixedToUserRotation);
417 
418    /**
419     *  Sets if all requested fixed orientation should be ignored for given displayId.
420     */
setIgnoreOrientationRequest(int displayId, boolean ignoreOrientationRequest)421     void setIgnoreOrientationRequest(int displayId, boolean ignoreOrientationRequest);
422 
423     /**
424      * Screenshot the current wallpaper layer, including the whole screen.
425      */
screenshotWallpaper()426     Bitmap screenshotWallpaper();
427 
428     /**
429      * Mirrors the wallpaper for the given display.
430      *
431      * @param displayId ID of the display for the wallpaper.
432      * @return A SurfaceControl for the parent of the mirrored wallpaper.
433      */
mirrorWallpaperSurface(int displayId)434     SurfaceControl mirrorWallpaperSurface(int displayId);
435 
436     /**
437      * Registers a wallpaper visibility listener.
438      * @return Current visibility.
439      */
registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener, int displayId)440     boolean registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
441         int displayId);
442 
443     /**
444      * Remove a visibility watcher that was added using registerWallpaperVisibilityListener.
445      */
unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener, int displayId)446     void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
447         int displayId);
448 
449     /**
450      * Registers a system gesture exclusion listener for a given display.
451      */
registerSystemGestureExclusionListener(ISystemGestureExclusionListener listener, int displayId)452     void registerSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
453         int displayId);
454 
455     /**
456      * Unregisters a system gesture exclusion listener for a given display.
457      */
unregisterSystemGestureExclusionListener(ISystemGestureExclusionListener listener, int displayId)458     void unregisterSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
459         int displayId);
460 
461     /**
462      * Used only for assist -- request a screenshot of the current application.
463      */
requestAssistScreenshot(IAssistDataReceiver receiver)464     boolean requestAssistScreenshot(IAssistDataReceiver receiver);
465 
466     /**
467      * Called by System UI to notify Window Manager to hide transient bars.
468      */
hideTransientBars(int displayId)469     oneway void hideTransientBars(int displayId);
470 
471     /**
472      * Called by System UI to notify of changes to the visibility of Recents.
473      */
setRecentsVisibility(boolean visible)474     oneway void setRecentsVisibility(boolean visible);
475 
476     /**
477     * Called by System UI to indicate the maximum bounds of the system Privacy Indicator, for the
478     * current orientation, whether the indicator is showing or not. Should be an array of length
479     * 4, with the bounds for ROTATION_0, 90, 180, and 270, in that order.
480     */
updateStaticPrivacyIndicatorBounds(int displayId, in Rect[] staticBounds)481      oneway void updateStaticPrivacyIndicatorBounds(int displayId, in Rect[] staticBounds);
482 
483     /**
484      * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
485      */
486     @EnforcePermission("STATUS_BAR")
487     @UnsupportedAppUsage
setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled)488     void setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled);
489 
490     /**
491      * Device has a software navigation bar (separate from the status bar) on specific display.
492      *
493      * @param displayId the id of display to check if there is a software navigation bar.
494      */
495     @UnsupportedAppUsage
hasNavigationBar(int displayId)496     boolean hasNavigationBar(int displayId);
497 
498     /**
499      * Lock the device immediately with the specified options (can be null).
500      */
501     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
lockNow(in Bundle options)502     void lockNow(in Bundle options);
503 
504     /**
505      * Device is in safe mode.
506      */
507     @UnsupportedAppUsage
isSafeModeEnabled()508     boolean isSafeModeEnabled();
509 
510     /**
511      * Clears the frame statistics for a given window.
512      *
513      * @param token The window token.
514      * @return Whether the frame statistics were cleared.
515      */
clearWindowContentFrameStats(IBinder token)516     boolean clearWindowContentFrameStats(IBinder token);
517 
518     /**
519      * Gets the content frame statistics for a given window.
520      *
521      * @param token The window token.
522      * @return The frame statistics or null if the window does not exist.
523      */
getWindowContentFrameStats(IBinder token)524     WindowContentFrameStats getWindowContentFrameStats(IBinder token);
525 
526     /**
527      * This is a no-op.
528      */
529     @UnsupportedAppUsage
getDockedStackSide()530     int getDockedStackSide();
531 
532     /**
533      * Registers a listener that will be called when the pinned task state changes.
534      */
registerPinnedTaskListener(int displayId, IPinnedTaskListener listener)535     void registerPinnedTaskListener(int displayId, IPinnedTaskListener listener);
536 
537     /**
538      * Requests Keyboard Shortcuts from the displayed window.
539      *
540      * @param receiver The receiver to deliver the results to.
541      * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's
542      *                 not triggered by a KeyEvent.
543      * @see #requestImeKeyboardShortcuts(IResultReceiver, int)
544      */
requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId)545     void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId);
546 
547     /**
548      * Requests Keyboard Shortcuts from currently selected IME.
549      *
550      * @param receiver The receiver to deliver the results to.
551      * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's
552      *                 not triggered by a KeyEvent.
553      * @see #requestAppKeyboardShortcuts(IResultReceiver, int)
554      */
requestImeKeyboardShortcuts(IResultReceiver receiver, int deviceId)555     void requestImeKeyboardShortcuts(IResultReceiver receiver, int deviceId);
556 
557     /**
558      * Retrieves the current stable insets from the primary display.
559      */
560     @UnsupportedAppUsage
getStableInsets(int displayId, out Rect outInsets)561     void getStableInsets(int displayId, out Rect outInsets);
562 
563     /**
564      * Register shortcut key. Shortcut code is packed as:
565      * (MetaState << Integer.SIZE) | KeyCode
566      * @hide
567      */
registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber)568     void registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber);
569 
570     /**
571      * Create an input consumer by name and display id.
572      */
573     @UnsupportedAppUsage
createInputConsumer(IBinder token, String name, int displayId, out InputChannel inputChannel)574     void createInputConsumer(IBinder token, String name, int displayId,
575         out InputChannel inputChannel);
576 
577     /**
578      * Destroy an input consumer by token and display id.
579      * This method will also dispose the input channels associated with that InputConsumer.
580      */
581     @UnsupportedAppUsage
destroyInputConsumer(IBinder token, int displayId)582     boolean destroyInputConsumer(IBinder token, int displayId);
583 
584     /**
585      * Return the touch region for the current IME window, or an empty region if there is none.
586      */
587     @EnforcePermission("RESTRICTED_VR_ACCESS")
getCurrentImeTouchRegion()588     Region getCurrentImeTouchRegion();
589 
590     /**
591      * Registers an IDisplayFoldListener.
592      */
registerDisplayFoldListener(IDisplayFoldListener listener)593     void registerDisplayFoldListener(IDisplayFoldListener listener);
594 
595     /**
596      * Unregisters an IDisplayFoldListener.
597      */
unregisterDisplayFoldListener(IDisplayFoldListener listener)598     void unregisterDisplayFoldListener(IDisplayFoldListener listener);
599 
600     /**
601      * Registers an IDisplayContainerListener, and returns the set of existing display ids. The
602      * listener's onDisplayAdded() will not be called for the displays returned.
603      */
registerDisplayWindowListener(IDisplayWindowListener listener)604     int[] registerDisplayWindowListener(IDisplayWindowListener listener);
605 
606     /**
607      * Unregisters an IDisplayContainerListener.
608      */
unregisterDisplayWindowListener(IDisplayWindowListener listener)609     void unregisterDisplayWindowListener(IDisplayWindowListener listener);
610 
611     /**
612      * Starts a window trace.
613      */
startWindowTrace()614     void startWindowTrace();
615 
616     /**
617      * Stops a window trace.
618      */
stopWindowTrace()619     void stopWindowTrace();
620 
621     /**
622     * If window tracing is active, saves the window trace to file, otherwise does nothing
623     */
saveWindowTraceToFile()624     void saveWindowTraceToFile();
625 
626     /**
627      * Returns true if window trace is enabled.
628      */
isWindowTraceEnabled()629     boolean isWindowTraceEnabled();
630 
631     /**
632      * Starts a transition trace.
633      */
startTransitionTrace()634     void startTransitionTrace();
635 
636     /**
637      * Stops a transition trace.
638      */
stopTransitionTrace()639     void stopTransitionTrace();
640 
641     /**
642      * Returns true if transition trace is enabled.
643      */
isTransitionTraceEnabled()644     boolean isTransitionTraceEnabled();
645 
646     /**
647      * Gets the windowing mode of the display.
648      *
649      * @param displayId The id of the display.
650      * @return {@link WindowConfiguration.WindowingMode}
651      */
getWindowingMode(int displayId)652     int getWindowingMode(int displayId);
653 
654     /**
655      * Sets the windowing mode of the display.
656      *
657      * @param displayId The id of the display.
658      * @param mode {@link WindowConfiguration.WindowingMode}
659      */
setWindowingMode(int displayId, int mode)660     void setWindowingMode(int displayId, int mode);
661 
662     /**
663      * Gets current remove content mode of the display.
664      * <p>
665      * What actions should be performed with the display's content when it is removed. Default
666      * behavior for public displays in this case is to move all activities to the primary display
667      * and make it focused. For private display is to destroy all activities.
668      * </p>
669      *
670      * @param displayId The id of the display.
671      * @return The remove content mode of the display.
672      * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
673      * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
674      */
getRemoveContentMode(int displayId)675     int getRemoveContentMode(int displayId);
676 
677     /**
678      * Sets the remove content mode of the display.
679      * <p>
680      * This mode indicates what actions should be performed with the display's content when it is
681      * removed.
682      * </p>
683      *
684      * @param displayId The id of the display.
685      * @param mode Remove content mode.
686      * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
687      * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
688      */
setRemoveContentMode(int displayId, int mode)689     void setRemoveContentMode(int displayId, int mode);
690 
691     /**
692      * Indicates that the display should show its content when non-secure keyguard is shown.
693      * <p>
694      * This flag identifies secondary displays that will continue showing content if keyguard can be
695      * dismissed without entering credentials.
696      * </p><p>
697      * An example of usage is a virtual display which content is displayed on external hardware
698      * display that is not visible to the system directly.
699      * </p>
700      *
701      * @param displayId The id of the display.
702      * @return {@code true} if the display should show its content when non-secure keyguard is
703      *         shown.
704      * @see KeyguardManager#isDeviceSecure()
705      * @see KeyguardManager#isDeviceLocked()
706      */
shouldShowWithInsecureKeyguard(int displayId)707     boolean shouldShowWithInsecureKeyguard(int displayId);
708 
709     /**
710      * Sets that the display should show its content when non-secure keyguard is shown.
711      *
712      * @param displayId The id of the display.
713      * @param shouldShow Indicates that the display should show its content when non-secure keyguard
714      *                  is shown.
715      * @see KeyguardManager#isDeviceSecure()
716      * @see KeyguardManager#isDeviceLocked()
717      */
setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow)718     void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow);
719 
720     /**
721      * Indicates the display should show system decors.
722      * <p>
723      * System decors include status bar, navigation bar, launcher, and wallpaper.
724      * </p>
725      *
726      * @param displayId The id of the display.
727      * @return {@code true} if the display should show system decors.
728      */
shouldShowSystemDecors(int displayId)729     boolean shouldShowSystemDecors(int displayId);
730 
731     /**
732      * Sets that the display should show system decors.
733      * <p>
734      * System decors include status bar, navigation bar, launcher.
735      * </p>
736      *
737      * @param displayId The id of the display.
738      * @param shouldShow Indicates that the display should show system decors.
739      */
setShouldShowSystemDecors(int displayId, boolean shouldShow)740     void setShouldShowSystemDecors(int displayId, boolean shouldShow);
741 
742     /**
743      * Indicates that the display is eligible for the desktop mode from WindowManager's perspective.
744      * This includes:
745      * - The default display;
746      * - Any display that is allowed to switch the content mode between extended and mirroring
747      * (which means it can dynamically add or remove system decors), and it is now in extended mode
748      * (should currently show system decors).
749      * <p>
750      * System decors include status bar, navigation bar, launcher, and wallpaper.
751      * </p>
752      *
753      * @param displayId The id of the display.
754      * @return {@code true} if the display is eligible for the desktop mode from WindowManager's
755      * perspective.
756      */
isEligibleForDesktopMode(int displayId)757     boolean isEligibleForDesktopMode(int displayId);
758 
759     /**
760      * Indicates the policy for how the display should show IME.
761      *
762      * @param displayId The id of the display.
763      * @return The policy for how the display should show IME.
764      * @see KeyguardManager#isDeviceSecure()
765      * @see KeyguardManager#isDeviceLocked()
766      */
getDisplayImePolicy(int displayId)767     int getDisplayImePolicy(int displayId);
768 
769     /**
770      * Sets the policy for how the display should show IME.
771      *
772      * @param displayId The id of the display.
773      * @param imePolicy Indicates the policy for how the display should show IME.
774      * @see KeyguardManager#isDeviceSecure()
775      * @see KeyguardManager#isDeviceLocked()
776      */
setDisplayImePolicy(int displayId, int imePolicy)777     void setDisplayImePolicy(int displayId, int imePolicy);
778 
779     /** Called when the expanded state of notification shade is changed. */
onNotificationShadeExpanded(IBinder token, boolean expanded)780     void onNotificationShadeExpanded(IBinder token, boolean expanded);
781 
782     /**
783      * Waits until input information has been sent from WindowManager to native InputManager,
784      * optionally waiting for animations to complete.
785      *
786      * This is needed for testing since we need to ensure input information has been propagated to
787      * native InputManager before proceeding with tests.
788      */
syncInputTransactions(boolean waitForAnimations)789     void syncInputTransactions(boolean waitForAnimations);
790 
791     /**
792      * Returns whether SurfaceFlinger layer tracing is enabled.
793      */
isLayerTracing()794     boolean isLayerTracing();
795 
796     /**
797      * Enables/disables SurfaceFlinger layer tracing.
798      */
setLayerTracing(boolean enabled)799     void setLayerTracing(boolean enabled);
800 
801     /**
802      * Mirrors a specified display. The root of the mirrored hierarchy will be stored in
803      * outSurfaceControl.
804      * Requires the ACCESS_SURFACE_FLINGER permission.
805      *
806      * @param displayId The id of the display to mirror
807      * @param outSurfaceControl The SurfaceControl for the root of the mirrored hierarchy.
808      *
809      * @return true if the display was successfully mirrored.
810      */
mirrorDisplay(int displayId, out SurfaceControl outSurfaceControl)811     boolean mirrorDisplay(int displayId, out SurfaceControl outSurfaceControl);
812 
813     /**
814      * When in multi-window mode, the provided displayWindowInsetsController will control insets
815      * animations.
816      */
817     @EnforcePermission("MANAGE_APP_TOKENS")
setDisplayWindowInsetsController( int displayId, in IDisplayWindowInsetsController displayWindowInsetsController)818     void setDisplayWindowInsetsController(
819             int displayId, in IDisplayWindowInsetsController displayWindowInsetsController);
820 
821     /**
822      * Called when a remote process updates the requested visibilities of insets on a display window
823      * container.
824      */
825     @EnforcePermission("MANAGE_APP_TOKENS")
updateDisplayWindowRequestedVisibleTypes(int displayId, int visibleTypes, int mask, in @nullable ImeTracker.Token statsToken)826     void updateDisplayWindowRequestedVisibleTypes(int displayId, int visibleTypes, int mask,
827             in @nullable ImeTracker.Token statsToken);
828 
829     /**
830      * Updates the currently animating insets types of a remote process.
831      */
832     @EnforcePermission("MANAGE_APP_TOKENS")
updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes, in @nullable ImeTracker.Token statsToken)833     void updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes,
834             in @nullable ImeTracker.Token statsToken);
835 
836     /**
837      * Called to get the expected window insets.
838      *
839      * @return {@code true} if system bars are always consumed.
840      */
getWindowInsets(int displayId, in IBinder token, out InsetsState outInsetsState)841     boolean getWindowInsets(int displayId, in IBinder token, out InsetsState outInsetsState);
842 
843     /**
844      * Returns a list of {@link android.view.DisplayInfo} for the logical display. This is not
845      * guaranteed to include all possible device states. The list items are unique.
846      *
847      * If invoked through a package other than a launcher app, returns an empty list.
848      *
849      * @param displayId the id of the logical display
850      */
getPossibleDisplayInfo(int displayId)851     List<DisplayInfo> getPossibleDisplayInfo(int displayId);
852 
853     /**
854      * Called to show global actions.
855      */
showGlobalActions()856     void showGlobalActions();
857 
858     /**
859      * Sets layer tracing flags for SurfaceFlingerTrace.
860      *
861      * @param flags see definition in SurfaceTracing.cpp
862      */
setLayerTracingFlags(int flags)863     void setLayerTracingFlags(int flags);
864 
865     /**
866      * Toggle active SurfaceFlinger transaction tracing.
867      */
setActiveTransactionTracing(boolean active)868     void setActiveTransactionTracing(boolean active);
869 
870     /**
871      * Forwards a scroll capture request to the appropriate window, if available.
872      *
873      * @param displayId the id of the display to target
874      * @param behindClient token for a window, used to filter the search to windows behind it, or
875      *                     {@code null} to accept a window at any zOrder
876      * @param taskId specifies the id of a task the result must belong to, or -1 to ignore task ids
877      * @param listener the object to receive the response
878      */
requestScrollCapture(int displayId, IBinder behindClient, int taskId, IScrollCaptureResponseListener listener)879     void requestScrollCapture(int displayId, IBinder behindClient, int taskId,
880             IScrollCaptureResponseListener listener);
881 
882     /**
883      * Holds the WM lock for the specified amount of milliseconds.
884      * Intended for use by the tests that need to imitate lock contention.
885      * The token should be obtained by
886      * {@link android.content.pm.PackageManager#getHoldLockToken()}.
887      */
holdLock(in IBinder token, in int durationMs)888     void holdLock(in IBinder token, in int durationMs);
889 
890     /**
891      * Gets an array of support hash algorithms that can be used to generate a DisplayHash. The
892      * String value of one algorithm should be used when requesting to generate
893      * the DisplayHash.
894      *
895      * @return a String array of supported hash algorithms.
896      */
getSupportedDisplayHashAlgorithms()897     String[] getSupportedDisplayHashAlgorithms();
898 
899     /**
900      * Validate the DisplayHash was generated by the system. The DisplayHash passed in should be
901      * the object generated when calling {@link IWindowSession#generateDisplayHash}
902      *
903      * @param DisplayHash The hash to verify that it was generated by the system.
904      * @return a {@link VerifiedDisplayHash} if the hash was generated by the system or null
905      * if the token cannot be verified.
906      */
verifyDisplayHash(in DisplayHash displayHash)907     VerifiedDisplayHash verifyDisplayHash(in DisplayHash displayHash);
908 
909     /**
910      * Call to enable or disable the throttling when generating a display hash. This should only be
911      * used for testing. Throttling is enabled by default.
912      *
913      * Must be called from a process that has {@link android.Manifest.permission#READ_FRAME_BUFFER}
914      * permission.
915      */
setDisplayHashThrottlingEnabled(boolean enable)916      void setDisplayHashThrottlingEnabled(boolean enable);
917 
918     /**
919      * Attaches a {@link android.window.WindowContext} to the DisplayArea specified by {@code type},
920      * {@code displayId} and {@code options}.
921      * <p>
922      * Note that this API should be invoked after calling
923      * {@link android.window.WindowTokenClient#attachContext(Context)}
924      * </p><p>
925      * Generally, this API is used for initializing a {@link android.window.WindowContext}
926      * before obtaining a valid {@link com.android.server.wm.WindowToken}. A WindowToken is usually
927      * generated when calling {@link android.view.WindowManager#addView(View, LayoutParams)}, or
928      * obtained from {@link android.view.WindowManager.LayoutParams#token}.
929      * </p><p>
930      * In some cases, the WindowToken is passed from the server side because it is managed by the
931      * system server. {@link #attachWindowContextToWindowToken(IBinder, IBinder)} could be used in
932      * this case to attach the WindowContext to the WindowToken.</p>
933      *
934      * @param appThread the process that the window context is on.
935      * @param clientToken {@link android.window.WindowContext#getWindowContextToken()
936      * the WindowContext's token}
937      * @param type Window type of the window context
938      * @param displayId The display associated with the window context
939      * @param options A bundle used to pass window-related options and choose the right DisplayArea
940      *
941      * @return the {@link WindowContextInfo} of the DisplayArea if the WindowContext is attached to
942      * the DisplayArea successfully. {@code null}, otherwise.
943      */
attachWindowContextToDisplayArea(in IApplicationThread appThread, IBinder clientToken, int type, int displayId, in @nullable Bundle options)944     @nullable WindowContextInfo attachWindowContextToDisplayArea(in IApplicationThread appThread,
945             IBinder clientToken, int type, int displayId, in @nullable Bundle options);
946 
947     /**
948      * Attaches a {@link android.window.WindowContext} to a {@code WindowToken}.
949      * <p>
950      * This API is used when we hold a valid WindowToken and want to associate with the token and
951      * receive its configuration updates.
952      * </p><p>
953      * Note that this API should be invoked after calling
954      * {@link android.window.WindowTokenClient#attachContext(Context)}
955      * </p>
956      *
957      * @param appThread the process that the window context is on.
958      * @param clientToken {@link android.window.WindowContext#getWindowContextToken()
959      * the WindowContext's token}
960      * @param token the WindowToken to attach
961      *
962      * @return the {@link WindowContextInfo} of the WindowToken if the WindowContext is attached to
963      * the WindowToken successfully. {@code null}, otherwise.
964      * @throws IllegalArgumentException if the {@code clientToken} have not been attached to
965      * the server or the WindowContext's type doesn't match WindowToken {@code token}'s type.
966      *
967      * @see #attachWindowContextToDisplayArea(IBinder, int, int, Bundle)
968      */
attachWindowContextToWindowToken(in IApplicationThread appThread, IBinder clientToken, IBinder token)969     @nullable WindowContextInfo  attachWindowContextToWindowToken(in IApplicationThread appThread,
970             IBinder clientToken, IBinder token);
971 
972     /**
973      * Attaches a {@code clientToken} to associate with DisplayContent.
974      * <p>
975      * Note that this API should be invoked after calling
976      * {@link android.window.WindowTokenClient#attachContext(Context)}
977      * </p>
978      *
979      * @param appThread the process that the window context is on.
980      * @param clientToken {@link android.window.WindowContext#getWindowContextToken()
981      * the WindowContext's token}
982      * @param displayId The display associated with the window context
983      *
984      * @return the {@link WindowContextInfo} of the DisplayContent if the WindowContext is attached
985      * to the DisplayContent successfully. {@code null}, otherwise.
986      * @throws android.view.WindowManager.InvalidDisplayException if the display ID is invalid
987      */
attachWindowContextToDisplayContent(in IApplicationThread appThread, IBinder clientToken, int displayId)988     @nullable WindowContextInfo attachWindowContextToDisplayContent(in IApplicationThread appThread,
989             IBinder clientToken, int displayId);
990 
991     /**
992      * Detaches {@link android.window.WindowContext} from the window manager node it's currently
993      * attached to. It is no-op if the WindowContext is not attached to a window manager node.
994      *
995      * @param clientToken the window context's token
996      */
detachWindowContext(IBinder clientToken)997     void detachWindowContext(IBinder clientToken);
998 
999     /**
1000      * Reparents the {@link android.window.WindowContext} to the
1001      * {@link com.android.server.wm.DisplayArea} on another display.
1002      * This method also reparent the WindowContext associated WindowToken to another display if
1003      * necessary.
1004      * <p>
1005      * {@code type} and {@code options} must be the same as the previous call of
1006      * {@link #attachWindowContextToDisplayArea} on the same Context otherwise this will fail
1007      * silently.
1008      *
1009      * @param appThread the process that the window context is on.
1010      * @param clientToken the window context's token
1011      * @param type The window type of the WindowContext
1012      * @param displayId The new display id this context windows should be parented to
1013      * @param options Bundle the context was created with
1014      *
1015      * @return True if the operation was successful, False otherwise.
1016      */
reparentWindowContextToDisplayArea(in IApplicationThread appThread, IBinder clientToken, int displayId)1017     boolean reparentWindowContextToDisplayArea(in IApplicationThread appThread,
1018                 IBinder clientToken, int displayId);
1019 
1020     /**
1021      * Registers a listener, which is to be called whenever cross-window blur is enabled/disabled.
1022      *
1023      * @param listener the listener to be registered
1024      * @return true if cross-window blur is currently enabled; false otherwise
1025      */
registerCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener)1026     boolean registerCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener);
1027 
1028     /**
1029      * Unregisters a listener which was registered with
1030      * {@link #registerCrossWindowBlurEnabledListener()}.
1031      *
1032      * @param listener the listener to be unregistered
1033      */
unregisterCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener)1034     void unregisterCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener);
1035 
isTaskSnapshotSupported()1036     boolean isTaskSnapshotSupported();
1037 
1038     /**
1039      * Returns the preferred display ID to show software keyboard.
1040      *
1041      * @see android.window.WindowProviderService#getLaunchedDisplayId
1042      */
getImeDisplayId()1043     int getImeDisplayId();
1044 
1045     /**
1046      * Control if we should enable task snapshot features on this device.
1047      * @hide
1048      */
setTaskSnapshotEnabled(boolean enabled)1049     void setTaskSnapshotEnabled(boolean enabled);
1050 
1051     /**
1052      * Registers the frame rate per second count callback for one given task ID.
1053      * Each callback can only register for receiving FPS callback for one task id until unregister
1054      * is called. If there's no task associated with the given task id,
1055      * {@link IllegalArgumentException} will be thrown. If a task id destroyed after a callback is
1056      * registered, the registered callback will not be unregistered until
1057      * {@link unregisterTaskFpsCallback()} is called
1058      * @param taskId task id of the task.
1059      * @param callback callback to be registered.
1060      *
1061      * @hide
1062      */
registerTaskFpsCallback(in int taskId, in ITaskFpsCallback callback)1063     void registerTaskFpsCallback(in int taskId, in ITaskFpsCallback callback);
1064 
1065     /**
1066      * Unregisters the frame rate per second count callback which was registered with
1067      * {@link #registerTaskFpsCallback(int,TaskFpsCallback)}.
1068      *
1069      * @param callback callback to be unregistered.
1070      *
1071      * @hide
1072      */
unregisterTaskFpsCallback(in ITaskFpsCallback listener)1073     void unregisterTaskFpsCallback(in ITaskFpsCallback listener);
1074 
1075     /**
1076      * Take a snapshot using the same path that's used for Recents. This is used for Testing only.
1077      *
1078      * @param taskId to take the snapshot of
1079      *
1080      * Returns a bitmap of the screenshot or {@code null} if it was unable to screenshot.
1081      * @hide
1082      */
snapshotTaskForRecents(int taskId)1083     Bitmap snapshotTaskForRecents(int taskId);
1084 
1085     /**
1086      * Informs the system whether the recents app is currently behind the system bars. If so,
1087      * means the recents app can control the SystemUI flags, and vice-versa.
1088      */
setRecentsAppBehindSystemBars(boolean behindSystemBars)1089     void setRecentsAppBehindSystemBars(boolean behindSystemBars);
1090 
1091     /**
1092      * Gets the background color of the letterbox. Considered invalid if the background has
1093      * multiple colors {@link #isLetterboxBackgroundMultiColored}. Should be called by SystemUI when
1094      * computing the letterbox appearance for status bar treatment.
1095      */
getLetterboxBackgroundColorInArgb()1096     int getLetterboxBackgroundColorInArgb();
1097 
1098     /**
1099      * Whether the outer area of the letterbox has multiple colors (e.g. blurred background).
1100      * Should be called by SystemUI when computing the letterbox appearance for status bar
1101      * treatment.
1102      */
isLetterboxBackgroundMultiColored()1103     boolean isLetterboxBackgroundMultiColored();
1104 
1105     /**
1106      * Captures the entire display specified by the displayId using the args provided. If the args
1107      * are null or if the sourceCrop is invalid or null, the entire display bounds will be captured.
1108      */
captureDisplay(int displayId, in @nullable ScreenCapture.CaptureArgs captureArgs, in ScreenCapture.ScreenCaptureListener listener)1109     oneway void captureDisplay(int displayId, in @nullable ScreenCapture.CaptureArgs captureArgs,
1110             in ScreenCapture.ScreenCaptureListener listener);
1111 
1112     /**
1113      * Returns {@code true} if the key will be handled globally and not forwarded to all apps.
1114      *
1115      * @param keyCode the key code to check
1116      * @return {@code true} if the key will be handled globally.
1117      */
isGlobalKey(int keyCode)1118     boolean isGlobalKey(int keyCode);
1119 
1120     /**
1121      * Create or add to a SurfaceSyncGroup in WindowManager. WindowManager maintains some
1122      * SurfaceSyncGroups to ensure multiple processes can sync with each other without sharing
1123      * SurfaceControls
1124      */
addToSurfaceSyncGroup(in IBinder syncGroupToken, boolean parentSyncGroupMerge, in @nullable ISurfaceSyncGroupCompletedListener completedListener, out AddToSurfaceSyncGroupResult addToSurfaceSyncGroupResult)1125     boolean addToSurfaceSyncGroup(in IBinder syncGroupToken, boolean parentSyncGroupMerge,
1126                 in @nullable ISurfaceSyncGroupCompletedListener completedListener,
1127                 out AddToSurfaceSyncGroupResult addToSurfaceSyncGroupResult);
1128 
1129     /**
1130      * Mark a SurfaceSyncGroup stored in WindowManager as ready.
1131      */
markSurfaceSyncGroupReady(in IBinder syncGroupToken)1132     oneway void markSurfaceSyncGroupReady(in IBinder syncGroupToken);
1133 
1134     /**
1135      * Invoked when a screenshot is taken of the default display to notify registered listeners.
1136      *
1137      * Should be invoked only by SysUI.
1138      *
1139      * @param displayId id of the display screenshot.
1140      * @return List of ComponentNames corresponding to the activities that were notified.
1141     */
notifyScreenshotListeners(int displayId)1142     List<ComponentName> notifyScreenshotListeners(int displayId);
1143 
1144     /**
1145      * Replace the content of the displayId with the SurfaceControl passed in. This can be used for
1146      * tests when creating a VirtualDisplay, but only want to capture specific content and not
1147      * mirror the entire display.
1148      */
1149      @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
1150              + ".permission.ACCESS_SURFACE_FLINGER)")
replaceContentOnDisplay(int displayId, in SurfaceControl sc)1151     boolean replaceContentOnDisplay(int displayId, in SurfaceControl sc);
1152 
1153     /**
1154      * Registers a DecorView gesture listener for a given display.
1155      */
1156     @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
1157             + ".permission.MONITOR_INPUT)")
registerDecorViewGestureListener(IDecorViewGestureListener listener, int displayId)1158     void registerDecorViewGestureListener(IDecorViewGestureListener listener, int displayId);
1159 
1160     /**
1161      * Unregisters a DecorView gesture listener for a given display.
1162      */
1163     @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
1164             + ".permission.MONITOR_INPUT)")
unregisterDecorViewGestureListener(IDecorViewGestureListener listener, int displayId)1165     void unregisterDecorViewGestureListener(IDecorViewGestureListener listener, int displayId);
1166 
registerTrustedPresentationListener(in IBinder window, in ITrustedPresentationListener listener, in TrustedPresentationThresholds thresholds, int id)1167     void registerTrustedPresentationListener(in IBinder window, in ITrustedPresentationListener listener,
1168             in TrustedPresentationThresholds thresholds, int id);
1169 
1170 
unregisterTrustedPresentationListener(in ITrustedPresentationListener listener, int id)1171     void unregisterTrustedPresentationListener(in ITrustedPresentationListener listener, int id);
1172 
1173     @EnforcePermission("DETECT_SCREEN_RECORDING")
registerScreenRecordingCallback(IScreenRecordingCallback callback)1174     boolean registerScreenRecordingCallback(IScreenRecordingCallback callback);
1175 
1176     @EnforcePermission("DETECT_SCREEN_RECORDING")
unregisterScreenRecordingCallback(IScreenRecordingCallback callback)1177     void unregisterScreenRecordingCallback(IScreenRecordingCallback callback);
1178 
1179     /**
1180      * Sets the listener to be called back when a cross-window drag and drop operation happens.
1181      */
setGlobalDragListener(IGlobalDragListener listener)1182     void setGlobalDragListener(IGlobalDragListener listener);
1183 
transferTouchGesture(in InputTransferToken transferFromToken, in InputTransferToken transferToToken)1184     boolean transferTouchGesture(in InputTransferToken transferFromToken,
1185             in InputTransferToken transferToToken);
1186 
1187     /**
1188      * Request the application launch keyboard shortcuts the system has defined.
1189      *
1190      * @param deviceId The id of the {@link InputDevice} that will handle the shortcut.
1191      */
getApplicationLaunchKeyboardShortcuts(int deviceId)1192     KeyboardShortcutGroup getApplicationLaunchKeyboardShortcuts(int deviceId);
1193 
1194     /**
1195      * Returns whether the display with {@code displayId} ignores orientation request.
1196      */
getIgnoreOrientationRequest(int displayId)1197     boolean getIgnoreOrientationRequest(int displayId);
1198 }
1199