1 /* //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.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 package android.view;
19 
20 import android.content.ClipData;
21 import android.graphics.Rect;
22 import android.graphics.Region;
23 import android.os.Bundle;
24 import android.util.MergedConfiguration;
25 import android.view.DisplayCutout;
26 import android.view.InputChannel;
27 import android.view.IWindow;
28 import android.view.IWindowId;
29 import android.view.MotionEvent;
30 import android.view.WindowManager;
31 import android.view.InsetsState;
32 import android.view.Surface;
33 import android.view.SurfaceControl;
34 
35 import java.util.List;
36 
37 /**
38  * System private per-application interface to the window manager.
39  *
40  * {@hide}
41  */
42 interface IWindowSession {
addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outFrame, out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel, out InsetsState insetsState)43     int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
44             in int viewVisibility, in int layerStackId, out Rect outFrame,
45             out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets,
46             out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel,
47             out InsetsState insetsState);
addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outContentInsets, out Rect outStableInsets, out InsetsState insetsState)48     int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
49             in int viewVisibility, in int layerStackId, out Rect outContentInsets,
50             out Rect outStableInsets, out InsetsState insetsState);
51     @UnsupportedAppUsage
remove(IWindow window)52     void remove(IWindow window);
53 
54     /**
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.
62      * @param seq Ordering sequence number.
63      * @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.
67      * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING},
68      * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}.
69      * @param frameNumber A frame number in which changes requested in this layout will be rendered.
70      * @param outFrame Rect in which is placed the new position/size on
71      * screen.
72      * @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.
75      * @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.
86      * @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.
88      * @param outBackdropFrame Rect which is used draw the resizing background during a resize
89      * operation.
90      * @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.
93      * @param outSurface Object in which is placed the new display surface.
94      * @param insetsState The current insets state in the system.
95      *
96      * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS},
97      * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}.
98      */
relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, long frameNumber, out Rect outFrame, out Rect outOverscanInsets, out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets, out Rect outOutsets, out Rect outBackdropFrame, out DisplayCutout.ParcelableWrapper displayCutout, out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl, out InsetsState insetsState)99     int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
100             int requestedWidth, int requestedHeight, int viewVisibility,
101             int flags, long frameNumber, out Rect outFrame, out Rect outOverscanInsets,
102             out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets,
103             out Rect outOutsets, out Rect outBackdropFrame,
104             out DisplayCutout.ParcelableWrapper displayCutout,
105             out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl,
106             out InsetsState insetsState);
107 
108     /*
109      * Notify the window manager that an application is relaunching and
110      * windows should be prepared for replacement.
111      *
112      * @param appToken The application
113      * @param childrenOnly Whether to only prepare child windows for replacement
114      * (for example when main windows are being reused via preservation).
115      */
prepareToReplaceWindows(IBinder appToken, boolean childrenOnly)116     void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
117 
118     /**
119      * Called by a client to report that it ran out of graphics memory.
120      */
outOfMemory(IWindow window)121     boolean outOfMemory(IWindow window);
122 
123     /**
124      * Give the window manager a hint of the part of the window that is
125      * completely transparent, allowing it to work with the surface flinger
126      * to optimize compositing of this part of the window.
127      */
128     @UnsupportedAppUsage
setTransparentRegion(IWindow window, in Region region)129     void setTransparentRegion(IWindow window, in Region region);
130 
131     /**
132      * Tell the window manager about the content and visible insets of the
133      * given window, which can be used to adjust the <var>outContentInsets</var>
134      * and <var>outVisibleInsets</var> values returned by
135      * {@link #relayout relayout()} for windows behind this one.
136      *
137      * @param touchableInsets Controls which part of the window inside of its
138      * frame can receive pointer events, as defined by
139      * {@link android.view.ViewTreeObserver.InternalInsetsInfo}.
140      */
setInsets(IWindow window, int touchableInsets, in Rect contentInsets, in Rect visibleInsets, in Region touchableRegion)141     void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
142             in Rect visibleInsets, in Region touchableRegion);
143 
144     /**
145      * Return the current display size in which the window is being laid out,
146      * accounting for screen decorations around it.
147      */
getDisplayFrame(IWindow window, out Rect outDisplayFrame)148     void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
149 
150     @UnsupportedAppUsage
finishDrawing(IWindow window)151     void finishDrawing(IWindow window);
152 
153     @UnsupportedAppUsage
setInTouchMode(boolean showFocus)154     void setInTouchMode(boolean showFocus);
155     @UnsupportedAppUsage
getInTouchMode()156     boolean getInTouchMode();
157 
158     @UnsupportedAppUsage
performHapticFeedback(int effectId, boolean always)159     boolean performHapticFeedback(int effectId, boolean always);
160 
161     /**
162      * Initiate the drag operation itself
163      *
164      * @param window Window which initiates drag operation.
165      * @param flags See {@code View#startDragAndDrop}
166      * @param surface Surface containing drag shadow image
167      * @param touchSource See {@code InputDevice#getSource()}
168      * @param touchX X coordinate of last touch point
169      * @param touchY Y coordinate of last touch point
170      * @param thumbCenterX X coordinate for the position within the shadow image that should be
171      *         underneath the touch point during the drag and drop operation.
172      * @param thumbCenterY Y coordinate for the position within the shadow image that should be
173      *         underneath the touch point during the drag and drop operation.
174      * @param data Data transferred by drag and drop
175      * @return Token of drag operation which will be passed to cancelDragAndDrop.
176      */
177     @UnsupportedAppUsage
performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data)178     IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource,
179             float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
180 
181     /**
182      * Report the result of a drop action targeted to the given window.
183      * consumed is 'true' when the drop was accepted by a valid recipient,
184      * 'false' otherwise.
185      */
reportDropResult(IWindow window, boolean consumed)186     void reportDropResult(IWindow window, boolean consumed);
187 
188     /**
189      * Cancel the current drag operation.
190      * skipAnimation is 'true' when it should skip the drag cancel animation which brings the drag
191      * shadow image back to the drag start position.
192      */
cancelDragAndDrop(IBinder dragToken, boolean skipAnimation)193     void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation);
194 
195     /**
196      * Tell the OS that we've just dragged into a View that is willing to accept the drop
197      */
dragRecipientEntered(IWindow window)198     void dragRecipientEntered(IWindow window);
199 
200     /**
201      * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
202      */
dragRecipientExited(IWindow window)203     void dragRecipientExited(IWindow window);
204 
205     /**
206      * For windows with the wallpaper behind them, and the wallpaper is
207      * larger than the screen, set the offset within the screen.
208      * For multi screen launcher type applications, xstep and ystep indicate
209      * how big the increment is from one screen to another.
210      */
setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep)211     void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
212 
213     @UnsupportedAppUsage
wallpaperOffsetsComplete(IBinder window)214     void wallpaperOffsetsComplete(IBinder window);
215 
216     /**
217      * Apply a raw offset to the wallpaper service when shown behind this window.
218      */
setWallpaperDisplayOffset(IBinder windowToken, int x, int y)219     void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
220 
sendWallpaperCommand(IBinder window, String action, int x, int y, int z, in Bundle extras, boolean sync)221     Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
222             int z, in Bundle extras, boolean sync);
223 
224     @UnsupportedAppUsage
wallpaperCommandComplete(IBinder window, in Bundle result)225     void wallpaperCommandComplete(IBinder window, in Bundle result);
226 
227     /**
228      * Notifies that a rectangle on the screen has been requested.
229      */
onRectangleOnScreenRequested(IBinder token, in Rect rectangle)230     void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
231 
getWindowId(IBinder window)232     IWindowId getWindowId(IBinder window);
233 
234     /**
235      * When the system is dozing in a low-power partially suspended state, pokes a short
236      * lived wake lock and ensures that the display is ready to accept the next frame
237      * of content drawn in the window.
238      *
239      * This mechanism is bound to the window rather than to the display manager or the
240      * power manager so that the system can ensure that the window is actually visible
241      * and prevent runaway applications from draining the battery.  This is similar to how
242      * FLAG_KEEP_SCREEN_ON works.
243      *
244      * This method is synchronous because it may need to acquire a wake lock before returning.
245      * The assumption is that this method will be called rather infrequently.
246      */
pokeDrawLock(IBinder window)247     void pokeDrawLock(IBinder window);
248 
249     /**
250      * Starts a task window move with {startX, startY} as starting point. The amount of move
251      * will be the offset between {startX, startY} and the new cursor position.
252      *
253      * Returns true if the move started successfully; false otherwise.
254      */
startMovingTask(IWindow window, float startX, float startY)255     boolean startMovingTask(IWindow window, float startX, float startY);
256 
finishMovingTask(IWindow window)257     void finishMovingTask(IWindow window);
258 
updatePointerIcon(IWindow window)259     void updatePointerIcon(IWindow window);
260 
261     /**
262      * Reparent the top layers for a display to the requested SurfaceControl. The display that is
263      * going to be re-parented (the displayId passed in) needs to have been created by the same
264      * process that is requesting the re-parent. This is to ensure clients can't just re-parent
265      * display content info to any SurfaceControl, as this would be a security issue.
266      *
267      * @param window The window which owns the SurfaceControl. This indicates the z-order of the
268      *               windows of this display against the windows on the parent display.
269      * @param sc The SurfaceControl that the top level layers for the display should be re-parented
270      *           to.
271      * @param displayId The id of the display to be re-parented.
272      */
reparentDisplayContent(IWindow window, in SurfaceControl sc, int displayId)273     void reparentDisplayContent(IWindow window, in SurfaceControl sc, int displayId);
274 
275     /**
276      * Update the location of a child display in its parent window. This enables windows in the
277      * child display to compute the global transformation matrix.
278      *
279      * @param window The parent window of the display.
280      * @param x The x coordinate in the parent window.
281      * @param y The y coordinate in the parent window.
282      * @param displayId The id of the display to be notified.
283      */
updateDisplayContentLocation(IWindow window, int x, int y, int displayId)284     void updateDisplayContentLocation(IWindow window, int x, int y, int displayId);
285 
286     /**
287      * Update a tap exclude region identified by provided id in the window. Touches on this region
288      * will neither be dispatched to this window nor change the focus to this window. Passing an
289      * invalid region will remove the area from the exclude region of this window.
290      */
updateTapExcludeRegion(IWindow window, int regionId, in Region region)291     void updateTapExcludeRegion(IWindow window, int regionId, in Region region);
292 
293     /**
294      * Called when the client has changed the local insets state, and now the server should reflect
295      * that new state.
296      */
insetsModified(IWindow window, in InsetsState state)297     void insetsModified(IWindow window, in InsetsState state);
298 
299 
300     /**
301      * Called when the system gesture exclusion has changed.
302      */
reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects)303     oneway void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects);
304 }
305