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.Surface; 36 import android.view.SurfaceControl; 37 import android.view.SurfaceControl.Transaction; 38 import android.window.ClientWindowFrames; 39 40 import java.util.List; 41 42 /** 43 * System private per-application interface to the window manager. 44 * 45 * {@hide} 46 */ 47 interface IWindowSession { addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, in InsetsState requestedVisibility, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls)48 int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, 49 in int viewVisibility, in int layerStackId, in InsetsState requestedVisibility, 50 out InputChannel outInputChannel, out InsetsState insetsState, 51 out InsetsSourceControl[] activeControls); addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, in int userId, in InsetsState requestedVisibility, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls)52 int addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs, 53 in int viewVisibility, in int layerStackId, in int userId, 54 in InsetsState requestedVisibility, out InputChannel outInputChannel, 55 out InsetsState insetsState, out InsetsSourceControl[] activeControls); addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out InsetsState insetsState)56 int addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs, 57 in int viewVisibility, in int layerStackId, out InsetsState insetsState); 58 @UnsupportedAppUsage remove(IWindow window)59 void remove(IWindow window); 60 61 /** 62 * Change the parameters of a window. You supply the 63 * new parameters, it returns the new frame of the window on screen (the 64 * position should be ignored) and surface of the window. The surface 65 * will be invalid if the window is currently hidden, else you can use it 66 * to draw the window's contents. 67 * 68 * @param window The window being modified. 69 * @param attrs If non-null, new attributes to apply to the window. 70 * @param requestedWidth The width the window wants to be. 71 * @param requestedHeight The height the window wants to be. 72 * @param viewVisibility Window root view's visibility. 73 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}, 74 * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}. 75 * @param frameNumber A frame number in which changes requested in this layout will be rendered. 76 * @param outFrame Rect in which is placed the new position/size on 77 * screen. 78 * @param outContentInsets Rect in which is placed the offsets from 79 * <var>outFrame</var> in which the content of the window should be 80 * placed. This can be used to modify the window layout to ensure its 81 * contents are visible to the user, taking into account system windows 82 * like the status bar or a soft keyboard. 83 * @param outVisibleInsets Rect in which is placed the offsets from 84 * <var>outFrame</var> in which the window is actually completely visible 85 * to the user. This can be used to temporarily scroll the window's 86 * contents to make sure the user can see it. This is different than 87 * <var>outContentInsets</var> in that these insets change transiently, 88 * so complex relayout of the window should not happen based on them. 89 * @param outOutsets Rect in which is placed the dead area of the screen that we would like to 90 * treat as real display. Example of such area is a chin in some models of wearable devices. 91 * @param outBackdropFrame Rect which is used draw the resizing background during a resize 92 * operation. 93 * @param outMergedConfiguration New config container that holds global, override and merged 94 * config for window, if it is now becoming visible and the merged configuration has changed 95 * since it was last displayed. 96 * @param outSurface Object in which is placed the new display surface. 97 * @param insetsState The current insets state in the system. 98 * @param outSurfaceSize The width and height of the surface control 99 * 100 * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS}, 101 * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}. 102 */ relayout(IWindow window, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, long frameNumber, out ClientWindowFrames outFrames, out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl, out InsetsState insetsState, out InsetsSourceControl[] activeControls, out Point outSurfaceSize)103 int relayout(IWindow window, in WindowManager.LayoutParams attrs, 104 int requestedWidth, int requestedHeight, int viewVisibility, 105 int flags, long frameNumber, out ClientWindowFrames outFrames, 106 out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl, 107 out InsetsState insetsState, out InsetsSourceControl[] activeControls, 108 out Point outSurfaceSize); 109 110 /* 111 * Notify the window manager that an application is relaunching and 112 * windows should be prepared for replacement. 113 * 114 * @param appToken The application 115 * @param childrenOnly Whether to only prepare child windows for replacement 116 * (for example when main windows are being reused via preservation). 117 */ prepareToReplaceWindows(IBinder appToken, boolean childrenOnly)118 oneway void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly); 119 120 /** 121 * Called by a client to report that it ran out of graphics memory. 122 */ outOfMemory(IWindow window)123 boolean outOfMemory(IWindow window); 124 125 /** 126 * Tell the window manager about the content and visible insets of the 127 * given window, which can be used to adjust the <var>outContentInsets</var> 128 * and <var>outVisibleInsets</var> values returned by 129 * {@link #relayout relayout()} for windows behind this one. 130 * 131 * @param touchableInsets Controls which part of the window inside of its 132 * frame can receive pointer events, as defined by 133 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}. 134 */ setInsets(IWindow window, int touchableInsets, in Rect contentInsets, in Rect visibleInsets, in Region touchableRegion)135 oneway void setInsets(IWindow window, int touchableInsets, in Rect contentInsets, 136 in Rect visibleInsets, in Region touchableRegion); 137 138 /** 139 * Called when the client has finished drawing the surface, if needed. 140 * 141 * @param postDrawTransaction transaction filled by the client that can be 142 * used to synchronize any post draw transactions with the server. Transaction 143 * is null if there is no sync required. 144 */ 145 @UnsupportedAppUsage finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction)146 oneway void finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction); 147 148 @UnsupportedAppUsage setInTouchMode(boolean showFocus)149 oneway void setInTouchMode(boolean showFocus); 150 @UnsupportedAppUsage getInTouchMode()151 boolean getInTouchMode(); 152 153 @UnsupportedAppUsage performHapticFeedback(int effectId, boolean always)154 boolean performHapticFeedback(int effectId, boolean always); 155 156 /** 157 * Initiate the drag operation itself 158 * 159 * @param window Window which initiates drag operation. 160 * @param flags See {@code View#startDragAndDrop} 161 * @param surface Surface containing drag shadow image 162 * @param touchSource See {@code InputDevice#getSource()} 163 * @param touchX X coordinate of last touch point 164 * @param touchY Y coordinate of last touch point 165 * @param thumbCenterX X coordinate for the position within the shadow image that should be 166 * underneath the touch point during the drag and drop operation. 167 * @param thumbCenterY Y coordinate for the position within the shadow image that should be 168 * underneath the touch point during the drag and drop operation. 169 * @param data Data transferred by drag and drop 170 * @return Token of drag operation which will be passed to cancelDragAndDrop. 171 */ 172 @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)173 IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource, 174 float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); 175 176 /** 177 * Report the result of a drop action targeted to the given window. 178 * consumed is 'true' when the drop was accepted by a valid recipient, 179 * 'false' otherwise. 180 */ reportDropResult(IWindow window, boolean consumed)181 oneway void reportDropResult(IWindow window, boolean consumed); 182 183 /** 184 * Cancel the current drag operation. 185 * skipAnimation is 'true' when it should skip the drag cancel animation which brings the drag 186 * shadow image back to the drag start position. 187 */ cancelDragAndDrop(IBinder dragToken, boolean skipAnimation)188 oneway void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation); 189 190 /** 191 * Tell the OS that we've just dragged into a View that is willing to accept the drop 192 */ dragRecipientEntered(IWindow window)193 oneway void dragRecipientEntered(IWindow window); 194 195 /** 196 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop 197 */ dragRecipientExited(IWindow window)198 oneway void dragRecipientExited(IWindow window); 199 200 /** 201 * For windows with the wallpaper behind them, and the wallpaper is 202 * larger than the screen, set the offset within the screen. 203 * For multi screen launcher type applications, xstep and ystep indicate 204 * how big the increment is from one screen to another. 205 */ setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep)206 oneway void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); 207 208 /** 209 * For wallpaper windows, sets the scale of the wallpaper based on 210 * SystemUI behavior. 211 */ setWallpaperZoomOut(IBinder windowToken, float scale)212 oneway void setWallpaperZoomOut(IBinder windowToken, float scale); 213 214 /** 215 * For wallpaper windows, sets whether the wallpaper should actually be 216 * scaled when setWallpaperZoomOut is called. If set to false, the WallpaperService will 217 * receive the zoom out value but the surface won't be scaled. 218 */ setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom)219 oneway void setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom); 220 221 @UnsupportedAppUsage wallpaperOffsetsComplete(IBinder window)222 oneway void wallpaperOffsetsComplete(IBinder window); 223 224 /** 225 * Apply a raw offset to the wallpaper service when shown behind this window. 226 */ setWallpaperDisplayOffset(IBinder windowToken, int x, int y)227 oneway void setWallpaperDisplayOffset(IBinder windowToken, int x, int y); 228 sendWallpaperCommand(IBinder window, String action, int x, int y, int z, in Bundle extras, boolean sync)229 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, 230 int z, in Bundle extras, boolean sync); 231 232 @UnsupportedAppUsage wallpaperCommandComplete(IBinder window, in Bundle result)233 oneway void wallpaperCommandComplete(IBinder window, in Bundle result); 234 235 /** 236 * Notifies that a rectangle on the screen has been requested. 237 */ onRectangleOnScreenRequested(IBinder token, in Rect rectangle)238 oneway void onRectangleOnScreenRequested(IBinder token, in Rect rectangle); 239 getWindowId(IBinder window)240 IWindowId getWindowId(IBinder window); 241 242 /** 243 * When the system is dozing in a low-power partially suspended state, pokes a short 244 * lived wake lock and ensures that the display is ready to accept the next frame 245 * of content drawn in the window. 246 * 247 * This mechanism is bound to the window rather than to the display manager or the 248 * power manager so that the system can ensure that the window is actually visible 249 * and prevent runaway applications from draining the battery. This is similar to how 250 * FLAG_KEEP_SCREEN_ON works. 251 * 252 * This method is synchronous because it may need to acquire a wake lock before returning. 253 * The assumption is that this method will be called rather infrequently. 254 */ pokeDrawLock(IBinder window)255 void pokeDrawLock(IBinder window); 256 257 /** 258 * Starts a task window move with {startX, startY} as starting point. The amount of move 259 * will be the offset between {startX, startY} and the new cursor position. 260 * 261 * Returns true if the move started successfully; false otherwise. 262 */ startMovingTask(IWindow window, float startX, float startY)263 boolean startMovingTask(IWindow window, float startX, float startY); 264 finishMovingTask(IWindow window)265 oneway void finishMovingTask(IWindow window); 266 updatePointerIcon(IWindow window)267 oneway void updatePointerIcon(IWindow window); 268 269 /** 270 * Update the location of a child display in its parent window. This enables windows in the 271 * child display to compute the global transformation matrix. 272 * 273 * @param window The parent window of the display. 274 * @param x The x coordinate in the parent window. 275 * @param y The y coordinate in the parent window. 276 * @param displayId The id of the display to be notified. 277 */ updateDisplayContentLocation(IWindow window, int x, int y, int displayId)278 oneway void updateDisplayContentLocation(IWindow window, int x, int y, int displayId); 279 280 /** 281 * Update a tap exclude region identified by provided id in the window. Touches on this region 282 * will neither be dispatched to this window nor change the focus to this window. Passing an 283 * invalid region will remove the area from the exclude region of this window. 284 */ updateTapExcludeRegion(IWindow window, in Region region)285 oneway void updateTapExcludeRegion(IWindow window, in Region region); 286 287 /** 288 * Called when the client has changed the local insets state, and now the server should reflect 289 * that new state. 290 */ insetsModified(IWindow window, in InsetsState state)291 oneway void insetsModified(IWindow window, in InsetsState state); 292 293 /** 294 * Called when the system gesture exclusion has changed. 295 */ reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects)296 oneway void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects); 297 298 /** 299 * Request the server to call setInputWindowInfo on a given Surface, and return 300 * an input channel where the client can receive input. 301 */ grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window, in IBinder hostInputToken, int flags, int privateFlags, int type, out InputChannel outInputChannel)302 void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window, 303 in IBinder hostInputToken, int flags, int privateFlags, int type, 304 out InputChannel outInputChannel); 305 306 /** 307 * Update the flags on an input channel associated with a particular surface. 308 */ updateInputChannel(in IBinder channelToken, int displayId, in SurfaceControl surface, int flags, int privateFlags, in Region region)309 oneway void updateInputChannel(in IBinder channelToken, int displayId, 310 in SurfaceControl surface, int flags, int privateFlags, in Region region); 311 312 /** 313 * Transfer window focus to an embedded window if the calling window has focus. 314 * 315 * @param window - calling window owned by the caller. Window can be null if there 316 * is no host window but the caller must have permissions to create an embedded 317 * window without a host window. 318 * @param inputToken - token identifying the embedded window that should gain focus. 319 * @param grantFocus - true if focus should be granted to the embedded window, false if focus 320 * should be transferred back to the host window. If there is no host 321 * window, the system will try to find a new focus target. 322 */ grantEmbeddedWindowFocus(IWindow window, in IBinder inputToken, boolean grantFocus)323 void grantEmbeddedWindowFocus(IWindow window, in IBinder inputToken, boolean grantFocus); 324 325 /** 326 * Generates an DisplayHash that can be used to validate whether specific content was on 327 * screen. 328 * 329 * @param window The token for the window to generate the hash of. 330 * @param boundsInWindow The size and position in the window of where to generate the hash. 331 * @param hashAlgorithm The String for the hash algorithm to use based on values returned 332 * from {@link IWindowManager#getSupportedDisplayHashAlgorithms()} 333 * @param callback The callback invoked to get the results of generateDisplayHash 334 */ generateDisplayHash(IWindow window, in Rect boundsInWindow, in String hashAlgorithm, in RemoteCallback callback)335 oneway void generateDisplayHash(IWindow window, in Rect boundsInWindow, 336 in String hashAlgorithm, in RemoteCallback callback); 337 } 338