blob: 1fcd4321cddeae0b7664f95d9242a69969061630 [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**
5** 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
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
11** 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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.graphics.Rect;
22import android.graphics.Region;
Dianne Hackborn75804932009-10-20 20:15:20 -070023import android.os.Bundle;
Andrii Kulian44607962017-03-16 11:06:24 -070024import android.util.MergedConfiguration;
Adrian Roos5c6b6222017-11-07 17:36:10 +010025import android.view.DisplayCutout;
Jeff Brown46b9ac02010-04-22 18:58:52 -070026import android.view.InputChannel;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.view.IWindow;
Dianne Hackborne3f23a32013-03-01 13:25:35 -080028import android.view.IWindowId;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.view.MotionEvent;
30import android.view.WindowManager;
Jorim Jaggif96c90a2018-09-26 16:55:15 +020031import android.view.InsetsState;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.view.Surface;
Daichi Hironoa1fb9be2017-12-18 17:02:54 +090033import android.view.SurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034
35/**
36 * System private per-application interface to the window manager.
37 *
38 * {@hide}
39 */
40interface IWindowSession {
Craig Mautner6881a102012-07-27 13:04:51 -070041 int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos9e370f22018-03-06 18:19:45 +010042 in int viewVisibility, in int layerStackId, out Rect outFrame,
43 out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets,
Jorim Jaggif96c90a2018-09-26 16:55:15 +020044 out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel,
45 out InsetsState insetsState);
Craig Mautner6881a102012-07-27 13:04:51 -070046 int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos37d7a682014-11-06 18:15:16 +010047 in int viewVisibility, in int layerStackId, out Rect outContentInsets,
Jorim Jaggif96c90a2018-09-26 16:55:15 +020048 out Rect outStableInsets, out InsetsState insetsState);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +000049 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 void remove(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -070051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052 /**
53 * Change the parameters of a window. You supply the
54 * new parameters, it returns the new frame of the window on screen (the
55 * position should be ignored) and surface of the window. The surface
56 * will be invalid if the window is currently hidden, else you can use it
57 * to draw the window's contents.
58 *
59 * @param window The window being modified.
Dianne Hackborn9a230e02011-10-06 11:51:27 -070060 * @param seq Ordering sequence number.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061 * @param attrs If non-null, new attributes to apply to the window.
62 * @param requestedWidth The width the window wants to be.
63 * @param requestedHeight The height the window wants to be.
64 * @param viewVisibility Window root view's visibility.
Jeff Brown98365d72012-08-19 20:30:52 -070065 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING},
66 * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}.
chaviwbe43ac82018-04-04 15:14:49 -070067 * @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 -080068 * @param outFrame Rect in which is placed the new position/size on
69 * screen.
Dianne Hackbornc4aad012013-02-22 15:05:25 -080070 * @param outOverscanInsets Rect in which is placed the offsets from
71 * <var>outFrame</var> in which the content of the window are inside
72 * of the display's overlay region.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 * @param outContentInsets Rect in which is placed the offsets from
74 * <var>outFrame</var> in which the content of the window should be
75 * placed. This can be used to modify the window layout to ensure its
76 * contents are visible to the user, taking into account system windows
77 * like the status bar or a soft keyboard.
78 * @param outVisibleInsets Rect in which is placed the offsets from
79 * <var>outFrame</var> in which the window is actually completely visible
80 * to the user. This can be used to temporarily scroll the window's
81 * contents to make sure the user can see it. This is different than
82 * <var>outContentInsets</var> in that these insets change transiently,
83 * so complex relayout of the window should not happen based on them.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070084 * @param outOutsets Rect in which is placed the dead area of the screen that we would like to
85 * treat as real display. Example of such area is a chin in some models of wearable devices.
Jorim Jaggi2e95a482016-01-14 17:36:55 -080086 * @param outBackdropFrame Rect which is used draw the resizing background during a resize
87 * operation.
Andrii Kulian44607962017-03-16 11:06:24 -070088 * @param outMergedConfiguration New config container that holds global, override and merged
89 * config for window, if it is now becoming visible and the merged configuration has changed
90 * since it was last displayed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 * @param outSurface Object in which is placed the new display surface.
Jorim Jaggif96c90a2018-09-26 16:55:15 +020092 * @param insetsState The current insets state in the system.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070093 *
Jeff Brown98365d72012-08-19 20:30:52 -070094 * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS},
95 * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 */
Dianne Hackborn9a230e02011-10-06 11:51:27 -070097 int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 int requestedWidth, int requestedHeight, int viewVisibility,
chaviwbe43ac82018-04-04 15:14:49 -070099 int flags, long frameNumber, out Rect outFrame, out Rect outOverscanInsets,
Adrian Roosfa104232014-06-20 16:10:14 -0700100 out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets,
Andrii Kulian44607962017-03-16 11:06:24 -0700101 out Rect outOutsets, out Rect outBackdropFrame,
Adrian Roos5c6b6222017-11-07 17:36:10 +0100102 out DisplayCutout.ParcelableWrapper displayCutout,
Robert Carr5fea55b2018-12-10 13:05:52 -0800103 out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl,
Jorim Jaggif96c90a2018-09-26 16:55:15 +0200104 out InsetsState insetsState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105
Robert Carr23fa16b2016-01-13 13:19:58 -0800106 /*
107 * Notify the window manager that an application is relaunching and
Robert Carr77bdfb52016-05-02 18:18:31 -0700108 * windows should be prepared for replacement.
Robert Carr23fa16b2016-01-13 13:19:58 -0800109 *
110 * @param appToken The application
Robert Carr77bdfb52016-05-02 18:18:31 -0700111 * @param childrenOnly Whether to only prepare child windows for replacement
112 * (for example when main windows are being reused via preservation).
Robert Carr23fa16b2016-01-13 13:19:58 -0800113 */
Robert Carr77bdfb52016-05-02 18:18:31 -0700114 void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
Robert Carr23fa16b2016-01-13 13:19:58 -0800115
Rob Carr64e516f2015-10-29 00:20:45 +0000116 /**
Dianne Hackborn64825172011-03-02 21:32:58 -0800117 * Called by a client to report that it ran out of graphics memory.
118 */
119 boolean outOfMemory(IWindow window);
120
121 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 * Give the window manager a hint of the part of the window that is
123 * completely transparent, allowing it to work with the surface flinger
124 * to optimize compositing of this part of the window.
125 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000126 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 void setTransparentRegion(IWindow window, in Region region);
Svetoslavf7174e82014-06-12 11:29:35 -0700128
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 /**
130 * Tell the window manager about the content and visible insets of the
131 * given window, which can be used to adjust the <var>outContentInsets</var>
132 * and <var>outVisibleInsets</var> values returned by
133 * {@link #relayout relayout()} for windows behind this one.
134 *
135 * @param touchableInsets Controls which part of the window inside of its
136 * frame can receive pointer events, as defined by
137 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}.
138 */
139 void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
Jeff Brownfbf09772011-01-16 14:06:57 -0800140 in Rect visibleInsets, in Region touchableRegion);
Svetoslavf7174e82014-06-12 11:29:35 -0700141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 /**
143 * Return the current display size in which the window is being laid out,
144 * accounting for screen decorations around it.
145 */
146 void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
Svetoslavf7174e82014-06-12 11:29:35 -0700147
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000148 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 void finishDrawing(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -0700150
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000151 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 void setInTouchMode(boolean showFocus);
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000153 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 boolean getInTouchMode();
Svetoslavf7174e82014-06-12 11:29:35 -0700155
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000156 @UnsupportedAppUsage
Arthur Hunga4c52062019-02-19 11:31:44 +0800157 boolean performHapticFeedback(int effectId, boolean always);
Svetoslavf7174e82014-06-12 11:29:35 -0700158
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700159 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700160 * Initiate the drag operation itself
Daichi Hironofabca092017-12-19 15:02:50 +0900161 *
162 * @param window Window which initiates drag operation.
163 * @param flags See {@code View#startDragAndDrop}
164 * @param surface Surface containing drag shadow image
165 * @param touchSource See {@code InputDevice#getSource()}
Daichi Hirono1456b922018-01-24 15:37:26 +0900166 * @param touchX X coordinate of last touch point
167 * @param touchY Y coordinate of last touch point
Daichi Hironofabca092017-12-19 15:02:50 +0900168 * @param thumbCenterX X coordinate for the position within the shadow image that should be
169 * underneath the touch point during the drag and drop operation.
170 * @param thumbCenterY Y coordinate for the position within the shadow image that should be
171 * underneath the touch point during the drag and drop operation.
172 * @param data Data transferred by drag and drop
173 * @return Token of drag operation which will be passed to cancelDragAndDrop.
Christopher Tatea53146c2010-09-07 11:57:52 -0700174 */
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000175 @UnsupportedAppUsage
Daichi Hironofabca092017-12-19 15:02:50 +0900176 IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource,
Vladislav Kaznacheevba761122016-01-22 12:09:45 -0800177 float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
Christopher Tatea53146c2010-09-07 11:57:52 -0700178
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900179 /**
Svetoslavf7174e82014-06-12 11:29:35 -0700180 * Report the result of a drop action targeted to the given window.
181 * consumed is 'true' when the drop was accepted by a valid recipient,
182 * 'false' otherwise.
183 */
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900184 void reportDropResult(IWindow window, boolean consumed);
Chris Tated4533f12010-10-19 15:15:08 -0700185
Christopher Tatea53146c2010-09-07 11:57:52 -0700186 /**
Vladislav Kaznacheev82063912015-11-20 14:20:13 -0800187 * Cancel the current drag operation.
188 */
189 void cancelDragAndDrop(IBinder dragToken);
190
191 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700192 * Tell the OS that we've just dragged into a View that is willing to accept the drop
193 */
194 void dragRecipientEntered(IWindow window);
195
196 /**
197 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
198 */
199 void dragRecipientExited(IWindow window);
200
201 /**
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700202 * For windows with the wallpaper behind them, and the wallpaper is
203 * larger than the screen, set the offset within the screen.
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800204 * For multi screen launcher type applications, xstep and ystep indicate
205 * how big the increment is from one screen to another.
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700206 */
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800207 void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
Svetoslavf7174e82014-06-12 11:29:35 -0700208
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000209 @UnsupportedAppUsage
Dianne Hackborn19382ac2009-09-11 21:13:37 -0700210 void wallpaperOffsetsComplete(IBinder window);
Svetoslavf7174e82014-06-12 11:29:35 -0700211
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700212 /**
213 * Apply a raw offset to the wallpaper service when shown behind this window.
214 */
215 void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
216
Dianne Hackborn75804932009-10-20 20:15:20 -0700217 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
218 int z, in Bundle extras, boolean sync);
Svetoslavf7174e82014-06-12 11:29:35 -0700219
Andrei Oneaf4fb6fb2019-02-27 14:46:52 +0000220 @UnsupportedAppUsage
Dianne Hackborn75804932009-10-20 20:15:20 -0700221 void wallpaperCommandComplete(IBinder window, in Bundle result);
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700222
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700223 /**
224 * Notifies that a rectangle on the screen has been requested.
225 */
Svetoslavf7174e82014-06-12 11:29:35 -0700226 void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
Dianne Hackborne3f23a32013-03-01 13:25:35 -0800227
228 IWindowId getWindowId(IBinder window);
Jeff Brownc2932a12014-11-20 18:04:05 -0800229
230 /**
231 * When the system is dozing in a low-power partially suspended state, pokes a short
232 * lived wake lock and ensures that the display is ready to accept the next frame
233 * of content drawn in the window.
234 *
235 * This mechanism is bound to the window rather than to the display manager or the
236 * power manager so that the system can ensure that the window is actually visible
237 * and prevent runaway applications from draining the battery. This is similar to how
238 * FLAG_KEEP_SCREEN_ON works.
239 *
240 * This method is synchronous because it may need to acquire a wake lock before returning.
241 * The assumption is that this method will be called rather infrequently.
242 */
243 void pokeDrawLock(IBinder window);
Chong Zhang8e89b312015-09-09 15:09:30 -0700244
245 /**
246 * Starts a task window move with {startX, startY} as starting point. The amount of move
247 * will be the offset between {startX, startY} and the new cursor position.
248 *
249 * Returns true if the move started successfully; false otherwise.
250 */
251 boolean startMovingTask(IWindow window, float startX, float startY);
Vladislav Kaznacheev989b58a2016-02-10 12:19:33 -0800252
253 void updatePointerIcon(IWindow window);
Andrii Kulian4b6599e2018-01-15 17:24:08 -0800254
255 /**
256 * Update a tap exclude region with a rectangular area identified by provided id in the window.
257 * Touches on this region will not switch focus to this window. Passing an empty rect will
258 * remove the area from the exclude region of this window.
259 */
260 void updateTapExcludeRegion(IWindow window, int regionId, int left, int top, int width,
261 int height);
Jorim Jaggie35c0592018-11-06 16:21:08 +0100262
263 /**
264 * Called when the client has changed the local insets state, and now the server should reflect
265 * that new state.
266 */
267 void insetsModified(IWindow window, in InsetsState state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800268}