blob: f868a00f03593ce02d3c9dd42576c97463e8e864 [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,
Adrian Roos9e370f22018-03-06 18:19:45 +010044 in int viewVisibility, in int layerStackId, out Rect outFrame,
45 out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets,
Adrian Roos5c6b6222017-11-07 17:36:10 +010046 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}.
chaviwbe43ac82018-04-04 15:14:49 -070069 * @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 -080070 * @param outFrame Rect in which is placed the new position/size on
71 * screen.
Dianne Hackbornc4aad012013-02-22 15:05:25 -080072 * @param outOverscanInsets Rect in which is placed the offsets from
73 * <var>outFrame</var> in which the content of the window are inside
74 * of the display's overlay region.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 * @param outContentInsets Rect in which is placed the offsets from
76 * <var>outFrame</var> in which the content of the window should be
77 * placed. This can be used to modify the window layout to ensure its
78 * contents are visible to the user, taking into account system windows
79 * like the status bar or a soft keyboard.
80 * @param outVisibleInsets Rect in which is placed the offsets from
81 * <var>outFrame</var> in which the window is actually completely visible
82 * to the user. This can be used to temporarily scroll the window's
83 * contents to make sure the user can see it. This is different than
84 * <var>outContentInsets</var> in that these insets change transiently,
85 * so complex relayout of the window should not happen based on them.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070086 * @param outOutsets Rect in which is placed the dead area of the screen that we would like to
87 * treat as real display. Example of such area is a chin in some models of wearable devices.
Jorim Jaggi2e95a482016-01-14 17:36:55 -080088 * @param outBackdropFrame Rect which is used draw the resizing background during a resize
89 * operation.
Andrii Kulian44607962017-03-16 11:06:24 -070090 * @param outMergedConfiguration New config container that holds global, override and merged
91 * config for window, if it is now becoming visible and the merged configuration has changed
92 * since it was last displayed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 * @param outSurface Object in which is placed the new display surface.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070094 *
Jeff Brown98365d72012-08-19 20:30:52 -070095 * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS},
96 * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 */
Dianne Hackborn9a230e02011-10-06 11:51:27 -070098 int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 int requestedWidth, int requestedHeight, int viewVisibility,
chaviwbe43ac82018-04-04 15:14:49 -0700100 int flags, long frameNumber, out Rect outFrame, out Rect outOverscanInsets,
Adrian Roosfa104232014-06-20 16:10:14 -0700101 out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets,
Andrii Kulian44607962017-03-16 11:06:24 -0700102 out Rect outOutsets, out Rect outBackdropFrame,
Adrian Roos5c6b6222017-11-07 17:36:10 +0100103 out DisplayCutout.ParcelableWrapper displayCutout,
Bryce Lee46b01652017-06-07 23:01:56 +0000104 out MergedConfiguration outMergedConfiguration, out Surface outSurface);
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 */
126 void setTransparentRegion(IWindow window, in Region region);
Svetoslavf7174e82014-06-12 11:29:35 -0700127
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 /**
129 * Tell the window manager about the content and visible insets of the
130 * given window, which can be used to adjust the <var>outContentInsets</var>
131 * and <var>outVisibleInsets</var> values returned by
132 * {@link #relayout relayout()} for windows behind this one.
133 *
134 * @param touchableInsets Controls which part of the window inside of its
135 * frame can receive pointer events, as defined by
136 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}.
137 */
138 void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
Jeff Brownfbf09772011-01-16 14:06:57 -0800139 in Rect visibleInsets, in Region touchableRegion);
Svetoslavf7174e82014-06-12 11:29:35 -0700140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 /**
142 * Return the current display size in which the window is being laid out,
143 * accounting for screen decorations around it.
144 */
145 void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
Svetoslavf7174e82014-06-12 11:29:35 -0700146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800147 void finishDrawing(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -0700148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 void setInTouchMode(boolean showFocus);
150 boolean getInTouchMode();
Svetoslavf7174e82014-06-12 11:29:35 -0700151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 boolean performHapticFeedback(IWindow window, int effectId, boolean always);
Svetoslavf7174e82014-06-12 11:29:35 -0700153
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700154 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700155 * Initiate the drag operation itself
Daichi Hironofabca092017-12-19 15:02:50 +0900156 *
157 * @param window Window which initiates drag operation.
158 * @param flags See {@code View#startDragAndDrop}
159 * @param surface Surface containing drag shadow image
160 * @param touchSource See {@code InputDevice#getSource()}
Daichi Hirono1456b922018-01-24 15:37:26 +0900161 * @param touchX X coordinate of last touch point
162 * @param touchY Y coordinate of last touch point
Daichi Hironofabca092017-12-19 15:02:50 +0900163 * @param thumbCenterX X coordinate for the position within the shadow image that should be
164 * underneath the touch point during the drag and drop operation.
165 * @param thumbCenterY Y coordinate for the position within the shadow image that should be
166 * underneath the touch point during the drag and drop operation.
167 * @param data Data transferred by drag and drop
168 * @return Token of drag operation which will be passed to cancelDragAndDrop.
Christopher Tatea53146c2010-09-07 11:57:52 -0700169 */
Daichi Hironofabca092017-12-19 15:02:50 +0900170 IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource,
Vladislav Kaznacheevba761122016-01-22 12:09:45 -0800171 float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
Christopher Tatea53146c2010-09-07 11:57:52 -0700172
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900173 /**
Svetoslavf7174e82014-06-12 11:29:35 -0700174 * Report the result of a drop action targeted to the given window.
175 * consumed is 'true' when the drop was accepted by a valid recipient,
176 * 'false' otherwise.
177 */
Daichi Hironoa1fb9be2017-12-18 17:02:54 +0900178 void reportDropResult(IWindow window, boolean consumed);
Chris Tated4533f12010-10-19 15:15:08 -0700179
Christopher Tatea53146c2010-09-07 11:57:52 -0700180 /**
Vladislav Kaznacheev82063912015-11-20 14:20:13 -0800181 * Cancel the current drag operation.
182 */
183 void cancelDragAndDrop(IBinder dragToken);
184
185 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700186 * Tell the OS that we've just dragged into a View that is willing to accept the drop
187 */
188 void dragRecipientEntered(IWindow window);
189
190 /**
191 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
192 */
193 void dragRecipientExited(IWindow window);
194
195 /**
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700196 * For windows with the wallpaper behind them, and the wallpaper is
197 * larger than the screen, set the offset within the screen.
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800198 * For multi screen launcher type applications, xstep and ystep indicate
199 * how big the increment is from one screen to another.
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700200 */
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800201 void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
Svetoslavf7174e82014-06-12 11:29:35 -0700202
Dianne Hackborn19382ac2009-09-11 21:13:37 -0700203 void wallpaperOffsetsComplete(IBinder window);
Svetoslavf7174e82014-06-12 11:29:35 -0700204
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700205 /**
206 * Apply a raw offset to the wallpaper service when shown behind this window.
207 */
208 void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
209
Dianne Hackborn75804932009-10-20 20:15:20 -0700210 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
211 int z, in Bundle extras, boolean sync);
Svetoslavf7174e82014-06-12 11:29:35 -0700212
Dianne Hackborn75804932009-10-20 20:15:20 -0700213 void wallpaperCommandComplete(IBinder window, in Bundle result);
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700214
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700215 /**
216 * Notifies that a rectangle on the screen has been requested.
217 */
Svetoslavf7174e82014-06-12 11:29:35 -0700218 void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
Dianne Hackborne3f23a32013-03-01 13:25:35 -0800219
220 IWindowId getWindowId(IBinder window);
Jeff Brownc2932a12014-11-20 18:04:05 -0800221
222 /**
223 * When the system is dozing in a low-power partially suspended state, pokes a short
224 * lived wake lock and ensures that the display is ready to accept the next frame
225 * of content drawn in the window.
226 *
227 * This mechanism is bound to the window rather than to the display manager or the
228 * power manager so that the system can ensure that the window is actually visible
229 * and prevent runaway applications from draining the battery. This is similar to how
230 * FLAG_KEEP_SCREEN_ON works.
231 *
232 * This method is synchronous because it may need to acquire a wake lock before returning.
233 * The assumption is that this method will be called rather infrequently.
234 */
235 void pokeDrawLock(IBinder window);
Chong Zhang8e89b312015-09-09 15:09:30 -0700236
237 /**
238 * Starts a task window move with {startX, startY} as starting point. The amount of move
239 * will be the offset between {startX, startY} and the new cursor position.
240 *
241 * Returns true if the move started successfully; false otherwise.
242 */
243 boolean startMovingTask(IWindow window, float startX, float startY);
Vladislav Kaznacheev989b58a2016-02-10 12:19:33 -0800244
245 void updatePointerIcon(IWindow window);
Andrii Kulian4b6599e2018-01-15 17:24:08 -0800246
247 /**
248 * Update a tap exclude region with a rectangular area identified by provided id in the window.
249 * Touches on this region will not switch focus to this window. Passing an empty rect will
250 * remove the area from the exclude region of this window.
251 */
252 void updateTapExcludeRegion(IWindow window, int regionId, int left, int top, int width,
253 int height);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254}