blob: dfe89a37a2299f38a61f667023a397e206dbb193 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/* //device/java/android/android/view/IWindowSession.aidl
2**
3** Copyright 2006, The Android Open Source Project
4**
Vishnu Nairf7645aa2019-06-18 11:14:01 -07005** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008**
Vishnu Nairf7645aa2019-06-18 11:14:01 -07009** http://www.apache.org/licenses/LICENSE-2.0
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080010**
Vishnu Nairf7645aa2019-06-18 11:14:01 -070011** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Andrii Kulian44607962017-03-16 11:06:24 -070014** See the License for the specific language governing permissions and
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080015** limitations under the License.
16*/
17
18package android.view;
19
Christopher Tatea53146c2010-09-07 11:57:52 -070020import android.content.ClipData;
Valerie Hau30360552020-01-14 16:12:01 -080021import android.graphics.Point;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.graphics.Rect;
23import android.graphics.Region;
Dianne Hackborn75804932009-10-20 20:15:20 -070024import android.os.Bundle;
Andrii Kulian44607962017-03-16 11:06:24 -070025import android.util.MergedConfiguration;
Adrian Roos5c6b6222017-11-07 17:36:10 +010026import android.view.DisplayCutout;
Jeff Brown46b9ac02010-04-22 18:58:52 -070027import android.view.InputChannel;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.view.IWindow;
Dianne Hackborne3f23a32013-03-01 13:25:35 -080029import android.view.IWindowId;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.view.MotionEvent;
31import android.view.WindowManager;
Jorim Jaggif96c90a2018-09-26 16:55:15 +020032import android.view.InsetsState;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.view.Surface;
Daichi Hironoa1fb9be2017-12-18 17:02:54 +090034import android.view.SurfaceControl;
Vishnu Nair676cdb32019-09-12 09:27:43 -070035import android.view.SurfaceControl.Transaction;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036
Adrian Roos4ffc8972019-02-07 20:45:11 +010037import java.util.List;
38
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039/**
40 * System private per-application interface to the window manager.
41 *
42 * {@hide}
43 */
44interface IWindowSession {
Craig Mautner6881a102012-07-27 13:04:51 -070045 int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos9e370f22018-03-06 18:19:45 +010046 in int viewVisibility, in int layerStackId, out Rect outFrame,
Jorim Jaggif081f062019-10-24 16:24:54 +020047 out Rect outContentInsets, out Rect outStableInsets,
Jorim Jaggif96c90a2018-09-26 16:55:15 +020048 out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel,
49 out InsetsState insetsState);
Craig Mautner6881a102012-07-27 13:04:51 -070050 int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos37d7a682014-11-06 18:15:16 +010051 in int viewVisibility, in int layerStackId, out Rect outContentInsets,
Jorim Jaggif96c90a2018-09-26 16:55:15 +020052 out Rect outStableInsets, out InsetsState insetsState);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +000053 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054 void remove(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -070055
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 /**
57 * Change the parameters of a window. You supply the
58 * new parameters, it returns the new frame of the window on screen (the
59 * position should be ignored) and surface of the window. The surface
60 * will be invalid if the window is currently hidden, else you can use it
61 * to draw the window's contents.
Vishnu Nairf7645aa2019-06-18 11:14:01 -070062 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 * @param window The window being modified.
Dianne Hackborn9a230e02011-10-06 11:51:27 -070064 * @param seq Ordering sequence number.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 * @param attrs If non-null, new attributes to apply to the window.
66 * @param requestedWidth The width the window wants to be.
67 * @param requestedHeight The height the window wants to be.
68 * @param viewVisibility Window root view's visibility.
Jeff Brown98365d72012-08-19 20:30:52 -070069 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING},
70 * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}.
chaviwbe43ac82018-04-04 15:14:49 -070071 * @param frameNumber A frame number in which changes requested in this layout will be rendered.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 * @param outFrame Rect in which is placed the new position/size on
73 * screen.
74 * @param outContentInsets Rect in which is placed the offsets from
75 * <var>outFrame</var> in which the content of the window should be
76 * placed. This can be used to modify the window layout to ensure its
77 * contents are visible to the user, taking into account system windows
78 * like the status bar or a soft keyboard.
79 * @param outVisibleInsets Rect in which is placed the offsets from
80 * <var>outFrame</var> in which the window is actually completely visible
81 * to the user. This can be used to temporarily scroll the window's
82 * contents to make sure the user can see it. This is different than
83 * <var>outContentInsets</var> in that these insets change transiently,
84 * so complex relayout of the window should not happen based on them.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070085 * @param outOutsets Rect in which is placed the dead area of the screen that we would like to
86 * treat as real display. Example of such area is a chin in some models of wearable devices.
Jorim Jaggi2e95a482016-01-14 17:36:55 -080087 * @param outBackdropFrame Rect which is used draw the resizing background during a resize
88 * operation.
Andrii Kulian44607962017-03-16 11:06:24 -070089 * @param outMergedConfiguration New config container that holds global, override and merged
90 * config for window, if it is now becoming visible and the merged configuration has changed
91 * since it was last displayed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 * @param outSurface Object in which is placed the new display surface.
Jorim Jaggif96c90a2018-09-26 16:55:15 +020093 * @param insetsState The current insets state in the system.
Valerie Hau30360552020-01-14 16:12:01 -080094 * @param outSurfaceSize The width and height of the surface control
Robert Carr2e20bcd2020-01-22 13:32:38 -080095 * @param outBlastSurfaceControl A BLAST SurfaceControl allocated by the WindowManager
96 * the SurfaceControl willl be managed by the client side, but the WindowManager
97 * may use it as a deferTransaction barrier.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070098 *
Jeff Brown98365d72012-08-19 20:30:52 -070099 * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS},
100 * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 */
Dianne Hackborn9a230e02011-10-06 11:51:27 -0700102 int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 int requestedWidth, int requestedHeight, int viewVisibility,
Jorim Jaggif081f062019-10-24 16:24:54 +0200104 int flags, long frameNumber, out Rect outFrame,
Adrian Roosfa104232014-06-20 16:10:14 -0700105 out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets,
Jorim Jaggif081f062019-10-24 16:24:54 +0200106 out Rect outBackdropFrame,
Adrian Roos5c6b6222017-11-07 17:36:10 +0100107 out DisplayCutout.ParcelableWrapper displayCutout,
Robert Carr5fea55b2018-12-10 13:05:52 -0800108 out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl,
Robert Carr2e20bcd2020-01-22 13:32:38 -0800109 out InsetsState insetsState, out Point outSurfaceSize,
110 out SurfaceControl outBlastSurfaceControl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111
Robert Carr23fa16b2016-01-13 13:19:58 -0800112 /*
113 * Notify the window manager that an application is relaunching and
Robert Carr77bdfb52016-05-02 18:18:31 -0700114 * windows should be prepared for replacement.
Robert Carr23fa16b2016-01-13 13:19:58 -0800115 *
116 * @param appToken The application
Robert Carr77bdfb52016-05-02 18:18:31 -0700117 * @param childrenOnly Whether to only prepare child windows for replacement
118 * (for example when main windows are being reused via preservation).
Robert Carr23fa16b2016-01-13 13:19:58 -0800119 */
Robert Carr77bdfb52016-05-02 18:18:31 -0700120 void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
Robert Carr23fa16b2016-01-13 13:19:58 -0800121
Rob Carr64e516f2015-10-29 00:20:45 +0000122 /**
Dianne Hackborn64825172011-03-02 21:32:58 -0800123 * Called by a client to report that it ran out of graphics memory.
124 */
125 boolean outOfMemory(IWindow window);
126
127 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 * Give the window manager a hint of the part of the window that is
129 * completely transparent, allowing it to work with the surface flinger
130 * to optimize compositing of this part of the window.
131 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000132 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 void setTransparentRegion(IWindow window, in Region region);
Svetoslavf7174e82014-06-12 11:29:35 -0700134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 /**
136 * Tell the window manager about the content and visible insets of the
137 * given window, which can be used to adjust the <var>outContentInsets</var>
138 * and <var>outVisibleInsets</var> values returned by
139 * {@link #relayout relayout()} for windows behind this one.
140 *
141 * @param touchableInsets Controls which part of the window inside of its
142 * frame can receive pointer events, as defined by
143 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}.
144 */
145 void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
Jeff Brownfbf09772011-01-16 14:06:57 -0800146 in Rect visibleInsets, in Region touchableRegion);
Svetoslavf7174e82014-06-12 11:29:35 -0700147
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148 /**
149 * Return the current display size in which the window is being laid out,
150 * accounting for screen decorations around it.
151 */
152 void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
Svetoslavf7174e82014-06-12 11:29:35 -0700153
Vishnu Nairf7645aa2019-06-18 11:14:01 -0700154 /**
155 * Called when the client has finished drawing the surface, if needed.
156 *
157 * @param postDrawTransaction transaction filled by the client that can be
158 * used to synchronize any post draw transactions with the server. Transaction
159 * is null if there is no sync required.
160 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000161 @UnsupportedAppUsage
Vishnu Nair676cdb32019-09-12 09:27:43 -0700162 void finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction);
Svetoslavf7174e82014-06-12 11:29:35 -0700163
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000164 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 void setInTouchMode(boolean showFocus);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000166 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 boolean getInTouchMode();
Svetoslavf7174e82014-06-12 11:29:35 -0700168
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000169 @UnsupportedAppUsage
Arthur Hunga4c52062019-02-19 11:31:44 +0800170 boolean performHapticFeedback(int effectId, boolean always);
Svetoslavf7174e82014-06-12 11:29:35 -0700171
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700172 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700173 * Initiate the drag operation itself
Daichi Hironofabca092017-12-19 15:02:50 +0900174 *
175 * @param window Window which initiates drag operation.
176 * @param flags See {@code View#startDragAndDrop}
177 * @param surface Surface containing drag shadow image
178 * @param touchSource See {@code InputDevice#getSource()}
Daichi Hirono1456b922018-01-24 15:37:26 +0900179 * @param touchX X coordinate of last touch point
180 * @param touchY Y coordinate of last touch point
Daichi Hironofabca092017-12-19 15:02:50 +0900181 * @param thumbCenterX X coordinate for the position within the shadow image that should be
182 * underneath the touch point during the drag and drop operation.
183 * @param thumbCenterY Y coordinate for the position within the shadow image that should be
184 * underneath the touch point during the drag and drop operation.
185 * @param data Data transferred by drag and drop
186 * @return Token of drag operation which will be passed to cancelDragAndDrop.
Christopher Tatea53146c2010-09-07 11:57:52 -0700187 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000188 @UnsupportedAppUsage
Daichi Hironofabca092017-12-19 15:02:50 +0900189 IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource,
Vladislav Kaznacheevba761122016-01-22 12:09:45 -0800190 float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
Christopher Tatea53146c2010-09-07 11:57:52 -0700191
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900192 /**
Svetoslavf7174e82014-06-12 11:29:35 -0700193 * Report the result of a drop action targeted to the given window.
194 * consumed is 'true' when the drop was accepted by a valid recipient,
195 * 'false' otherwise.
196 */
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900197 void reportDropResult(IWindow window, boolean consumed);
Chris Tated4533f12010-10-19 15:15:08 -0700198
Christopher Tatea53146c2010-09-07 11:57:52 -0700199 /**
Vladislav Kaznacheev82063912015-11-20 14:20:13 -0800200 * Cancel the current drag operation.
Daichi Hirono3e9d5102019-04-15 15:58:11 +0900201 * skipAnimation is 'true' when it should skip the drag cancel animation which brings the drag
202 * shadow image back to the drag start position.
Vladislav Kaznacheev82063912015-11-20 14:20:13 -0800203 */
Daichi Hirono3e9d5102019-04-15 15:58:11 +0900204 void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation);
Vladislav Kaznacheev82063912015-11-20 14:20:13 -0800205
206 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700207 * Tell the OS that we've just dragged into a View that is willing to accept the drop
208 */
209 void dragRecipientEntered(IWindow window);
210
211 /**
212 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
213 */
214 void dragRecipientExited(IWindow window);
215
216 /**
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700217 * For windows with the wallpaper behind them, and the wallpaper is
218 * larger than the screen, set the offset within the screen.
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800219 * For multi screen launcher type applications, xstep and ystep indicate
220 * how big the increment is from one screen to another.
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700221 */
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800222 void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
Svetoslavf7174e82014-06-12 11:29:35 -0700223
Lucas Dupin13f4b8a2020-02-19 13:41:52 -0800224 /**
225 * For wallpaper windows, sets the scale of the wallpaper based on
226 * SystemUI behavior.
227 */
228 void setWallpaperZoomOut(IBinder windowToken, float scale);
229
230 /**
231 * For wallpaper windows, sets whether the wallpaper should actually be
232 * scaled when setWallpaperZoomOut is called. If set to false, the WallpaperService will
233 * receive the zoom out value but the surface won't be scaled.
234 */
235 void setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom);
236
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000237 @UnsupportedAppUsage
Dianne Hackborn19382ac2009-09-11 21:13:37 -0700238 void wallpaperOffsetsComplete(IBinder window);
Svetoslavf7174e82014-06-12 11:29:35 -0700239
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700240 /**
241 * Apply a raw offset to the wallpaper service when shown behind this window.
242 */
243 void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
244
Dianne Hackborn75804932009-10-20 20:15:20 -0700245 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
246 int z, in Bundle extras, boolean sync);
Svetoslavf7174e82014-06-12 11:29:35 -0700247
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000248 @UnsupportedAppUsage
Dianne Hackborn75804932009-10-20 20:15:20 -0700249 void wallpaperCommandComplete(IBinder window, in Bundle result);
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700250
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700251 /**
252 * Notifies that a rectangle on the screen has been requested.
253 */
Svetoslavf7174e82014-06-12 11:29:35 -0700254 void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
Dianne Hackborne3f23a32013-03-01 13:25:35 -0800255
256 IWindowId getWindowId(IBinder window);
Jeff Brownc2932a12014-11-20 18:04:05 -0800257
258 /**
259 * When the system is dozing in a low-power partially suspended state, pokes a short
260 * lived wake lock and ensures that the display is ready to accept the next frame
261 * of content drawn in the window.
262 *
263 * This mechanism is bound to the window rather than to the display manager or the
264 * power manager so that the system can ensure that the window is actually visible
265 * and prevent runaway applications from draining the battery. This is similar to how
266 * FLAG_KEEP_SCREEN_ON works.
267 *
268 * This method is synchronous because it may need to acquire a wake lock before returning.
269 * The assumption is that this method will be called rather infrequently.
270 */
271 void pokeDrawLock(IBinder window);
Chong Zhang8e89b312015-09-09 15:09:30 -0700272
273 /**
274 * Starts a task window move with {startX, startY} as starting point. The amount of move
275 * will be the offset between {startX, startY} and the new cursor position.
276 *
277 * Returns true if the move started successfully; false otherwise.
278 */
279 boolean startMovingTask(IWindow window, float startX, float startY);
Vladislav Kaznacheev989b58a2016-02-10 12:19:33 -0800280
yj81.kwon19585ff2019-04-23 18:53:57 -0700281 void finishMovingTask(IWindow window);
282
Vladislav Kaznacheev989b58a2016-02-10 12:19:33 -0800283 void updatePointerIcon(IWindow window);
Andrii Kulian4b6599e2018-01-15 17:24:08 -0800284
285 /**
Tiger Huangd8ec9382019-04-18 14:35:09 -0700286 * Reparent the top layers for a display to the requested SurfaceControl. The display that is
287 * going to be re-parented (the displayId passed in) needs to have been created by the same
288 * process that is requesting the re-parent. This is to ensure clients can't just re-parent
289 * display content info to any SurfaceControl, as this would be a security issue.
290 *
291 * @param window The window which owns the SurfaceControl. This indicates the z-order of the
292 * windows of this display against the windows on the parent display.
293 * @param sc The SurfaceControl that the top level layers for the display should be re-parented
294 * to.
295 * @param displayId The id of the display to be re-parented.
296 */
297 void reparentDisplayContent(IWindow window, in SurfaceControl sc, int displayId);
298
299 /**
300 * Update the location of a child display in its parent window. This enables windows in the
301 * child display to compute the global transformation matrix.
302 *
303 * @param window The parent window of the display.
304 * @param x The x coordinate in the parent window.
305 * @param y The y coordinate in the parent window.
306 * @param displayId The id of the display to be notified.
307 */
308 void updateDisplayContentLocation(IWindow window, int x, int y, int displayId);
309
310 /**
Tiger Huang2b210c22019-03-18 21:21:26 +0800311 * Update a tap exclude region identified by provided id in the window. Touches on this region
312 * will neither be dispatched to this window nor change the focus to this window. Passing an
313 * invalid region will remove the area from the exclude region of this window.
Andrii Kulian4b6599e2018-01-15 17:24:08 -0800314 */
chaviwaa0d74e2019-12-26 14:13:40 -0800315 void updateTapExcludeRegion(IWindow window, in Region region);
Jorim Jaggie35c0592018-11-06 16:21:08 +0100316
317 /**
318 * Called when the client has changed the local insets state, and now the server should reflect
319 * that new state.
320 */
321 void insetsModified(IWindow window, in InsetsState state);
Adrian Roos4ffc8972019-02-07 20:45:11 +0100322
323
324 /**
325 * Called when the system gesture exclusion has changed.
326 */
Adrian Roos2dccd142019-07-16 18:35:15 +0200327 oneway void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects);
Robert Carr9d431e12018-12-17 13:11:48 -0800328
329 /**
330 * Request the server to call setInputWindowInfo on a given Surface, and return
331 * an input channel where the client can receive input.
332 */
Vishnu Nair5cf253192019-11-07 15:33:20 -0800333 void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
Evan Rosky680377e2020-01-10 19:12:10 -0800334 in IBinder hostInputToken, int flags, out InputChannel outInputChannel);
335
336 /**
337 * Update the flags on an input channel associated with a particular surface.
338 */
339 void updateInputChannel(in IBinder channelToken, int displayId, in SurfaceControl surface,
340 int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341}