blob: d7fd3299b9e34b1dba297beb83eacfaa4f0eeb47 [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;
31import android.view.Surface;
Daichi Hironoa1fb9be2017-12-18 17:02:54 +090032import android.view.SurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033
34/**
35 * System private per-application interface to the window manager.
36 *
37 * {@hide}
38 */
39interface IWindowSession {
Dianne Hackborn9a230e02011-10-06 11:51:27 -070040 int add(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos37d7a682014-11-06 18:15:16 +010041 in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets,
Jeff Brown46b9ac02010-04-22 18:58:52 -070042 out InputChannel outInputChannel);
Craig Mautner6881a102012-07-27 13:04:51 -070043 int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
44 in int viewVisibility, in int layerStackId, out Rect outContentInsets,
Adrian Roos5c6b6222017-11-07 17:36:10 +010045 out Rect outStableInsets, out Rect outOutsets,
46 out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel);
Dianne Hackborn9a230e02011-10-06 11:51:27 -070047 int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos37d7a682014-11-06 18:15:16 +010048 in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets);
Craig Mautner6881a102012-07-27 13:04:51 -070049 int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos37d7a682014-11-06 18:15:16 +010050 in int viewVisibility, in int layerStackId, out Rect outContentInsets,
51 out Rect outStableInsets);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052 void remove(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -070053
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054 /**
55 * Change the parameters of a window. You supply the
56 * new parameters, it returns the new frame of the window on screen (the
57 * position should be ignored) and surface of the window. The surface
58 * will be invalid if the window is currently hidden, else you can use it
59 * to draw the window's contents.
60 *
61 * @param window The window being modified.
Dianne Hackborn9a230e02011-10-06 11:51:27 -070062 * @param seq Ordering sequence number.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 * @param attrs If non-null, new attributes to apply to the window.
64 * @param requestedWidth The width the window wants to be.
65 * @param requestedHeight The height the window wants to be.
66 * @param viewVisibility Window root view's visibility.
Jeff Brown98365d72012-08-19 20:30:52 -070067 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING},
68 * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 * @param outFrame Rect in which is placed the new position/size on
70 * screen.
Dianne Hackbornc4aad012013-02-22 15:05:25 -080071 * @param outOverscanInsets Rect in which is placed the offsets from
72 * <var>outFrame</var> in which the content of the window are inside
73 * of the display's overlay region.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 * @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.
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,
Dianne Hackbornc4aad012013-02-22 15:05:25 -080099 int flags, 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,
Bryce Lee46b01652017-06-07 23:01:56 +0000103 out MergedConfiguration outMergedConfiguration, out Surface outSurface);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104
Robert Carr23fa16b2016-01-13 13:19:58 -0800105 /*
106 * Notify the window manager that an application is relaunching and
Robert Carr77bdfb52016-05-02 18:18:31 -0700107 * windows should be prepared for replacement.
Robert Carr23fa16b2016-01-13 13:19:58 -0800108 *
109 * @param appToken The application
Robert Carr77bdfb52016-05-02 18:18:31 -0700110 * @param childrenOnly Whether to only prepare child windows for replacement
111 * (for example when main windows are being reused via preservation).
Robert Carr23fa16b2016-01-13 13:19:58 -0800112 */
Robert Carr77bdfb52016-05-02 18:18:31 -0700113 void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
Robert Carr23fa16b2016-01-13 13:19:58 -0800114
Rob Carr64e516f2015-10-29 00:20:45 +0000115 /**
Dianne Hackborn64825172011-03-02 21:32:58 -0800116 * Called by a client to report that it ran out of graphics memory.
117 */
118 boolean outOfMemory(IWindow window);
119
120 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 * Give the window manager a hint of the part of the window that is
122 * completely transparent, allowing it to work with the surface flinger
123 * to optimize compositing of this part of the window.
124 */
125 void setTransparentRegion(IWindow window, in Region region);
Svetoslavf7174e82014-06-12 11:29:35 -0700126
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 /**
128 * Tell the window manager about the content and visible insets of the
129 * given window, which can be used to adjust the <var>outContentInsets</var>
130 * and <var>outVisibleInsets</var> values returned by
131 * {@link #relayout relayout()} for windows behind this one.
132 *
133 * @param touchableInsets Controls which part of the window inside of its
134 * frame can receive pointer events, as defined by
135 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}.
136 */
137 void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
Jeff Brownfbf09772011-01-16 14:06:57 -0800138 in Rect visibleInsets, in Region touchableRegion);
Svetoslavf7174e82014-06-12 11:29:35 -0700139
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 /**
141 * Return the current display size in which the window is being laid out,
142 * accounting for screen decorations around it.
143 */
144 void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
Svetoslavf7174e82014-06-12 11:29:35 -0700145
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800146 void finishDrawing(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -0700147
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148 void setInTouchMode(boolean showFocus);
149 boolean getInTouchMode();
Svetoslavf7174e82014-06-12 11:29:35 -0700150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800151 boolean performHapticFeedback(IWindow window, int effectId, boolean always);
Svetoslavf7174e82014-06-12 11:29:35 -0700152
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700153 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700154 * Initiate the drag operation itself
Daichi Hironofabca092017-12-19 15:02:50 +0900155 *
156 * @param window Window which initiates drag operation.
157 * @param flags See {@code View#startDragAndDrop}
158 * @param surface Surface containing drag shadow image
159 * @param touchSource See {@code InputDevice#getSource()}
Daichi Hirono1456b922018-01-24 15:37:26 +0900160 * @param touchX X coordinate of last touch point
161 * @param touchY Y coordinate of last touch point
Daichi Hironofabca092017-12-19 15:02:50 +0900162 * @param thumbCenterX X coordinate for the position within the shadow image that should be
163 * underneath the touch point during the drag and drop operation.
164 * @param thumbCenterY Y coordinate for the position within the shadow image that should be
165 * underneath the touch point during the drag and drop operation.
166 * @param data Data transferred by drag and drop
167 * @return Token of drag operation which will be passed to cancelDragAndDrop.
Christopher Tatea53146c2010-09-07 11:57:52 -0700168 */
Daichi Hironofabca092017-12-19 15:02:50 +0900169 IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource,
Vladislav Kaznacheevba761122016-01-22 12:09:45 -0800170 float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
Christopher Tatea53146c2010-09-07 11:57:52 -0700171
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900172 /**
Svetoslavf7174e82014-06-12 11:29:35 -0700173 * Report the result of a drop action targeted to the given window.
174 * consumed is 'true' when the drop was accepted by a valid recipient,
175 * 'false' otherwise.
176 */
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900177 void reportDropResult(IWindow window, boolean consumed);
Chris Tated4533f12010-10-19 15:15:08 -0700178
Christopher Tatea53146c2010-09-07 11:57:52 -0700179 /**
Vladislav Kaznacheev82063912015-11-20 14:20:13 -0800180 * Cancel the current drag operation.
181 */
182 void cancelDragAndDrop(IBinder dragToken);
183
184 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700185 * Tell the OS that we've just dragged into a View that is willing to accept the drop
186 */
187 void dragRecipientEntered(IWindow window);
188
189 /**
190 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
191 */
192 void dragRecipientExited(IWindow window);
193
194 /**
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700195 * For windows with the wallpaper behind them, and the wallpaper is
196 * larger than the screen, set the offset within the screen.
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800197 * For multi screen launcher type applications, xstep and ystep indicate
198 * how big the increment is from one screen to another.
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700199 */
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800200 void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
Svetoslavf7174e82014-06-12 11:29:35 -0700201
Dianne Hackborn19382ac2009-09-11 21:13:37 -0700202 void wallpaperOffsetsComplete(IBinder window);
Svetoslavf7174e82014-06-12 11:29:35 -0700203
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700204 /**
205 * Apply a raw offset to the wallpaper service when shown behind this window.
206 */
207 void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
208
Dianne Hackborn75804932009-10-20 20:15:20 -0700209 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
210 int z, in Bundle extras, boolean sync);
Svetoslavf7174e82014-06-12 11:29:35 -0700211
Dianne Hackborn75804932009-10-20 20:15:20 -0700212 void wallpaperCommandComplete(IBinder window, in Bundle result);
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700213
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700214 /**
215 * Notifies that a rectangle on the screen has been requested.
216 */
Svetoslavf7174e82014-06-12 11:29:35 -0700217 void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
Dianne Hackborne3f23a32013-03-01 13:25:35 -0800218
219 IWindowId getWindowId(IBinder window);
Jeff Brownc2932a12014-11-20 18:04:05 -0800220
221 /**
222 * When the system is dozing in a low-power partially suspended state, pokes a short
223 * lived wake lock and ensures that the display is ready to accept the next frame
224 * of content drawn in the window.
225 *
226 * This mechanism is bound to the window rather than to the display manager or the
227 * power manager so that the system can ensure that the window is actually visible
228 * and prevent runaway applications from draining the battery. This is similar to how
229 * FLAG_KEEP_SCREEN_ON works.
230 *
231 * This method is synchronous because it may need to acquire a wake lock before returning.
232 * The assumption is that this method will be called rather infrequently.
233 */
234 void pokeDrawLock(IBinder window);
Chong Zhang8e89b312015-09-09 15:09:30 -0700235
236 /**
237 * Starts a task window move with {startX, startY} as starting point. The amount of move
238 * will be the offset between {startX, startY} and the new cursor position.
239 *
240 * Returns true if the move started successfully; false otherwise.
241 */
242 boolean startMovingTask(IWindow window, float startX, float startY);
Vladislav Kaznacheev989b58a2016-02-10 12:19:33 -0800243
244 void updatePointerIcon(IWindow window);
Andrii Kulian4b6599e2018-01-15 17:24:08 -0800245
246 /**
247 * Update a tap exclude region with a rectangular area identified by provided id in the window.
248 * Touches on this region will not switch focus to this window. Passing an empty rect will
249 * remove the area from the exclude region of this window.
250 */
251 void updateTapExcludeRegion(IWindow window, int regionId, int left, int top, int width,
252 int height);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253}