• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.Point;
22 import android.graphics.Rect;
23 import android.graphics.Region;
24 import android.os.Bundle;
25 import android.os.RemoteCallback;
26 import android.util.MergedConfiguration;
27 import android.view.DisplayCutout;
28 import android.view.InputChannel;
29 import android.view.IWindow;
30 import android.view.IWindowId;
31 import android.view.MotionEvent;
32 import android.view.WindowManager;
33 import android.view.InsetsSourceControl;
34 import android.view.InsetsState;
35 import android.view.InsetsVisibilities;
36 import android.view.Surface;
37 import android.view.SurfaceControl;
38 import android.view.SurfaceControl.Transaction;
39 import android.window.ClientWindowFrames;
40 import android.window.OnBackInvokedCallbackInfo;
41 
42 import java.util.List;
43 
44 /**
45  * System private per-application interface to the window manager.
46  *
47  * {@hide}
48  */
49 interface IWindowSession {
addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, in InsetsVisibilities requestedVisibilities, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls, out Rect attachedFrame, out float[] sizeCompatScale)50     int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs,
51             in int viewVisibility, in int layerStackId, in InsetsVisibilities requestedVisibilities,
52             out InputChannel outInputChannel, out InsetsState insetsState,
53             out InsetsSourceControl[] activeControls, out Rect attachedFrame,
54             out float[] sizeCompatScale);
addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, in int userId, in InsetsVisibilities requestedVisibilities, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls, out Rect attachedFrame, out float[] sizeCompatScale)55     int addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs,
56             in int viewVisibility, in int layerStackId, in int userId,
57             in InsetsVisibilities requestedVisibilities, out InputChannel outInputChannel,
58             out InsetsState insetsState, out InsetsSourceControl[] activeControls,
59             out Rect attachedFrame, out float[] sizeCompatScale);
addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out InsetsState insetsState, out Rect attachedFrame, out float[] sizeCompatScale)60     int addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs,
61             in int viewVisibility, in int layerStackId, out InsetsState insetsState,
62             out Rect attachedFrame, out float[] sizeCompatScale);
63     @UnsupportedAppUsage
remove(IWindow window)64     void remove(IWindow window);
65 
66     /**
67      * Change the parameters of a window.  You supply the
68      * new parameters, it returns the new frame of the window on screen (the
69      * position should be ignored) and surface of the window.  The surface
70      * will be invalid if the window is currently hidden, else you can use it
71      * to draw the window's contents.
72      *
73      * @param window The window being modified.
74      * @param attrs If non-null, new attributes to apply to the window.
75      * @param requestedWidth The width the window wants to be.
76      * @param requestedHeight The height the window wants to be.
77      * @param viewVisibility Window root view's visibility.
78      * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}.
79      * @param seq The calling sequence of {@link #relayout} and {@link #relayoutAsync}.
80      * @param lastSyncSeqId The last SyncSeqId that the client applied.
81      * @param outFrames The window frames used by the client side for layout.
82      * @param outMergedConfiguration New config container that holds global, override and merged
83      *                               config for window, if it is now becoming visible and the merged
84      *                               config has changed since it was last displayed.
85      * @param outSurfaceControl Object in which is placed the new display surface.
86      * @param insetsState The current insets state in the system.
87      * @param activeControls Objects which allow controlling {@link InsetsSource}s.
88      * @param bundle A temporary object to obtain the latest SyncSeqId.
89      * @return int Result flags, defined in {@link WindowManagerGlobal}.
90      */
relayout(IWindow window, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, int seq, int lastSyncSeqId, out ClientWindowFrames outFrames, out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl, out InsetsState insetsState, out InsetsSourceControl[] activeControls, out Bundle bundle)91     int relayout(IWindow window, in WindowManager.LayoutParams attrs,
92             int requestedWidth, int requestedHeight, int viewVisibility,
93             int flags, int seq, int lastSyncSeqId, out ClientWindowFrames outFrames,
94             out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl,
95             out InsetsState insetsState, out InsetsSourceControl[] activeControls,
96             out Bundle bundle);
97 
98     /**
99      * Similar to {@link #relayout} but this is an oneway method which doesn't return anything.
100      *
101      * @param window The window being modified.
102      * @param attrs If non-null, new attributes to apply to the window.
103      * @param requestedWidth The width the window wants to be.
104      * @param requestedHeight The height the window wants to be.
105      * @param viewVisibility Window root view's visibility.
106      * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}.
107      * @param seq The calling sequence of {@link #relayout} and {@link #relayoutAsync}.
108      * @param lastSyncSeqId The last SyncSeqId that the client applied.
109      */
relayoutAsync(IWindow window, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, int seq, int lastSyncSeqId)110     oneway void relayoutAsync(IWindow window, in WindowManager.LayoutParams attrs,
111             int requestedWidth, int requestedHeight, int viewVisibility, int flags, int seq,
112             int lastSyncSeqId);
113 
114     /*
115      * Notify the window manager that an application is relaunching and
116      * windows should be prepared for replacement.
117      *
118      * @param appToken The application
119      * @param childrenOnly Whether to only prepare child windows for replacement
120      * (for example when main windows are being reused via preservation).
121      */
prepareToReplaceWindows(IBinder appToken, boolean childrenOnly)122     oneway void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
123 
124     /**
125      * Called by a client to report that it ran out of graphics memory.
126      */
outOfMemory(IWindow window)127     boolean outOfMemory(IWindow window);
128 
129     /**
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      */
setInsets(IWindow window, int touchableInsets, in Rect contentInsets, in Rect visibleInsets, in Region touchableRegion)139     oneway void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
140             in Rect visibleInsets, in Region touchableRegion);
141 
142     /**
143      * Called when the client has finished drawing the surface, if needed.
144      *
145      * @param postDrawTransaction transaction filled by the client that can be
146      * used to synchronize any post draw transactions with the server. Transaction
147      * is null if there is no sync required.
148      */
149     @UnsupportedAppUsage
finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction, int seqId)150     oneway void finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction,
151             int seqId);
152 
153     @UnsupportedAppUsage
setInTouchMode(boolean showFocus)154     oneway 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(maxTargetSdk = 30, trackingBug = 170729553)
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      * Drops the content of the current drag operation for accessibility
183      */
dropForAccessibility(IWindow window, int x, int y)184     boolean dropForAccessibility(IWindow window, int x, int y);
185 
186     /**
187      * Report the result of a drop action targeted to the given window.
188      * consumed is 'true' when the drop was accepted by a valid recipient,
189      * 'false' otherwise.
190      */
reportDropResult(IWindow window, boolean consumed)191     oneway void reportDropResult(IWindow window, boolean consumed);
192 
193     /**
194      * Cancel the current drag operation.
195      * skipAnimation is 'true' when it should skip the drag cancel animation which brings the drag
196      * shadow image back to the drag start position.
197      */
cancelDragAndDrop(IBinder dragToken, boolean skipAnimation)198     oneway void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation);
199 
200     /**
201      * Tell the OS that we've just dragged into a View that is willing to accept the drop
202      */
dragRecipientEntered(IWindow window)203     oneway void dragRecipientEntered(IWindow window);
204 
205     /**
206      * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
207      */
dragRecipientExited(IWindow window)208     oneway void dragRecipientExited(IWindow window);
209 
210     /**
211      * For windows with the wallpaper behind them, and the wallpaper is
212      * larger than the screen, set the offset within the screen.
213      * For multi screen launcher type applications, xstep and ystep indicate
214      * how big the increment is from one screen to another.
215      */
setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep)216     oneway void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
217 
218     /**
219      * For wallpaper windows, sets the scale of the wallpaper based on
220      * SystemUI behavior.
221      */
setWallpaperZoomOut(IBinder windowToken, float scale)222     oneway void setWallpaperZoomOut(IBinder windowToken, float scale);
223 
224     /**
225      * For wallpaper windows, sets whether the wallpaper should actually be
226      * scaled when setWallpaperZoomOut is called. If set to false, the WallpaperService will
227      * receive the zoom out value but the surface won't be scaled.
228      */
setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom)229     oneway void setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom);
230 
231     @UnsupportedAppUsage
wallpaperOffsetsComplete(IBinder window)232     oneway void wallpaperOffsetsComplete(IBinder window);
233 
234     /**
235      * Apply a raw offset to the wallpaper service when shown behind this window.
236      */
setWallpaperDisplayOffset(IBinder windowToken, int x, int y)237     oneway void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
238 
sendWallpaperCommand(IBinder window, String action, int x, int y, int z, in Bundle extras, boolean sync)239     Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
240             int z, in Bundle extras, boolean sync);
241 
242     @UnsupportedAppUsage
wallpaperCommandComplete(IBinder window, in Bundle result)243     oneway void wallpaperCommandComplete(IBinder window, in Bundle result);
244 
245     /**
246      * Notifies that a rectangle on the screen has been requested.
247      */
onRectangleOnScreenRequested(IBinder token, in Rect rectangle)248     oneway void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
249 
getWindowId(IBinder window)250     IWindowId getWindowId(IBinder window);
251 
252     /**
253      * When the system is dozing in a low-power partially suspended state, pokes a short
254      * lived wake lock and ensures that the display is ready to accept the next frame
255      * of content drawn in the window.
256      *
257      * This mechanism is bound to the window rather than to the display manager or the
258      * power manager so that the system can ensure that the window is actually visible
259      * and prevent runaway applications from draining the battery.  This is similar to how
260      * FLAG_KEEP_SCREEN_ON works.
261      *
262      * This method is synchronous because it may need to acquire a wake lock before returning.
263      * The assumption is that this method will be called rather infrequently.
264      */
pokeDrawLock(IBinder window)265     void pokeDrawLock(IBinder window);
266 
267     /**
268      * Starts a task window move with {startX, startY} as starting point. The amount of move
269      * will be the offset between {startX, startY} and the new cursor position.
270      *
271      * Returns true if the move started successfully; false otherwise.
272      */
startMovingTask(IWindow window, float startX, float startY)273     boolean startMovingTask(IWindow window, float startX, float startY);
274 
finishMovingTask(IWindow window)275     oneway void finishMovingTask(IWindow window);
276 
updatePointerIcon(IWindow window)277     oneway void updatePointerIcon(IWindow window);
278 
279     /**
280      * Update a tap exclude region identified by provided id in the window. Touches on this region
281      * will neither be dispatched to this window nor change the focus to this window. Passing an
282      * invalid region will remove the area from the exclude region of this window.
283      */
updateTapExcludeRegion(IWindow window, in Region region)284     oneway void updateTapExcludeRegion(IWindow window, in Region region);
285 
286     /**
287      * Updates the requested visibilities of insets.
288      */
updateRequestedVisibilities(IWindow window, in InsetsVisibilities visibilities)289     oneway void updateRequestedVisibilities(IWindow window, in InsetsVisibilities visibilities);
290 
291     /**
292      * Called when the system gesture exclusion has changed.
293      */
reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects)294     oneway void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects);
295 
296     /**
297      * Called when the keep-clear areas for this window have changed.
298      */
reportKeepClearAreasChanged(IWindow window, in List<Rect> restricted, in List<Rect> unrestricted)299     oneway void reportKeepClearAreasChanged(IWindow window, in List<Rect> restricted,
300            in List<Rect> unrestricted);
301 
302     /**
303     * Request the server to call setInputWindowInfo on a given Surface, and return
304     * an input channel where the client can receive input.
305     */
grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window, in IBinder hostInputToken, int flags, int privateFlags, int type, in IBinder focusGrantToken, String inputHandleName, out InputChannel outInputChannel)306     void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
307             in IBinder hostInputToken, int flags, int privateFlags, int type,
308             in IBinder focusGrantToken, String inputHandleName, out InputChannel outInputChannel);
309 
310     /**
311      * Update the flags on an input channel associated with a particular surface.
312      */
updateInputChannel(in IBinder channelToken, int displayId, in SurfaceControl surface, int flags, int privateFlags, in Region region)313     oneway void updateInputChannel(in IBinder channelToken, int displayId,
314             in SurfaceControl surface, int flags, int privateFlags, in Region region);
315 
316     /**
317      * Transfer window focus to an embedded window if the calling window has focus.
318      *
319      * @param window - calling window owned by the caller. Window can be null if there
320      *                 is no host window but the caller must have permissions to create an embedded
321      *                 window without a host window.
322      * @param inputToken - token identifying the embedded window that should gain focus.
323      * @param grantFocus - true if focus should be granted to the embedded window, false if focus
324      *                     should be transferred back to the host window. If there is no host
325      *                     window, the system will try to find a new focus target.
326      */
grantEmbeddedWindowFocus(IWindow window, in IBinder inputToken, boolean grantFocus)327     void grantEmbeddedWindowFocus(IWindow window, in IBinder inputToken, boolean grantFocus);
328 
329     /**
330      * Generates an DisplayHash that can be used to validate whether specific content was on
331      * screen.
332      *
333      * @param window The token for the window to generate the hash of.
334      * @param boundsInWindow The size and position in the window of where to generate the hash.
335      * @param hashAlgorithm The String for the hash algorithm to use based on values returned
336      *                      from {@link IWindowManager#getSupportedDisplayHashAlgorithms()}
337      * @param callback The callback invoked to get the results of generateDisplayHash
338      */
generateDisplayHash(IWindow window, in Rect boundsInWindow, in String hashAlgorithm, in RemoteCallback callback)339     oneway void generateDisplayHash(IWindow window, in Rect boundsInWindow,
340             in String hashAlgorithm, in RemoteCallback callback);
341 
342     /**
343      * Sets the {@link OnBackInvokedCallbackInfo} containing the callback to be invoked for
344      * a window when back is triggered.
345      *
346      * @param window The token for the window to set the callback to.
347      * @param callbackInfo The {@link OnBackInvokedCallbackInfo} to set.
348      */
setOnBackInvokedCallbackInfo( IWindow window, in OnBackInvokedCallbackInfo callbackInfo)349     oneway void setOnBackInvokedCallbackInfo(
350             IWindow window, in OnBackInvokedCallbackInfo callbackInfo);
351 
352     /**
353      * Clears a touchable region set by {@link #setInsets}.
354      */
clearTouchableRegion(IWindow window)355     void clearTouchableRegion(IWindow window);
356 
357     /**
358      * Returns whether this window needs to cancel draw and retry later.
359      */
cancelDraw(IWindow window)360     boolean cancelDraw(IWindow window);
361 }
362