blob: 5eb319f19cce84b724d3a6915edf75ac8a418709 [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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.view.IApplicationToken;
Jorim Jaggi2f7d2922015-10-29 13:08:29 +010036import android.view.IAppTransitionAnimationSpecsFuture;
Jorim Jaggia6c934e2015-12-21 13:22:31 +010037import android.view.IDockedStackListener;
Evan Rosky8d782e02019-10-14 15:43:53 -070038import android.view.IDisplayWindowInsetsController;
Evan Rosky69cace42019-09-20 16:28:13 -070039import android.view.IDisplayWindowListener;
Adrian Roos962017e2018-11-27 15:11:46 +010040import android.view.IDisplayFoldListener;
Evan Rosky69cace42019-09-20 16:28:13 -070041import android.view.IDisplayWindowRotationController;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.view.IOnKeyguardExitResult;
Winson Chung655332c2016-10-31 13:14:28 -070043import android.view.IPinnedStackListener;
Jorim Jaggi33a701a2017-12-01 14:58:18 +010044import android.view.RemoteAnimationAdapter;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.view.IRotationWatcher;
Adrian Roos4ffc8972019-02-07 20:45:11 +010046import android.view.ISystemGestureExclusionListener;
Lucas Dupine1571702017-05-24 14:14:44 -070047import android.view.IWallpaperVisibilityListener;
Evan Rosky22b6bbd2019-09-26 14:29:57 -070048import android.view.IWindow;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.view.IWindowSession;
Dianne Hackborneb94fa72014-06-03 17:48:12 -070050import android.view.IWindowSessionCallback;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070052import android.view.InputEvent;
Evan Rosky8d782e02019-10-14 15:43:53 -070053import android.view.InsetsState;
Svetoslav Ganov152e9bb2012-10-12 20:15:29 -070054import android.view.MagnificationSpec;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070056import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070057import android.view.InputDevice;
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -070058import android.view.IInputFilter;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070059import android.view.AppTransitionAnimationSpec;
Svetoslav1376d602014-03-13 11:17:26 -070060import android.view.WindowContentFrameStats;
Jorim Jaggie2c77f92016-12-29 14:57:22 +010061import android.view.WindowManager;
Robert Carr10584fa2019-01-14 15:55:19 -080062import android.view.SurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063
64/**
65 * System private interface to the window manager.
66 *
67 * {@hide}
68 */
69interface IWindowManager
70{
71 /**
Garfield Tana3f19032019-11-19 18:04:50 -080072 * No overridden behavior is provided in terms of fixing rotation to user rotation. Use
73 * other flags to derive the default behavior, such as {@link WindowManagerService#mIsPc}
74 * and {@link WindowManagerService#mForceDesktopModeOnExternalDisplays}.
75 */
76 const int FIXED_TO_USER_ROTATION_DEFAULT = 0;
77 /**
78 * Don't fix display rotation to {@link DisplayRotation#mUserRotation} only. Always allow
79 * other factors to play a role in deciding display rotation.
80 */
81 const int FIXED_TO_USER_ROTATION_DISABLED = 1;
82 /**
83 * Only use {@link DisplayRotation#mUserRotation} as the display rotation.
84 */
85 const int FIXED_TO_USER_ROTATION_ENABLED = 2;
86
87 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 * ===== NOTICE =====
89 * The first three methods must remain the first three methods. Scripts
90 * and tools rely on their transaction number to work properly.
91 */
92 // This is used for debugging
93 boolean startViewServer(int port); // Transaction #1
94 boolean stopViewServer(); // Transaction #2
95 boolean isViewServerRunning(); // Transaction #3
96
Yohei Yukawaa71bb252018-09-19 19:21:24 -070097 IWindowSession openSession(in IWindowSessionCallback callback);
Dianne Hackbornac8dea12011-04-20 18:18:51 -070098
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +000099 @UnsupportedAppUsage
Dianne Hackborn672cf452013-03-26 15:24:24 -0700100 void getInitialDisplaySize(int displayId, out Point size);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000101 @UnsupportedAppUsage
Dianne Hackborn672cf452013-03-26 15:24:24 -0700102 void getBaseDisplaySize(int displayId, out Point size);
Jeff Brown43aa1592012-09-10 17:36:31 -0700103 void setForcedDisplaySize(int displayId, int width, int height);
Craig Mautner59c00972012-07-30 12:10:24 -0700104 void clearForcedDisplaySize(int displayId);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000105 @UnsupportedAppUsage
Dianne Hackborn672cf452013-03-26 15:24:24 -0700106 int getInitialDisplayDensity(int displayId);
107 int getBaseDisplayDensity(int displayId);
Alan Viverettedf3a7ca2016-09-06 17:13:41 -0400108 void setForcedDisplayDensityForUser(int displayId, int density, int userId);
109 void clearForcedDisplayDensityForUser(int displayId, int userId);
Jeff Brownd46747a2015-04-15 19:02:36 -0700110 void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable
Dianne Hackborn7916ac62011-05-16 20:45:48 -0700111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 // These can only be called when holding the MANAGE_APP_TOKENS permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 void setEventDispatching(boolean enabled);
Andrii Kulian4a316972020-01-21 21:41:38 -0800114
115 /** @return {@code true} if this binder is a registered window token. */
116 boolean isWindowToken(in IBinder binder);
117 /**
118 * Adds window token for a given type.
119 *
120 * @param token Token to be registered.
121 * @param type Window type to be used with this token.
122 * @param displayId The ID of the display where this token should be added.
123 * @param packageName The name of package to request to add window token.
124 * @return {@link WindowManagerGlobal#ADD_OKAY} if the addition was successful, an error code
125 * otherwise.
126 */
127 int addWindowContextToken(IBinder token, int type, int displayId, String packageName);
Wale Ogunwaleac2561e2016-11-01 15:43:46 -0700128 void addWindowToken(IBinder token, int type, int displayId);
129 void removeWindowToken(IBinder token, int displayId);
Dianne Hackborn7da6ac32010-12-09 19:22:04 -0800130 void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
Jorim Jaggi2f7d2922015-10-29 13:08:29 +0100131
132 /**
Evan Rosky69cace42019-09-20 16:28:13 -0700133 * Sets a singular remote controller of display rotations. There can only be one. The
134 * controller is called after the display has "frozen" for a rotation and display rotation will
135 * only continue once the controller has finished calculating associated configurations.
136 */
137 void setDisplayWindowRotationController(IDisplayWindowRotationController controller);
138
139 /**
Evan Rosky22b6bbd2019-09-26 14:29:57 -0700140 * Adds a root container that a client shell can populate with its own windows (usually via
141 * WindowlessWindowManager).
142 *
143 * @param client an IWindow used for window-level communication (ime, finish draw, etc.).
144 * @param windowType used by WM to determine the z-order. This is the same as the window type
145 * used in {@link WindowManager.LayoutParams}.
146 * @return a SurfaceControl to add things to.
147 */
148 SurfaceControl addShellRoot(int displayId, IWindow client, int windowType);
149
150 /**
Jorim Jaggi2f7d2922015-10-29 13:08:29 +0100151 * Like overridePendingAppTransitionMultiThumb, but uses a future to supply the specs. This is
152 * used for recents, where generating the thumbnails of the specs takes a non-trivial amount of
153 * time, so we want to move that off the critical path for starting the new activity.
154 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000155 @UnsupportedAppUsage
Jorim Jaggi2f7d2922015-10-29 13:08:29 +0100156 void overridePendingAppTransitionMultiThumbFuture(
157 IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
lumarka483f312018-11-20 15:24:05 +0800158 boolean scaleUp, int displayId);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000159 @UnsupportedAppUsage
lumarka483f312018-11-20 15:24:05 +0800160 void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter,
161 int displayId);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000162 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800163 void executeAppTransition();
Wale Ogunwale3b232392016-05-13 15:37:13 -0700164
Jorim Jaggi66b48df2018-04-20 16:23:48 +0200165 /**
166 * Used by system ui to report that recents has shown itself.
167 * @deprecated to be removed once prebuilts are updated
168 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000169 @UnsupportedAppUsage
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800170 void endProlongedAnimations();
171
Dianne Hackborn9d9ece32012-09-10 15:33:52 -0700172 void startFreezingScreen(int exitAnim, int enterAnim);
173 void stopFreezingScreen();
174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 // these require DISABLE_KEYGUARD permission
Adrian Roos1c8e3c02018-11-20 20:07:55 +0100176 /** @deprecated use Activity.setShowWhenLocked instead. */
177 void disableKeyguard(IBinder token, String tag, int userId);
178 /** @deprecated use Activity.setShowWhenLocked instead. */
179 void reenableKeyguard(IBinder token, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000181 @UnsupportedAppUsage
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500182 boolean isKeyguardLocked();
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000183 @UnsupportedAppUsage
Brad Stenning2bdc21e2019-03-11 14:33:22 -0700184 boolean isKeyguardSecure(int userId);
Lucas Dupinc80c67e2017-12-04 14:29:10 -0800185 void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800186
Evan Rosky18396452016-07-27 15:19:37 -0700187 // Requires INTERACT_ACROSS_USERS_FULL permission
188 void setSwitchingUser(boolean switching);
189
Dianne Hackbornffa42482009-09-23 22:20:11 -0700190 void closeSystemDialogs(String reason);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800191
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192 // These can only be called with the SET_ANIMATON_SCALE permission.
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000193 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 float getAnimationScale(int which);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000195 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196 float[] getAnimationScales();
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000197 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800198 void setAnimationScale(int which, float scale);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000199 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800200 void setAnimationScales(in float[] scales);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800201
Dianne Hackborneb94fa72014-06-03 17:48:12 -0700202 float getCurrentAnimatorScale();
203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800204 // For testing
Artur Satayev70507ed2019-07-29 13:18:27 +0100205 @UnsupportedAppUsage(maxTargetSdk = 28)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800206 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800207
208 // For StrictMode flashing a red border on violations from the UI
209 // thread. The uid/pid is implicit from the Binder call, and the Window
210 // Manager uses that to determine whether or not the red border should
211 // actually be shown. (it will be ignored that pid doesn't have windows
212 // on screen)
Artur Satayev70507ed2019-07-29 13:18:27 +0100213 @UnsupportedAppUsage(maxTargetSdk = 28)
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800214 void showStrictModeViolation(boolean on);
215
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800216 // Proxy to set the system property for whether the flashing
217 // should be enabled. The 'enabled' value is null or blank for
218 // the system default (differs per build variant) or any valid
219 // boolean string as parsed by SystemProperties.getBoolean().
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000220 @UnsupportedAppUsage
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800221 void setStrictModeVisualIndicatorPreference(String enabled);
222
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100223 /**
Makoto Onuki04ef4472018-03-12 17:29:49 -0700224 * Set whether screen capture is disabled for all windows of a specific user from
225 * the device policy cache.
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100226 */
Makoto Onuki04ef4472018-03-12 17:29:49 -0700227 void refreshScreenCaptureDisabled(int userId);
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800229 // These can only be called with the SET_ORIENTATION permission.
230 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700231 * Update the current screen rotation based on the current state of
232 * the world.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800233 * @param alwaysSendConfiguration Flag to force a new configuration to
234 * be evaluated. This can be used when there are other parameters in
235 * configuration that are changing.
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700236 * @param forceRelayout If true, the window manager will always do a relayout
237 * of its windows even if the rotation hasn't changed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800238 */
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700239 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800240
241 /**
Andrii Kulian8ee72852017-03-10 10:36:45 -0800242 * Retrieve the current orientation of the primary screen.
243 * @return Constant as per {@link android.view.Surface.Rotation}.
244 *
245 * @see android.view.Display#DEFAULT_DISPLAY
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246 */
Andrii Kulian8ee72852017-03-10 10:36:45 -0800247 int getDefaultDisplayRotation();
Jim Miller4eeb4f62012-11-08 00:04:29 -0800248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 /**
Andrii Kulian35fa3c22017-03-11 09:37:28 -0800250 * Watch the rotation of the specified screen. Returns the current rotation,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800251 * calls back when it changes.
252 */
Andrii Kulian35fa3c22017-03-11 09:37:28 -0800253 int watchRotation(IRotationWatcher watcher, int displayId);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400254
Adam Powelldfee59a2011-08-05 20:48:30 -0700255 /**
Brian Colonnab1b9a8a2013-03-29 11:52:42 -0400256 * Remove a rotation watcher set using watchRotation.
257 * @hide
258 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000259 @UnsupportedAppUsage
Brian Colonnab1b9a8a2013-03-29 11:52:42 -0400260 void removeRotationWatcher(IRotationWatcher watcher);
261
262 /**
Adam Powelldfee59a2011-08-05 20:48:30 -0700263 * Determine the preferred edge of the screen to pin the compact options menu against.
Riddle Hsua4d6fa22018-08-11 00:50:39 +0800264 *
265 * @param displayId Id of the display where the menu window currently resides.
266 * @return a Gravity value for the options menu panel.
Adam Powelldfee59a2011-08-05 20:48:30 -0700267 * @hide
268 */
Riddle Hsua4d6fa22018-08-11 00:50:39 +0800269 int getPreferredOptionsPanelGravity(int displayId);
Adam Powelldfee59a2011-08-05 20:48:30 -0700270
Jim Miller4eeb4f62012-11-08 00:04:29 -0800271 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700272 * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link
273 * android.view.Display#DEFAULT_DISPLAY} and given rotation.
Jim Miller4eeb4f62012-11-08 00:04:29 -0800274 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000275 @UnsupportedAppUsage
Jim Miller4eeb4f62012-11-08 00:04:29 -0800276 void freezeRotation(int rotation);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400277
Jim Miller4eeb4f62012-11-08 00:04:29 -0800278 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700279 * Equivalent to calling {@link #thawDisplayRotation(int)} with {@link
280 * android.view.Display#DEFAULT_DISPLAY}.
Jim Miller4eeb4f62012-11-08 00:04:29 -0800281 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000282 @UnsupportedAppUsage
Jim Miller4eeb4f62012-11-08 00:04:29 -0800283 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800284
Jim Miller4eeb4f62012-11-08 00:04:29 -0800285 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700286 * Equivelant to call {@link #isDisplayRotationFrozen(int)} with {@link
287 * android.view.Display#DEFAULT_DISPLAY}.
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800288 */
289 boolean isRotationFrozen();
290
291 /**
Garfield Tan90c90052018-10-08 12:29:41 -0700292 * Lock the display orientation to the specified rotation, or to the current
293 * rotation if -1. Sensor input will be ignored until thawRotation() is called.
294 *
295 * @param displayId the ID of display which rotation should be frozen.
296 * @param rotation one of {@link android.view.Surface#ROTATION_0},
297 * {@link android.view.Surface#ROTATION_90}, {@link android.view.Surface#ROTATION_180},
298 * {@link android.view.Surface#ROTATION_270} or -1 to freeze it to current rotation.
299 * @hide
300 */
301 void freezeDisplayRotation(int displayId, int rotation);
302
303 /**
304 * Release the orientation lock imposed by freezeRotation() on the display.
305 *
306 * @param displayId the ID of display which rotation should be thawed.
307 * @hide
308 */
309 void thawDisplayRotation(int displayId);
310
311 /**
312 * Gets whether the rotation is frozen on the display.
313 *
314 * @param displayId the ID of display which frozen is needed.
315 * @return Whether the rotation is frozen.
316 */
317 boolean isDisplayRotationFrozen(int displayId);
318
319 /**
Garfield Tana3f19032019-11-19 18:04:50 -0800320 * Sets if display rotation is fixed to user specified value for given displayId.
321 */
322 void setFixedToUserRotation(int displayId, int fixedToUserRotation);
323
324 /**
Zak Cohen3683fb12016-07-11 19:47:37 +0100325 * Screenshot the current wallpaper layer, including the whole screen.
326 */
327 Bitmap screenshotWallpaper();
328
329 /**
Lucas Dupine1571702017-05-24 14:14:44 -0700330 * Registers a wallpaper visibility listener.
331 * @return Current visibility.
332 */
333 boolean registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
334 int displayId);
335
336 /**
337 * Remove a visibility watcher that was added using registerWallpaperVisibilityListener.
338 */
339 void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
340 int displayId);
341
342 /**
Adrian Roos4ffc8972019-02-07 20:45:11 +0100343 * Registers a system gesture exclusion listener for a given display.
344 */
345 void registerSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
346 int displayId);
347
348 /**
349 * Unregisters a system gesture exclusion listener for a given display.
350 */
351 void unregisterSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
352 int displayId);
353
354 /**
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700355 * Used only for assist -- request a screenshot of the current application.
356 */
Winson Chungda2818f2017-10-23 16:25:49 -0700357 boolean requestAssistScreenshot(IAssistDataReceiver receiver);
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700358
359 /**
Joe Onorato664644d2011-01-23 17:53:23 -0800360 * Called by the status bar to notify Views of changes to System UI visiblity.
361 */
Tiger Huang7c610aa2018-10-27 00:01:01 +0800362 oneway void statusBarVisibilityChanged(int displayId, int visibility);
Jeff Brown1a84fd12011-06-02 01:26:32 -0700363
364 /**
Jorim Jaggi956ca412019-01-07 14:49:14 +0100365 * Called by System UI to notify Window Manager to hide transient bars.
366 */
367 oneway void hideTransientBars(int displayId);
368
369 /**
Brad Stenninge0573692019-03-11 13:52:46 -0700370 * When set to {@code true} the system bars will always be shown. This is true even if an app
371 * requests to be fullscreen by setting the system ui visibility flags. The
372 * functionality was added for the automotive case as a way to guarantee required content stays
373 * on screen at all times.
374 *
375 * @hide
376 */
377 oneway void setForceShowSystemBars(boolean show);
378
379 /**
Winsonab216602016-08-09 14:05:20 -0700380 * Called by System UI to notify of changes to the visibility of Recents.
381 */
382 oneway void setRecentsVisibility(boolean visible);
383
384 /**
385 * Called by System UI to notify of changes to the visibility of PIP.
386 */
Winson Chungac52f282017-03-30 14:44:52 -0700387 oneway void setPipVisibility(boolean visible);
Winsonab216602016-08-09 14:05:20 -0700388
Tracy Zhou43513082018-03-08 21:58:36 -0800389 /**
Matthew Ng64543e62018-02-28 17:35:10 -0800390 * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
391 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000392 @UnsupportedAppUsage
Matthew Ng64543e62018-02-28 17:35:10 -0800393 void setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled);
394
Winsonab216602016-08-09 14:05:20 -0700395 /**
Charles Chenea6e7f02018-11-19 21:37:45 +0800396 * Device has a software navigation bar (separate from the status bar) on specific display.
397 *
398 * @param displayId the id of display to check if there is a software navigation bar.
Daniel Sandler0c4ccff2011-10-19 16:39:14 -0400399 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000400 @UnsupportedAppUsage
Charles Chenea6e7f02018-11-19 21:37:45 +0800401 boolean hasNavigationBar(int displayId);
Jim Miller93c518e2012-01-17 15:55:31 -0800402
403 /**
Tracy Zhou43513082018-03-08 21:58:36 -0800404 * Get the position of the nav bar
405 */
Tiger Huang44c04552018-11-29 20:06:45 +0800406 int getNavBarPosition(int displayId);
Matthew Nga8f24262017-12-19 11:54:24 -0800407
408 /**
Adam Cohenf7522022012-10-03 20:03:18 -0700409 * Lock the device immediately with the specified options (can be null).
Jim Miller93c518e2012-01-17 15:55:31 -0800410 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000411 @UnsupportedAppUsage
Adam Cohenf7522022012-10-03 20:03:18 -0700412 void lockNow(in Bundle options);
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -0700413
414 /**
Jim Millerbfec0a82012-11-05 20:05:22 -0800415 * Device is in safe mode.
416 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000417 @UnsupportedAppUsage
Jim Millerbfec0a82012-11-05 20:05:22 -0800418 boolean isSafeModeEnabled();
Jorim Jaggicff0acb2014-03-31 16:35:15 +0200419
420 /**
421 * Enables the screen if all conditions are met.
422 */
423 void enableScreenIfNeeded();
Svetoslavdd137a82014-04-10 12:48:07 -0700424
425 /**
Svetoslav1376d602014-03-13 11:17:26 -0700426 * Clears the frame statistics for a given window.
427 *
428 * @param token The window token.
429 * @return Whether the frame statistics were cleared.
430 */
431 boolean clearWindowContentFrameStats(IBinder token);
432
433 /**
434 * Gets the content frame statistics for a given window.
435 *
436 * @param token The window token.
437 * @return The frame statistics or null if the window does not exist.
438 */
439 WindowContentFrameStats getWindowContentFrameStats(IBinder token);
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100440
441 /**
442 * @return the dock side the current docked stack is at; must be one of the
443 * WindowManagerGlobal.DOCKED_* values
444 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000445 @UnsupportedAppUsage
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100446 int getDockedStackSide();
447
448 /**
Jorim Jaggid47e7e12016-03-01 09:57:38 +0100449 * Sets the region the user can touch the divider. This region will be excluded from the region
450 * which is used to cause a focus switch when dispatching touch.
451 */
452 void setDockedStackDividerTouchRegion(in Rect touchableRegion);
453
454 /**
Jorim Jaggia6c934e2015-12-21 13:22:31 +0100455 * Registers a listener that will be called when the dock divider changes its visibility or when
456 * the docked stack gets added/removed.
Filip Gruszczynski64cdc142015-11-29 21:10:07 -0800457 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000458 @UnsupportedAppUsage
Jorim Jaggia6c934e2015-12-21 13:22:31 +0100459 void registerDockedStackListener(IDockedStackListener listener);
Jorim Jaggi50981592015-12-29 17:54:12 +0100460
461 /**
Winson Chung655332c2016-10-31 13:14:28 -0700462 * Registers a listener that will be called when the pinned stack state changes.
463 */
464 void registerPinnedStackListener(int displayId, IPinnedStackListener listener);
465
466 /**
Jorim Jaggi50981592015-12-29 17:54:12 +0100467 * Updates the dim layer used while resizing.
468 *
469 * @param visible Whether the dim layer should be visible.
Wale Ogunwale68278562017-09-23 17:13:55 -0700470 * @param targetWindowingMode The windowing mode of the stack the dim layer should be placed on.
Jorim Jaggi50981592015-12-29 17:54:12 +0100471 * @param alpha The translucency of the dim layer, between 0 and 1.
472 */
Wale Ogunwale68278562017-09-23 17:13:55 -0700473 void setResizeDimLayer(boolean visible, int targetWindowingMode, float alpha);
Clara Bayarri75e09792015-07-29 16:20:40 +0100474
475 /**
476 * Requests Keyboard Shortcuts from the displayed window.
477 *
478 * @param receiver The receiver to deliver the results to.
479 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000480 void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId);
Jorim Jaggic6c89a82016-01-28 17:48:21 -0800481
482 /**
483 * Retrieves the current stable insets from the primary display.
484 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000485 @UnsupportedAppUsage
Winson Chung303c6b72016-10-24 17:12:49 -0700486 void getStableInsets(int displayId, out Rect outInsets);
Muyuan Li94ce94e2016-02-24 16:20:54 -0800487
488 /**
Issei Suzukia5dbf522019-02-01 17:58:15 +0100489 * Set the forwarded insets on the display.
490 * <p>
491 * This is only used in case a virtual display is displayed on another display that has insets,
492 * and the bounds of the virtual display is overlapping with the insets from the host display.
493 * In that case, the contents on the virtual display won't be placed over the forwarded insets.
494 * Only the owner of the display is permitted to set the forwarded insets on it.
495 */
496 void setForwardedInsets(int displayId, in Insets insets);
497
498 /**
Muyuan Li94ce94e2016-02-24 16:20:54 -0800499 * Register shortcut key. Shortcut code is packed as:
500 * (MetaState << Integer.SIZE) | KeyCode
501 * @hide
502 */
503 void registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber);
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700504
505 /**
Arthur Hung39134b22018-08-14 11:58:28 +0800506 * Create an input consumer by name and display id.
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700507 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000508 @UnsupportedAppUsage
Arthur Hung39134b22018-08-14 11:58:28 +0800509 void createInputConsumer(IBinder token, String name, int displayId,
510 out InputChannel inputChannel);
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700511
512 /**
Arthur Hung39134b22018-08-14 11:58:28 +0800513 * Destroy an input consumer by name and display id.
514 * This method will also dispose the input channels associated with that InputConsumer.
Vladislav Kaznacheev0d50d862016-03-29 15:43:28 -0700515 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000516 @UnsupportedAppUsage
Arthur Hung39134b22018-08-14 11:58:28 +0800517 boolean destroyInputConsumer(String name, int displayId);
Albert Chaulk56162a02017-06-05 19:35:23 -0400518
519 /**
520 * Return the touch region for the current IME window, or an empty region if there is none.
521 */
522 Region getCurrentImeTouchRegion();
Vishnu Nairc9615042018-01-09 07:23:31 -0800523
524 /**
Adrian Roos962017e2018-11-27 15:11:46 +0100525 * Registers an IDisplayFoldListener.
526 */
527 void registerDisplayFoldListener(IDisplayFoldListener listener);
528
529 /**
530 * Unregisters an IDisplayFoldListener.
531 */
532 void unregisterDisplayFoldListener(IDisplayFoldListener listener);
533
534 /**
Evan Rosky69cace42019-09-20 16:28:13 -0700535 * Registers an IDisplayContainerListener
536 */
537 void registerDisplayWindowListener(IDisplayWindowListener listener);
538
539 /**
540 * Unregisters an IDisplayContainerListener.
541 */
542 void unregisterDisplayWindowListener(IDisplayWindowListener listener);
543
544 /**
Vishnu Nairc9615042018-01-09 07:23:31 -0800545 * Starts a window trace.
546 */
547 void startWindowTrace();
548
549 /**
550 * Stops a window trace.
551 */
552 void stopWindowTrace();
553
554 /**
555 * Returns true if window trace is enabled.
556 */
557 boolean isWindowTraceEnabled();
Yoshiaki Nakae1bdfc822017-09-15 15:24:34 +0900558
559 /**
Jordan Liuc0228762018-07-13 11:39:42 -0700560 * Requests that the WindowManager sends
561 * WindowManagerPolicyConstants#ACTION_USER_ACTIVITY_NOTIFICATION on the next user activity.
Yoshiaki Nakae1bdfc822017-09-15 15:24:34 +0900562 */
563 void requestUserActivityNotification();
Andrii Kulianf0379de2018-03-14 16:24:07 -0700564
565 /**
566 * Notify WindowManager that it should not override the info in DisplayManager for the specified
567 * display. This can disable letter- or pillar-boxing applied in DisplayManager when the metrics
568 * of the logical display reported from WindowManager do not correspond to the metrics of the
569 * physical display it is based on.
570 *
571 * @param displayId The id of the display.
572 */
573 void dontOverrideDisplayInfo(int displayId);
Chilun8753ad32018-10-09 15:56:45 +0800574
575 /**
576 * Gets the windowing mode of the display.
577 *
578 * @param displayId The id of the display.
579 * @return {@link WindowConfiguration.WindowingMode}
580 */
581 int getWindowingMode(int displayId);
582
583 /**
584 * Sets the windowing mode of the display.
585 *
586 * @param displayId The id of the display.
587 * @param mode {@link WindowConfiguration.WindowingMode}
588 */
589 void setWindowingMode(int displayId, int mode);
590
591 /**
592 * Gets current remove content mode of the display.
593 * <p>
594 * What actions should be performed with the display's content when it is removed. Default
595 * behavior for public displays in this case is to move all activities to the primary display
596 * and make it focused. For private display is to destroy all activities.
597 * </p>
598 *
599 * @param displayId The id of the display.
600 * @return The remove content mode of the display.
601 * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
602 * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
603 */
604 int getRemoveContentMode(int displayId);
605
606 /**
607 * Sets the remove content mode of the display.
608 * <p>
609 * This mode indicates what actions should be performed with the display's content when it is
610 * removed.
611 * </p>
612 *
613 * @param displayId The id of the display.
614 * @param mode Remove content mode.
615 * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
616 * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
617 */
618 void setRemoveContentMode(int displayId, int mode);
619
620 /**
621 * Indicates that the display should show its content when non-secure keyguard is shown.
622 * <p>
623 * This flag identifies secondary displays that will continue showing content if keyguard can be
624 * dismissed without entering credentials.
625 * </p><p>
626 * An example of usage is a virtual display which content is displayed on external hardware
627 * display that is not visible to the system directly.
628 * </p>
629 *
630 * @param displayId The id of the display.
631 * @return {@code true} if the display should show its content when non-secure keyguard is
632 * shown.
633 * @see KeyguardManager#isDeviceSecure()
634 * @see KeyguardManager#isDeviceLocked()
635 */
636 boolean shouldShowWithInsecureKeyguard(int displayId);
637
638 /**
639 * Sets that the display should show its content when non-secure keyguard is shown.
640 *
641 * @param displayId The id of the display.
642 * @param shouldShow Indicates that the display should show its content when non-secure keyguard
643 * is shown.
644 * @see KeyguardManager#isDeviceSecure()
645 * @see KeyguardManager#isDeviceLocked()
646 */
647 void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow);
648
649 /**
650 * Indicates the display should show system decors.
651 * <p>
652 * System decors include status bar, navigation bar, launcher.
653 * </p>
654 *
655 * @param displayId The id of the display.
656 * @return {@code true} if the display should show system decors.
657 */
658 boolean shouldShowSystemDecors(int displayId);
659
660 /**
661 * Sets that the display should show system decors.
662 * <p>
663 * System decors include status bar, navigation bar, launcher.
664 * </p>
665 *
666 * @param displayId The id of the display.
667 * @param shouldShow Indicates that the display should show system decors.
668 */
669 void setShouldShowSystemDecors(int displayId, boolean shouldShow);
670
671 /**
672 * Indicates that the display should show IME.
673 *
674 * @param displayId The id of the display.
675 * @return {@code true} if the display should show IME.
676 * @see KeyguardManager#isDeviceSecure()
677 * @see KeyguardManager#isDeviceLocked()
678 */
679 boolean shouldShowIme(int displayId);
680
681 /**
682 * Sets that the display should show IME.
683 *
684 * @param displayId The id of the display.
685 * @param shouldShow Indicates that the display should show IME.
686 * @see KeyguardManager#isDeviceSecure()
687 * @see KeyguardManager#isDeviceLocked()
688 */
689 void setShouldShowIme(int displayId, boolean shouldShow);
chaviwff2e7d82018-11-02 11:11:27 -0700690
chaviw504715c2019-02-14 11:02:43 -0800691 /**
692 * Waits for transactions to get applied before injecting input.
693 * This includes waiting for the input windows to get sent to InputManager.
694 *
695 * This is needed for testing since the system add windows and injects input
696 * quick enough that the windows don't have time to get sent to InputManager.
697 */
chaviw84dec9f2019-04-22 13:39:46 -0700698 boolean injectInputAfterTransactionsApplied(in InputEvent ev, int mode);
699
700 /**
701 * Waits until all animations have completed and input information has been sent from
702 * WindowManager to native InputManager.
703 *
704 * This is needed for testing since we need to ensure input information has been propagated to
705 * native InputManager before proceeding with tests.
706 */
707 void syncInputTransactions();
Winson Chungbe2bdb032019-08-30 16:49:13 -0700708
709 /**
710 * Returns whether SurfaceFlinger layer tracing is enabled.
711 */
712 boolean isLayerTracing();
713
714 /**
715 * Enables/disables SurfaceFlinger layer tracing.
716 */
717 void setLayerTracing(boolean enabled);
chaviwa51724f2019-09-19 09:50:11 -0700718
719 /**
720 * Mirrors a specified display. The root of the mirrored hierarchy will be stored in
721 * outSurfaceControl.
722 * Requires the ACCESS_SURFACE_FLINGER permission.
723 *
724 * @param displayId The id of the display to mirror
725 * @param outSurfaceControl The SurfaceControl for the root of the mirrored hierarchy.
726 *
727 * @return true if the display was successfully mirrored.
728 */
729 boolean mirrorDisplay(int displayId, out SurfaceControl outSurfaceControl);
Evan Rosky8d782e02019-10-14 15:43:53 -0700730
731 /**
732 * When in multi-window mode, the provided displayWindowInsetsController will control insets
733 * animations.
734 */
735 void setDisplayWindowInsetsController(
736 int displayId, in IDisplayWindowInsetsController displayWindowInsetsController);
737
738 /**
739 * Called when a remote process modifies insets on a display window container.
740 */
741 void modifyDisplayWindowInsets(int displayId, in InsetsState state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742}