blob: 84ac90bae258edfbab2c98c13b1f000e3752a096 [file] [log] [blame]
Dianne Hackborn7da6ac32010-12-09 19:22:04 -08001/*
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002** Copyright 2006, The Android Open Source Project
3**
Jim Miller4eeb4f62012-11-08 00:04:29 -08004** 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08007**
Jim Miller4eeb4f62012-11-08 00:04:29 -08008** http://www.apache.org/licenses/LICENSE-2.0
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08009**
Jim Miller4eeb4f62012-11-08 00:04:29 -080010** 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080014** limitations under the License.
15*/
16
17package android.view;
18
Clara Bayarri75e09792015-07-29 16:20:40 +010019import com.android.internal.os.IResultReceiver;
Jorim Jaggi241ae102016-11-02 21:57:33 -070020import com.android.internal.policy.IKeyguardDismissCallback;
Muyuan Li94ce94e2016-02-24 16:20:54 -080021import com.android.internal.policy.IShortcutService;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022
Winson Chunge2104682017-11-08 17:31:14 -080023import android.app.IAssistDataReceiver;
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070024import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.res.Configuration;
Dianne Hackborn0aae2d42010-12-07 23:51:29 -080026import android.graphics.Bitmap;
Winson Chunga31922f2017-05-24 15:50:06 -070027import android.graphics.GraphicBuffer;
Issei Suzukia5dbf522019-02-01 17:58:15 +010028import android.graphics.Insets;
Dianne Hackbornac8dea12011-04-20 18:18:51 -070029import android.graphics.Point;
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -070030import android.graphics.Rect;
Albert Chaulk56162a02017-06-05 19:35:23 -040031import android.graphics.Region;
Adam Cohenf7522022012-10-03 20:03:18 -070032import android.os.Bundle;
Dianne Hackborn38e29a62011-09-18 14:43:08 -070033import android.os.IRemoteCallback;
Robert Carr3b716242016-08-16 16:02:21 -070034import android.os.ParcelFileDescriptor;
Charles Chenf65e0222020-01-17 11:51:34 +080035import android.view.DisplayCutout;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.view.IApplicationToken;
Jorim Jaggi2f7d2922015-10-29 13:08:29 +010037import android.view.IAppTransitionAnimationSpecsFuture;
Jorim Jaggia6c934e2015-12-21 13:22:31 +010038import android.view.IDockedStackListener;
Evan Rosky8d782e02019-10-14 15:43:53 -070039import android.view.IDisplayWindowInsetsController;
Evan Rosky69cace42019-09-20 16:28:13 -070040import android.view.IDisplayWindowListener;
Adrian Roos962017e2018-11-27 15:11:46 +010041import android.view.IDisplayFoldListener;
Evan Rosky69cace42019-09-20 16:28:13 -070042import android.view.IDisplayWindowRotationController;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.view.IOnKeyguardExitResult;
Winson Chung655332c2016-10-31 13:14:28 -070044import android.view.IPinnedStackListener;
Jorim Jaggi33a701a2017-12-01 14:58:18 +010045import android.view.RemoteAnimationAdapter;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.view.IRotationWatcher;
Adrian Roos4ffc8972019-02-07 20:45:11 +010047import android.view.ISystemGestureExclusionListener;
Lucas Dupine1571702017-05-24 14:14:44 -070048import android.view.IWallpaperVisibilityListener;
Evan Rosky22b6bbd2019-09-26 14:29:57 -070049import android.view.IWindow;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.view.IWindowSession;
Dianne Hackborneb94fa72014-06-03 17:48:12 -070051import android.view.IWindowSessionCallback;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070053import android.view.InputEvent;
Evan Rosky8d782e02019-10-14 15:43:53 -070054import android.view.InsetsState;
Svetoslav Ganov152e9bb2012-10-12 20:15:29 -070055import android.view.MagnificationSpec;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070057import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070058import android.view.InputDevice;
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -070059import android.view.IInputFilter;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070060import android.view.AppTransitionAnimationSpec;
Svetoslav1376d602014-03-13 11:17:26 -070061import android.view.WindowContentFrameStats;
Jorim Jaggie2c77f92016-12-29 14:57:22 +010062import android.view.WindowManager;
Robert Carr10584fa2019-01-14 15:55:19 -080063import android.view.SurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064
65/**
66 * System private interface to the window manager.
67 *
68 * {@hide}
69 */
70interface IWindowManager
71{
72 /**
Garfield Tana3f19032019-11-19 18:04:50 -080073 * No overridden behavior is provided in terms of fixing rotation to user rotation. Use
74 * other flags to derive the default behavior, such as {@link WindowManagerService#mIsPc}
75 * and {@link WindowManagerService#mForceDesktopModeOnExternalDisplays}.
76 */
77 const int FIXED_TO_USER_ROTATION_DEFAULT = 0;
78 /**
79 * Don't fix display rotation to {@link DisplayRotation#mUserRotation} only. Always allow
80 * other factors to play a role in deciding display rotation.
81 */
82 const int FIXED_TO_USER_ROTATION_DISABLED = 1;
83 /**
84 * Only use {@link DisplayRotation#mUserRotation} as the display rotation.
85 */
86 const int FIXED_TO_USER_ROTATION_ENABLED = 2;
87
88 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 * ===== NOTICE =====
90 * The first three methods must remain the first three methods. Scripts
91 * and tools rely on their transaction number to work properly.
92 */
93 // This is used for debugging
94 boolean startViewServer(int port); // Transaction #1
95 boolean stopViewServer(); // Transaction #2
96 boolean isViewServerRunning(); // Transaction #3
97
Yohei Yukawaa71bb252018-09-19 19:21:24 -070098 IWindowSession openSession(in IWindowSessionCallback callback);
Dianne Hackbornac8dea12011-04-20 18:18:51 -070099
Valerie Hau779af292020-02-07 10:53:32 -0800100 boolean useBLAST();
101
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000102 @UnsupportedAppUsage
Dianne Hackborn672cf452013-03-26 15:24:24 -0700103 void getInitialDisplaySize(int displayId, out Point size);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000104 @UnsupportedAppUsage
Dianne Hackborn672cf452013-03-26 15:24:24 -0700105 void getBaseDisplaySize(int displayId, out Point size);
Jeff Brown43aa1592012-09-10 17:36:31 -0700106 void setForcedDisplaySize(int displayId, int width, int height);
Craig Mautner59c00972012-07-30 12:10:24 -0700107 void clearForcedDisplaySize(int displayId);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000108 @UnsupportedAppUsage
Dianne Hackborn672cf452013-03-26 15:24:24 -0700109 int getInitialDisplayDensity(int displayId);
110 int getBaseDisplayDensity(int displayId);
Alan Viverettedf3a7ca2016-09-06 17:13:41 -0400111 void setForcedDisplayDensityForUser(int displayId, int density, int userId);
112 void clearForcedDisplayDensityForUser(int displayId, int userId);
Jeff Brownd46747a2015-04-15 19:02:36 -0700113 void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable
Dianne Hackborn7916ac62011-05-16 20:45:48 -0700114
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 // These can only be called when holding the MANAGE_APP_TOKENS permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 void setEventDispatching(boolean enabled);
Andrii Kulian4a316972020-01-21 21:41:38 -0800117
118 /** @return {@code true} if this binder is a registered window token. */
119 boolean isWindowToken(in IBinder binder);
120 /**
121 * Adds window token for a given type.
122 *
123 * @param token Token to be registered.
124 * @param type Window type to be used with this token.
Andrii Kulianea325632020-01-28 17:52:57 -0800125 * @param options A bundle used to pass window-related options.
Andrii Kulian4a316972020-01-21 21:41:38 -0800126 * @param displayId The ID of the display where this token should be added.
127 * @param packageName The name of package to request to add window token.
128 * @return {@link WindowManagerGlobal#ADD_OKAY} if the addition was successful, an error code
129 * otherwise.
130 */
Andrii Kulianea325632020-01-28 17:52:57 -0800131 int addWindowTokenWithOptions(IBinder token, int type, int displayId, in Bundle options,
132 String packageName);
Wale Ogunwaleac2561e2016-11-01 15:43:46 -0700133 void addWindowToken(IBinder token, int type, int displayId);
134 void removeWindowToken(IBinder token, int displayId);
Dianne Hackborn7da6ac32010-12-09 19:22:04 -0800135 void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
Jorim Jaggi2f7d2922015-10-29 13:08:29 +0100136
137 /**
Evan Rosky69cace42019-09-20 16:28:13 -0700138 * Sets a singular remote controller of display rotations. There can only be one. The
139 * controller is called after the display has "frozen" for a rotation and display rotation will
140 * only continue once the controller has finished calculating associated configurations.
141 */
142 void setDisplayWindowRotationController(IDisplayWindowRotationController controller);
143
144 /**
Evan Rosky22b6bbd2019-09-26 14:29:57 -0700145 * Adds a root container that a client shell can populate with its own windows (usually via
146 * WindowlessWindowManager).
147 *
148 * @param client an IWindow used for window-level communication (ime, finish draw, etc.).
149 * @param windowType used by WM to determine the z-order. This is the same as the window type
150 * used in {@link WindowManager.LayoutParams}.
151 * @return a SurfaceControl to add things to.
152 */
153 SurfaceControl addShellRoot(int displayId, IWindow client, int windowType);
154
155 /**
Jorim Jaggi2f7d2922015-10-29 13:08:29 +0100156 * Like overridePendingAppTransitionMultiThumb, but uses a future to supply the specs. This is
157 * used for recents, where generating the thumbnails of the specs takes a non-trivial amount of
158 * time, so we want to move that off the critical path for starting the new activity.
159 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000160 @UnsupportedAppUsage
Jorim Jaggi2f7d2922015-10-29 13:08:29 +0100161 void overridePendingAppTransitionMultiThumbFuture(
162 IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
lumarka483f312018-11-20 15:24:05 +0800163 boolean scaleUp, int displayId);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000164 @UnsupportedAppUsage
lumarka483f312018-11-20 15:24:05 +0800165 void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter,
166 int displayId);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000167 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 void executeAppTransition();
Wale Ogunwale3b232392016-05-13 15:37:13 -0700169
Jorim Jaggi66b48df2018-04-20 16:23:48 +0200170 /**
171 * Used by system ui to report that recents has shown itself.
172 * @deprecated to be removed once prebuilts are updated
173 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000174 @UnsupportedAppUsage
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800175 void endProlongedAnimations();
176
Dianne Hackborn9d9ece32012-09-10 15:33:52 -0700177 void startFreezingScreen(int exitAnim, int enterAnim);
178 void stopFreezingScreen();
179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 // these require DISABLE_KEYGUARD permission
Adrian Roos1c8e3c02018-11-20 20:07:55 +0100181 /** @deprecated use Activity.setShowWhenLocked instead. */
182 void disableKeyguard(IBinder token, String tag, int userId);
183 /** @deprecated use Activity.setShowWhenLocked instead. */
184 void reenableKeyguard(IBinder token, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800185 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000186 @UnsupportedAppUsage
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500187 boolean isKeyguardLocked();
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000188 @UnsupportedAppUsage
Brad Stenning2bdc21e2019-03-11 14:33:22 -0700189 boolean isKeyguardSecure(int userId);
Lucas Dupinc80c67e2017-12-04 14:29:10 -0800190 void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800191
Evan Rosky18396452016-07-27 15:19:37 -0700192 // Requires INTERACT_ACROSS_USERS_FULL permission
193 void setSwitchingUser(boolean switching);
194
Dianne Hackbornffa42482009-09-23 22:20:11 -0700195 void closeSystemDialogs(String reason);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800196
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800197 // These can only be called with the SET_ANIMATON_SCALE permission.
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000198 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800199 float getAnimationScale(int which);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000200 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800201 float[] getAnimationScales();
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000202 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800203 void setAnimationScale(int which, float scale);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000204 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800205 void setAnimationScales(in float[] scales);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800206
Dianne Hackborneb94fa72014-06-03 17:48:12 -0700207 float getCurrentAnimatorScale();
208
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800209 // For testing
Artur Satayev70507ed2019-07-29 13:18:27 +0100210 @UnsupportedAppUsage(maxTargetSdk = 28)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800211 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800212
213 // For StrictMode flashing a red border on violations from the UI
214 // thread. The uid/pid is implicit from the Binder call, and the Window
215 // Manager uses that to determine whether or not the red border should
216 // actually be shown. (it will be ignored that pid doesn't have windows
217 // on screen)
Artur Satayev70507ed2019-07-29 13:18:27 +0100218 @UnsupportedAppUsage(maxTargetSdk = 28)
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800219 void showStrictModeViolation(boolean on);
220
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800221 // Proxy to set the system property for whether the flashing
222 // should be enabled. The 'enabled' value is null or blank for
223 // the system default (differs per build variant) or any valid
224 // boolean string as parsed by SystemProperties.getBoolean().
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000225 @UnsupportedAppUsage
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800226 void setStrictModeVisualIndicatorPreference(String enabled);
227
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100228 /**
Makoto Onuki04ef4472018-03-12 17:29:49 -0700229 * Set whether screen capture is disabled for all windows of a specific user from
230 * the device policy cache.
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100231 */
Makoto Onuki04ef4472018-03-12 17:29:49 -0700232 void refreshScreenCaptureDisabled(int userId);
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 // These can only be called with the SET_ORIENTATION permission.
235 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700236 * Update the current screen rotation based on the current state of
237 * the world.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800238 * @param alwaysSendConfiguration Flag to force a new configuration to
239 * be evaluated. This can be used when there are other parameters in
240 * configuration that are changing.
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700241 * @param forceRelayout If true, the window manager will always do a relayout
242 * of its windows even if the rotation hasn't changed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800243 */
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700244 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245
246 /**
Andrii Kulian8ee72852017-03-10 10:36:45 -0800247 * Retrieve the current orientation of the primary screen.
248 * @return Constant as per {@link android.view.Surface.Rotation}.
249 *
250 * @see android.view.Display#DEFAULT_DISPLAY
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800251 */
Andrii Kulian8ee72852017-03-10 10:36:45 -0800252 int getDefaultDisplayRotation();
Jim Miller4eeb4f62012-11-08 00:04:29 -0800253
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254 /**
Andrii Kulian35fa3c22017-03-11 09:37:28 -0800255 * Watch the rotation of the specified screen. Returns the current rotation,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800256 * calls back when it changes.
257 */
Andrii Kulian35fa3c22017-03-11 09:37:28 -0800258 int watchRotation(IRotationWatcher watcher, int displayId);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400259
Adam Powelldfee59a2011-08-05 20:48:30 -0700260 /**
Brian Colonnab1b9a8a2013-03-29 11:52:42 -0400261 * Remove a rotation watcher set using watchRotation.
262 * @hide
263 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000264 @UnsupportedAppUsage
Brian Colonnab1b9a8a2013-03-29 11:52:42 -0400265 void removeRotationWatcher(IRotationWatcher watcher);
266
267 /**
Adam Powelldfee59a2011-08-05 20:48:30 -0700268 * Determine the preferred edge of the screen to pin the compact options menu against.
Riddle Hsua4d6fa22018-08-11 00:50:39 +0800269 *
270 * @param displayId Id of the display where the menu window currently resides.
271 * @return a Gravity value for the options menu panel.
Adam Powelldfee59a2011-08-05 20:48:30 -0700272 * @hide
273 */
Riddle Hsua4d6fa22018-08-11 00:50:39 +0800274 int getPreferredOptionsPanelGravity(int displayId);
Adam Powelldfee59a2011-08-05 20:48:30 -0700275
Jim Miller4eeb4f62012-11-08 00:04:29 -0800276 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700277 * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link
278 * android.view.Display#DEFAULT_DISPLAY} and given rotation.
Jim Miller4eeb4f62012-11-08 00:04:29 -0800279 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000280 @UnsupportedAppUsage
Jim Miller4eeb4f62012-11-08 00:04:29 -0800281 void freezeRotation(int rotation);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400282
Jim Miller4eeb4f62012-11-08 00:04:29 -0800283 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700284 * Equivalent to calling {@link #thawDisplayRotation(int)} with {@link
285 * android.view.Display#DEFAULT_DISPLAY}.
Jim Miller4eeb4f62012-11-08 00:04:29 -0800286 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000287 @UnsupportedAppUsage
Jim Miller4eeb4f62012-11-08 00:04:29 -0800288 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800289
Jim Miller4eeb4f62012-11-08 00:04:29 -0800290 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700291 * Equivelant to call {@link #isDisplayRotationFrozen(int)} with {@link
292 * android.view.Display#DEFAULT_DISPLAY}.
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800293 */
294 boolean isRotationFrozen();
295
296 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700297 * Lock the display orientation to the specified rotation, or to the current
298 * rotation if -1. Sensor input will be ignored until thawRotation() is called.
299 *
300 * @param displayId the ID of display which rotation should be frozen.
301 * @param rotation one of {@link android.view.Surface#ROTATION_0},
302 * {@link android.view.Surface#ROTATION_90}, {@link android.view.Surface#ROTATION_180},
303 * {@link android.view.Surface#ROTATION_270} or -1 to freeze it to current rotation.
304 * @hide
305 */
306 void freezeDisplayRotation(int displayId, int rotation);
307
308 /**
309 * Release the orientation lock imposed by freezeRotation() on the display.
310 *
311 * @param displayId the ID of display which rotation should be thawed.
312 * @hide
313 */
314 void thawDisplayRotation(int displayId);
315
316 /**
317 * Gets whether the rotation is frozen on the display.
318 *
319 * @param displayId the ID of display which frozen is needed.
320 * @return Whether the rotation is frozen.
321 */
322 boolean isDisplayRotationFrozen(int displayId);
323
324 /**
Garfield Tana3f19032019-11-19 18:04:50 -0800325 * Sets if display rotation is fixed to user specified value for given displayId.
326 */
327 void setFixedToUserRotation(int displayId, int fixedToUserRotation);
328
329 /**
Zak Cohen3683fb12016-07-11 19:47:37 +0100330 * Screenshot the current wallpaper layer, including the whole screen.
331 */
332 Bitmap screenshotWallpaper();
333
334 /**
Lucas Dupine1571702017-05-24 14:14:44 -0700335 * Registers a wallpaper visibility listener.
336 * @return Current visibility.
337 */
338 boolean registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
339 int displayId);
340
341 /**
342 * Remove a visibility watcher that was added using registerWallpaperVisibilityListener.
343 */
344 void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
345 int displayId);
346
347 /**
Adrian Roos4ffc8972019-02-07 20:45:11 +0100348 * Registers a system gesture exclusion listener for a given display.
349 */
350 void registerSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
351 int displayId);
352
353 /**
354 * Unregisters a system gesture exclusion listener for a given display.
355 */
356 void unregisterSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
357 int displayId);
358
359 /**
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700360 * Used only for assist -- request a screenshot of the current application.
361 */
Winson Chungda2818f2017-10-23 16:25:49 -0700362 boolean requestAssistScreenshot(IAssistDataReceiver receiver);
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700363
364 /**
Joe Onorato664644d2011-01-23 17:53:23 -0800365 * Called by the status bar to notify Views of changes to System UI visiblity.
366 */
Tiger Huang7c610aa2018-10-27 00:01:01 +0800367 oneway void statusBarVisibilityChanged(int displayId, int visibility);
Jeff Brown1a84fd12011-06-02 01:26:32 -0700368
369 /**
Jorim Jaggi956ca412019-01-07 14:49:14 +0100370 * Called by System UI to notify Window Manager to hide transient bars.
371 */
372 oneway void hideTransientBars(int displayId);
373
374 /**
Brad Stenninge0573692019-03-11 13:52:46 -0700375 * When set to {@code true} the system bars will always be shown. This is true even if an app
376 * requests to be fullscreen by setting the system ui visibility flags. The
377 * functionality was added for the automotive case as a way to guarantee required content stays
378 * on screen at all times.
379 *
380 * @hide
381 */
382 oneway void setForceShowSystemBars(boolean show);
383
384 /**
Winsonab216602016-08-09 14:05:20 -0700385 * Called by System UI to notify of changes to the visibility of Recents.
386 */
387 oneway void setRecentsVisibility(boolean visible);
388
389 /**
390 * Called by System UI to notify of changes to the visibility of PIP.
391 */
Winson Chungac52f282017-03-30 14:44:52 -0700392 oneway void setPipVisibility(boolean visible);
Winsonab216602016-08-09 14:05:20 -0700393
Tracy Zhou43513082018-03-08 21:58:36 -0800394 /**
Matthew Ng64543e62018-02-28 17:35:10 -0800395 * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
396 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000397 @UnsupportedAppUsage
Matthew Ng64543e62018-02-28 17:35:10 -0800398 void setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled);
399
Winsonab216602016-08-09 14:05:20 -0700400 /**
Charles Chenea6e7f02018-11-19 21:37:45 +0800401 * Device has a software navigation bar (separate from the status bar) on specific display.
402 *
403 * @param displayId the id of display to check if there is a software navigation bar.
Daniel Sandler0c4ccff2011-10-19 16:39:14 -0400404 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000405 @UnsupportedAppUsage
Charles Chenea6e7f02018-11-19 21:37:45 +0800406 boolean hasNavigationBar(int displayId);
Jim Miller93c518e2012-01-17 15:55:31 -0800407
408 /**
Tracy Zhou43513082018-03-08 21:58:36 -0800409 * Get the position of the nav bar
410 */
Tiger Huang44c04552018-11-29 20:06:45 +0800411 int getNavBarPosition(int displayId);
Matthew Nga8f24262017-12-19 11:54:24 -0800412
413 /**
Adam Cohenf7522022012-10-03 20:03:18 -0700414 * Lock the device immediately with the specified options (can be null).
Jim Miller93c518e2012-01-17 15:55:31 -0800415 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000416 @UnsupportedAppUsage
Adam Cohenf7522022012-10-03 20:03:18 -0700417 void lockNow(in Bundle options);
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -0700418
419 /**
Jim Millerbfec0a82012-11-05 20:05:22 -0800420 * Device is in safe mode.
421 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000422 @UnsupportedAppUsage
Jim Millerbfec0a82012-11-05 20:05:22 -0800423 boolean isSafeModeEnabled();
Jorim Jaggicff0acb2014-03-31 16:35:15 +0200424
425 /**
426 * Enables the screen if all conditions are met.
427 */
428 void enableScreenIfNeeded();
Svetoslavdd137a82014-04-10 12:48:07 -0700429
430 /**
Svetoslav1376d602014-03-13 11:17:26 -0700431 * Clears the frame statistics for a given window.
432 *
433 * @param token The window token.
434 * @return Whether the frame statistics were cleared.
435 */
436 boolean clearWindowContentFrameStats(IBinder token);
437
438 /**
439 * Gets the content frame statistics for a given window.
440 *
441 * @param token The window token.
442 * @return The frame statistics or null if the window does not exist.
443 */
444 WindowContentFrameStats getWindowContentFrameStats(IBinder token);
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100445
446 /**
Evan Rosky73a7fe92019-11-18 18:28:01 -0800447 * This is a no-op.
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100448 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000449 @UnsupportedAppUsage
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100450 int getDockedStackSide();
451
452 /**
Jorim Jaggid47e7e12016-03-01 09:57:38 +0100453 * Sets the region the user can touch the divider. This region will be excluded from the region
454 * which is used to cause a focus switch when dispatching touch.
455 */
456 void setDockedStackDividerTouchRegion(in Rect touchableRegion);
457
458 /**
Winson Chung655332c2016-10-31 13:14:28 -0700459 * Registers a listener that will be called when the pinned stack state changes.
460 */
461 void registerPinnedStackListener(int displayId, IPinnedStackListener listener);
462
463 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100464 * Requests Keyboard Shortcuts from the displayed window.
465 *
466 * @param receiver The receiver to deliver the results to.
467 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000468 void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId);
Jorim Jaggic6c89a82016-01-28 17:48:21 -0800469
470 /**
471 * Retrieves the current stable insets from the primary display.
472 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000473 @UnsupportedAppUsage
Winson Chung303c6b72016-10-24 17:12:49 -0700474 void getStableInsets(int displayId, out Rect outInsets);
Muyuan Li94ce94e2016-02-24 16:20:54 -0800475
476 /**
Issei Suzukia5dbf522019-02-01 17:58:15 +0100477 * Set the forwarded insets on the display.
478 * <p>
479 * This is only used in case a virtual display is displayed on another display that has insets,
480 * and the bounds of the virtual display is overlapping with the insets from the host display.
481 * In that case, the contents on the virtual display won't be placed over the forwarded insets.
482 * Only the owner of the display is permitted to set the forwarded insets on it.
483 */
484 void setForwardedInsets(int displayId, in Insets insets);
485
486 /**
Muyuan Li94ce94e2016-02-24 16:20:54 -0800487 * Register shortcut key. Shortcut code is packed as:
488 * (MetaState << Integer.SIZE) | KeyCode
489 * @hide
490 */
491 void registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber);
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700492
493 /**
Arthur Hung39134b22018-08-14 11:58:28 +0800494 * Create an input consumer by name and display id.
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700495 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000496 @UnsupportedAppUsage
Arthur Hung39134b22018-08-14 11:58:28 +0800497 void createInputConsumer(IBinder token, String name, int displayId,
498 out InputChannel inputChannel);
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700499
500 /**
Arthur Hung39134b22018-08-14 11:58:28 +0800501 * Destroy an input consumer by name and display id.
502 * This method will also dispose the input channels associated with that InputConsumer.
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700503 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000504 @UnsupportedAppUsage
Arthur Hung39134b22018-08-14 11:58:28 +0800505 boolean destroyInputConsumer(String name, int displayId);
Albert Chaulk56162a02017-06-05 19:35:23 -0400506
507 /**
508 * Return the touch region for the current IME window, or an empty region if there is none.
509 */
510 Region getCurrentImeTouchRegion();
Vishnu Nairc9615042018-01-09 07:23:31 -0800511
512 /**
Adrian Roos962017e2018-11-27 15:11:46 +0100513 * Registers an IDisplayFoldListener.
514 */
515 void registerDisplayFoldListener(IDisplayFoldListener listener);
516
517 /**
518 * Unregisters an IDisplayFoldListener.
519 */
520 void unregisterDisplayFoldListener(IDisplayFoldListener listener);
521
522 /**
Evan Rosky69cace42019-09-20 16:28:13 -0700523 * Registers an IDisplayContainerListener
524 */
525 void registerDisplayWindowListener(IDisplayWindowListener listener);
526
527 /**
528 * Unregisters an IDisplayContainerListener.
529 */
530 void unregisterDisplayWindowListener(IDisplayWindowListener listener);
531
532 /**
Vishnu Nairc9615042018-01-09 07:23:31 -0800533 * Starts a window trace.
534 */
535 void startWindowTrace();
536
537 /**
538 * Stops a window trace.
539 */
540 void stopWindowTrace();
541
542 /**
543 * Returns true if window trace is enabled.
544 */
545 boolean isWindowTraceEnabled();
Yoshiaki Nakae1bdfc822017-09-15 15:24:34 +0900546
547 /**
Andrii Kulianf0379de2018-03-14 16:24:07 -0700548 * Notify WindowManager that it should not override the info in DisplayManager for the specified
549 * display. This can disable letter- or pillar-boxing applied in DisplayManager when the metrics
550 * of the logical display reported from WindowManager do not correspond to the metrics of the
551 * physical display it is based on.
552 *
553 * @param displayId The id of the display.
554 */
555 void dontOverrideDisplayInfo(int displayId);
Chilun8753ad32018-10-09 15:56:45 +0800556
557 /**
558 * Gets the windowing mode of the display.
559 *
560 * @param displayId The id of the display.
561 * @return {@link WindowConfiguration.WindowingMode}
562 */
563 int getWindowingMode(int displayId);
564
565 /**
566 * Sets the windowing mode of the display.
567 *
568 * @param displayId The id of the display.
569 * @param mode {@link WindowConfiguration.WindowingMode}
570 */
571 void setWindowingMode(int displayId, int mode);
572
573 /**
574 * Gets current remove content mode of the display.
575 * <p>
576 * What actions should be performed with the display's content when it is removed. Default
577 * behavior for public displays in this case is to move all activities to the primary display
578 * and make it focused. For private display is to destroy all activities.
579 * </p>
580 *
581 * @param displayId The id of the display.
582 * @return The remove content mode of the display.
583 * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
584 * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
585 */
586 int getRemoveContentMode(int displayId);
587
588 /**
589 * Sets the remove content mode of the display.
590 * <p>
591 * This mode indicates what actions should be performed with the display's content when it is
592 * removed.
593 * </p>
594 *
595 * @param displayId The id of the display.
596 * @param mode Remove content mode.
597 * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
598 * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
599 */
600 void setRemoveContentMode(int displayId, int mode);
601
602 /**
603 * Indicates that the display should show its content when non-secure keyguard is shown.
604 * <p>
605 * This flag identifies secondary displays that will continue showing content if keyguard can be
606 * dismissed without entering credentials.
607 * </p><p>
608 * An example of usage is a virtual display which content is displayed on external hardware
609 * display that is not visible to the system directly.
610 * </p>
611 *
612 * @param displayId The id of the display.
613 * @return {@code true} if the display should show its content when non-secure keyguard is
614 * shown.
615 * @see KeyguardManager#isDeviceSecure()
616 * @see KeyguardManager#isDeviceLocked()
617 */
618 boolean shouldShowWithInsecureKeyguard(int displayId);
619
620 /**
621 * Sets that the display should show its content when non-secure keyguard is shown.
622 *
623 * @param displayId The id of the display.
624 * @param shouldShow Indicates that the display should show its content when non-secure keyguard
625 * is shown.
626 * @see KeyguardManager#isDeviceSecure()
627 * @see KeyguardManager#isDeviceLocked()
628 */
629 void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow);
630
631 /**
632 * Indicates the display should show system decors.
633 * <p>
634 * System decors include status bar, navigation bar, launcher.
635 * </p>
636 *
637 * @param displayId The id of the display.
638 * @return {@code true} if the display should show system decors.
639 */
640 boolean shouldShowSystemDecors(int displayId);
641
642 /**
643 * Sets that the display should show system decors.
644 * <p>
645 * System decors include status bar, navigation bar, launcher.
646 * </p>
647 *
648 * @param displayId The id of the display.
649 * @param shouldShow Indicates that the display should show system decors.
650 */
651 void setShouldShowSystemDecors(int displayId, boolean shouldShow);
652
653 /**
654 * Indicates that the display should show IME.
655 *
656 * @param displayId The id of the display.
657 * @return {@code true} if the display should show IME.
658 * @see KeyguardManager#isDeviceSecure()
659 * @see KeyguardManager#isDeviceLocked()
660 */
661 boolean shouldShowIme(int displayId);
662
663 /**
664 * Sets that the display should show IME.
665 *
666 * @param displayId The id of the display.
667 * @param shouldShow Indicates that the display should show IME.
668 * @see KeyguardManager#isDeviceSecure()
669 * @see KeyguardManager#isDeviceLocked()
670 */
671 void setShouldShowIme(int displayId, boolean shouldShow);
chaviwff2e7d82018-11-02 11:11:27 -0700672
chaviw504715c2019-02-14 11:02:43 -0800673 /**
674 * Waits for transactions to get applied before injecting input.
675 * This includes waiting for the input windows to get sent to InputManager.
676 *
677 * This is needed for testing since the system add windows and injects input
678 * quick enough that the windows don't have time to get sent to InputManager.
679 */
chaviw84dec9f2019-04-22 13:39:46 -0700680 boolean injectInputAfterTransactionsApplied(in InputEvent ev, int mode);
681
682 /**
683 * Waits until all animations have completed and input information has been sent from
684 * WindowManager to native InputManager.
685 *
686 * This is needed for testing since we need to ensure input information has been propagated to
687 * native InputManager before proceeding with tests.
688 */
689 void syncInputTransactions();
Winson Chungbe2bdb032019-08-30 16:49:13 -0700690
691 /**
692 * Returns whether SurfaceFlinger layer tracing is enabled.
693 */
694 boolean isLayerTracing();
695
696 /**
697 * Enables/disables SurfaceFlinger layer tracing.
698 */
699 void setLayerTracing(boolean enabled);
chaviwa51724f2019-09-19 09:50:11 -0700700
701 /**
702 * Mirrors a specified display. The root of the mirrored hierarchy will be stored in
703 * outSurfaceControl.
704 * Requires the ACCESS_SURFACE_FLINGER permission.
705 *
706 * @param displayId The id of the display to mirror
707 * @param outSurfaceControl The SurfaceControl for the root of the mirrored hierarchy.
708 *
709 * @return true if the display was successfully mirrored.
710 */
711 boolean mirrorDisplay(int displayId, out SurfaceControl outSurfaceControl);
Evan Rosky8d782e02019-10-14 15:43:53 -0700712
713 /**
714 * When in multi-window mode, the provided displayWindowInsetsController will control insets
715 * animations.
716 */
717 void setDisplayWindowInsetsController(
718 int displayId, in IDisplayWindowInsetsController displayWindowInsetsController);
719
720 /**
721 * Called when a remote process modifies insets on a display window container.
722 */
723 void modifyDisplayWindowInsets(int displayId, in InsetsState state);
Charles Chenf65e0222020-01-17 11:51:34 +0800724
725 /**
726 * Called to get the expected window insets.
Charles Chenb8070fb2020-02-24 15:42:59 +0800727 *
728 * @return {@code true} if system bars are always comsumed.
Charles Chenf65e0222020-01-17 11:51:34 +0800729 */
Charles Chenb8070fb2020-02-24 15:42:59 +0800730 boolean getWindowInsets(in WindowManager.LayoutParams attrs, int displayId,
Charles Chenf65e0222020-01-17 11:51:34 +0800731 out Rect outContentInsets, out Rect outStableInsets,
Charles Chenb8070fb2020-02-24 15:42:59 +0800732 out DisplayCutout.ParcelableWrapper outDisplayCutout, out InsetsState outInsetsState);
Hongming Jine0ab6b12020-01-16 14:52:19 -0800733
734 /**
735 * Called to show global actions.
736 */
737 void showGlobalActions();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800738}