blob: 51d65144f260182b6f2b8d13b196e170deaab25d [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;
Jeff Brown46b9ac02010-04-22 18:58:52 -070025import android.view.InputChannel;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.view.IWindow;
Dianne Hackborne3f23a32013-03-01 13:25:35 -080027import android.view.IWindowId;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.view.MotionEvent;
29import android.view.WindowManager;
30import android.view.Surface;
31
32/**
33 * System private per-application interface to the window manager.
34 *
35 * {@hide}
36 */
37interface IWindowSession {
Dianne Hackborn9a230e02011-10-06 11:51:27 -070038 int add(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos37d7a682014-11-06 18:15:16 +010039 in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets,
Jeff Brown46b9ac02010-04-22 18:58:52 -070040 out InputChannel outInputChannel);
Craig Mautner6881a102012-07-27 13:04:51 -070041 int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
42 in int viewVisibility, in int layerStackId, out Rect outContentInsets,
Filip Gruszczynski0ec13282015-06-25 11:26:01 -070043 out Rect outStableInsets, out Rect outOutsets, out InputChannel outInputChannel);
Dianne Hackborn9a230e02011-10-06 11:51:27 -070044 int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
Adrian Roos37d7a682014-11-06 18:15:16 +010045 in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets);
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,
48 out Rect outStableInsets);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 void remove(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -070050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051 /**
52 * Change the parameters of a window. You supply the
53 * new parameters, it returns the new frame of the window on screen (the
54 * position should be ignored) and surface of the window. The surface
55 * will be invalid if the window is currently hidden, else you can use it
56 * to draw the window's contents.
57 *
58 * @param window The window being modified.
Dianne Hackborn9a230e02011-10-06 11:51:27 -070059 * @param seq Ordering sequence number.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 * @param attrs If non-null, new attributes to apply to the window.
61 * @param requestedWidth The width the window wants to be.
62 * @param requestedHeight The height the window wants to be.
63 * @param viewVisibility Window root view's visibility.
Jeff Brown98365d72012-08-19 20:30:52 -070064 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING},
65 * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 * @param outFrame Rect in which is placed the new position/size on
67 * screen.
Dianne Hackbornc4aad012013-02-22 15:05:25 -080068 * @param outOverscanInsets Rect in which is placed the offsets from
69 * <var>outFrame</var> in which the content of the window are inside
70 * of the display's overlay region.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071 * @param outContentInsets Rect in which is placed the offsets from
72 * <var>outFrame</var> in which the content of the window should be
73 * placed. This can be used to modify the window layout to ensure its
74 * contents are visible to the user, taking into account system windows
75 * like the status bar or a soft keyboard.
76 * @param outVisibleInsets Rect in which is placed the offsets from
77 * <var>outFrame</var> in which the window is actually completely visible
78 * to the user. This can be used to temporarily scroll the window's
79 * contents to make sure the user can see it. This is different than
80 * <var>outContentInsets</var> in that these insets change transiently,
81 * so complex relayout of the window should not happen based on them.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070082 * @param outOutsets Rect in which is placed the dead area of the screen that we would like to
83 * treat as real display. Example of such area is a chin in some models of wearable devices.
Jorim Jaggi2e95a482016-01-14 17:36:55 -080084 * @param outBackdropFrame Rect which is used draw the resizing background during a resize
85 * operation.
Andrii Kulian44607962017-03-16 11:06:24 -070086 * @param outMergedConfiguration New config container that holds global, override and merged
87 * config for window, if it is now becoming visible and the merged configuration has changed
88 * since it was last displayed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 * @param outSurface Object in which is placed the new display surface.
Filip Gruszczynski2217f612015-05-26 11:32:08 -070090 *
Jeff Brown98365d72012-08-19 20:30:52 -070091 * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS},
92 * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 */
Dianne Hackborn9a230e02011-10-06 11:51:27 -070094 int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 int requestedWidth, int requestedHeight, int viewVisibility,
Dianne Hackbornc4aad012013-02-22 15:05:25 -080096 int flags, out Rect outFrame, out Rect outOverscanInsets,
Adrian Roosfa104232014-06-20 16:10:14 -070097 out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets,
Andrii Kulian44607962017-03-16 11:06:24 -070098 out Rect outOutsets, out Rect outBackdropFrame,
99 out MergedConfiguration outMergedConfiguration, out Surface outSurface);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100
Robert Carr23fa16b2016-01-13 13:19:58 -0800101 /*
102 * Notify the window manager that an application is relaunching and
Robert Carr77bdfb52016-05-02 18:18:31 -0700103 * windows should be prepared for replacement.
Robert Carr23fa16b2016-01-13 13:19:58 -0800104 *
105 * @param appToken The application
Robert Carr77bdfb52016-05-02 18:18:31 -0700106 * @param childrenOnly Whether to only prepare child windows for replacement
107 * (for example when main windows are being reused via preservation).
Robert Carr23fa16b2016-01-13 13:19:58 -0800108 */
Robert Carr77bdfb52016-05-02 18:18:31 -0700109 void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
Robert Carr23fa16b2016-01-13 13:19:58 -0800110
Rob Carr64e516f2015-10-29 00:20:45 +0000111 /**
Dianne Hackborn64825172011-03-02 21:32:58 -0800112 * Called by a client to report that it ran out of graphics memory.
113 */
114 boolean outOfMemory(IWindow window);
115
116 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 * Give the window manager a hint of the part of the window that is
118 * completely transparent, allowing it to work with the surface flinger
119 * to optimize compositing of this part of the window.
120 */
121 void setTransparentRegion(IWindow window, in Region region);
Svetoslavf7174e82014-06-12 11:29:35 -0700122
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 /**
124 * Tell the window manager about the content and visible insets of the
125 * given window, which can be used to adjust the <var>outContentInsets</var>
126 * and <var>outVisibleInsets</var> values returned by
127 * {@link #relayout relayout()} for windows behind this one.
128 *
129 * @param touchableInsets Controls which part of the window inside of its
130 * frame can receive pointer events, as defined by
131 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}.
132 */
133 void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
Jeff Brownfbf09772011-01-16 14:06:57 -0800134 in Rect visibleInsets, in Region touchableRegion);
Svetoslavf7174e82014-06-12 11:29:35 -0700135
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 /**
137 * Return the current display size in which the window is being laid out,
138 * accounting for screen decorations around it.
139 */
140 void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
Svetoslavf7174e82014-06-12 11:29:35 -0700141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 void finishDrawing(IWindow window);
Svetoslavf7174e82014-06-12 11:29:35 -0700143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 void setInTouchMode(boolean showFocus);
145 boolean getInTouchMode();
Svetoslavf7174e82014-06-12 11:29:35 -0700146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800147 boolean performHapticFeedback(IWindow window, int effectId, boolean always);
Svetoslavf7174e82014-06-12 11:29:35 -0700148
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700149 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700150 * Allocate the drag's thumbnail surface. Also assigns a token that identifies
151 * the drag to the OS and passes that as the return value. A return value of
152 * null indicates failure.
153 */
Christopher Tate02d2b3b2011-01-10 20:43:53 -0800154 IBinder prepareDrag(IWindow window, int flags,
Christopher Tatea53146c2010-09-07 11:57:52 -0700155 int thumbnailWidth, int thumbnailHeight, out Surface outSurface);
156
157 /**
158 * Initiate the drag operation itself
159 */
Vladislav Kaznacheevba761122016-01-22 12:09:45 -0800160 boolean performDrag(IWindow window, IBinder dragToken, int touchSource,
161 float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
Christopher Tatea53146c2010-09-07 11:57:52 -0700162
Svetoslavf7174e82014-06-12 11:29:35 -0700163 /**
164 * Report the result of a drop action targeted to the given window.
165 * consumed is 'true' when the drop was accepted by a valid recipient,
166 * 'false' otherwise.
167 */
Chris Tated4533f12010-10-19 15:15:08 -0700168 void reportDropResult(IWindow window, boolean consumed);
169
Christopher Tatea53146c2010-09-07 11:57:52 -0700170 /**
Vladislav Kaznacheev82063912015-11-20 14:20:13 -0800171 * Cancel the current drag operation.
172 */
173 void cancelDragAndDrop(IBinder dragToken);
174
175 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700176 * Tell the OS that we've just dragged into a View that is willing to accept the drop
177 */
178 void dragRecipientEntered(IWindow window);
179
180 /**
181 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
182 */
183 void dragRecipientExited(IWindow window);
184
185 /**
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700186 * For windows with the wallpaper behind them, and the wallpaper is
187 * larger than the screen, set the offset within the screen.
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800188 * For multi screen launcher type applications, xstep and ystep indicate
189 * how big the increment is from one screen to another.
Dianne Hackbornc8a0a752009-08-10 23:05:49 -0700190 */
Marco Nelissenbf6956b2009-11-09 15:21:13 -0800191 void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
Svetoslavf7174e82014-06-12 11:29:35 -0700192
Dianne Hackborn19382ac2009-09-11 21:13:37 -0700193 void wallpaperOffsetsComplete(IBinder window);
Svetoslavf7174e82014-06-12 11:29:35 -0700194
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700195 /**
196 * Apply a raw offset to the wallpaper service when shown behind this window.
197 */
198 void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
199
Dianne Hackborn75804932009-10-20 20:15:20 -0700200 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
201 int z, in Bundle extras, boolean sync);
Svetoslavf7174e82014-06-12 11:29:35 -0700202
Dianne Hackborn75804932009-10-20 20:15:20 -0700203 void wallpaperCommandComplete(IBinder window, in Bundle result);
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700204
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700205 /**
206 * Notifies that a rectangle on the screen has been requested.
207 */
Svetoslavf7174e82014-06-12 11:29:35 -0700208 void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
Dianne Hackborne3f23a32013-03-01 13:25:35 -0800209
210 IWindowId getWindowId(IBinder window);
Jeff Brownc2932a12014-11-20 18:04:05 -0800211
212 /**
213 * When the system is dozing in a low-power partially suspended state, pokes a short
214 * lived wake lock and ensures that the display is ready to accept the next frame
215 * of content drawn in the window.
216 *
217 * This mechanism is bound to the window rather than to the display manager or the
218 * power manager so that the system can ensure that the window is actually visible
219 * and prevent runaway applications from draining the battery. This is similar to how
220 * FLAG_KEEP_SCREEN_ON works.
221 *
222 * This method is synchronous because it may need to acquire a wake lock before returning.
223 * The assumption is that this method will be called rather infrequently.
224 */
225 void pokeDrawLock(IBinder window);
Chong Zhang8e89b312015-09-09 15:09:30 -0700226
227 /**
228 * Starts a task window move with {startX, startY} as starting point. The amount of move
229 * will be the offset between {startX, startY} and the new cursor position.
230 *
231 * Returns true if the move started successfully; false otherwise.
232 */
233 boolean startMovingTask(IWindow window, float startX, float startY);
Vladislav Kaznacheev989b58a2016-02-10 12:19:33 -0800234
235 void updatePointerIcon(IWindow window);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800236}