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.inputmethod.ImeTracker; 34 import android.view.InsetsSourceControl; 35 import android.view.InsetsState; 36 import android.view.Surface; 37 import android.view.SurfaceControl; 38 import android.view.SurfaceControl.Transaction; 39 import android.view.WindowRelayoutResult; 40 import android.window.ClientWindowFrames; 41 import android.window.InputTransferToken; 42 import android.window.OnBackInvokedCallbackInfo; 43 44 import java.util.List; 45 46 /** 47 * System private per-application interface to the window manager. 48 * 49 * {@hide} 50 */ 51 interface IWindowSession { 52 addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, int requestedVisibleTypes, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl.Array activeControls, out Rect attachedFrame, out float[] sizeCompatScale)53 int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, 54 in int viewVisibility, in int layerStackId, int requestedVisibleTypes, 55 out InputChannel outInputChannel, out InsetsState insetsState, 56 out InsetsSourceControl.Array activeControls, out Rect attachedFrame, 57 out float[] sizeCompatScale); addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, in int userId, int requestedVisibleTypes, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl.Array activeControls, out Rect attachedFrame, out float[] sizeCompatScale)58 int addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs, 59 in int viewVisibility, in int layerStackId, in int userId, int requestedVisibleTypes, 60 out InputChannel outInputChannel, out InsetsState insetsState, 61 out InsetsSourceControl.Array activeControls, out Rect attachedFrame, 62 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)63 int addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs, 64 in int viewVisibility, in int layerStackId, out InsetsState insetsState, 65 out Rect attachedFrame, out float[] sizeCompatScale); 66 67 /** 68 * Removes a clientToken from WMS, which includes unlinking the input channel. 69 * 70 * @param clientToken The token that should be removed. This will normally be the IWindow token 71 * for a standard window. It can also be the generic clientToken that was used when calling 72 * grantInputChannel 73 */ remove(IBinder clientToken)74 void remove(IBinder clientToken); 75 76 /** 77 * Change the parameters of a window. You supply the 78 * new parameters, it returns the new frame of the window on screen (the 79 * position should be ignored) and surface of the window. The surface 80 * will be invalid if the window is currently hidden, else you can use it 81 * to draw the window's contents. 82 * 83 * @param window The window being modified. 84 * @param attrs If non-null, new attributes to apply to the window. 85 * @param requestedWidth The width the window wants to be. 86 * @param requestedHeight The height the window wants to be. 87 * @param viewVisibility Window root view's visibility. 88 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}. 89 * @param seq The calling sequence of {@link #relayout} and {@link #relayoutAsync}. 90 * @param lastSyncSeqId The last SyncSeqId that the client applied. 91 * @param outRelayoutResult Data object contains the info to be returned from server side. 92 * @return int Result flags, defined in {@link WindowManagerGlobal}. 93 */ relayout(IWindow window, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, int seq, int lastSyncSeqId, out @nullable WindowRelayoutResult outRelayoutResult)94 int relayout(IWindow window, in WindowManager.LayoutParams attrs, int requestedWidth, 95 int requestedHeight, int viewVisibility, int flags, int seq, int lastSyncSeqId, 96 out @nullable WindowRelayoutResult outRelayoutResult); 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 * Called by a client to report that it ran out of graphics memory. 116 */ outOfMemory(IWindow window)117 boolean outOfMemory(IWindow window); 118 119 /** 120 * Tell the window manager about the content and visible insets of the 121 * given window, which can be used to adjust the <var>outContentInsets</var> 122 * and <var>outVisibleInsets</var> values returned by 123 * {@link #relayout relayout()} for windows behind this one. 124 * 125 * @param touchableInsets Controls which part of the window inside of its 126 * frame can receive pointer events, as defined by 127 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}. 128 */ setInsets(IWindow window, int touchableInsets, in Rect contentInsets, in Rect visibleInsets, in Region touchableRegion)129 oneway void setInsets(IWindow window, int touchableInsets, in Rect contentInsets, 130 in Rect visibleInsets, in Region touchableRegion); 131 132 /** 133 * Called when the client has finished drawing the surface, if needed. 134 * 135 * @param postDrawTransaction transaction filled by the client that can be 136 * used to synchronize any post draw transactions with the server. Transaction 137 * is null if there is no sync required. 138 */ 139 @UnsupportedAppUsage finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction, int seqId)140 oneway void finishDrawing(IWindow window, in SurfaceControl.Transaction postDrawTransaction, 141 int seqId); 142 143 /** 144 * Initiate the drag operation itself 145 * 146 * @param window Window which initiates drag operation. 147 * @param flags See {@code View#startDragAndDrop} 148 * @param surface Surface containing drag shadow image 149 * @param touchSource See {@code InputDevice#getSource()} 150 * @param touchDeviceId device ID of last touch event 151 * @param pointerId pointer ID of last touch event 152 * @param touchX X coordinate of last touch point 153 * @param touchY Y coordinate of last touch point 154 * @param thumbCenterX X coordinate for the position within the shadow image that should be 155 * underneath the touch point during the drag and drop operation. 156 * @param thumbCenterY Y coordinate for the position within the shadow image that should be 157 * underneath the touch point during the drag and drop operation. 158 * @param data Data transferred by drag and drop 159 * @return Token of drag operation which will be passed to cancelDragAndDrop. 160 */ performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource, int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data)161 IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource, 162 int touchDeviceId, int touchPointerId, float touchX, float touchY, float thumbCenterX, 163 float thumbCenterY, in ClipData data); 164 165 /** 166 * Drops the content of the current drag operation for accessibility 167 */ dropForAccessibility(IWindow window, int x, int y)168 boolean dropForAccessibility(IWindow window, int x, int y); 169 170 /** 171 * Report the result of a drop action targeted to the given window. 172 * consumed is 'true' when the drop was accepted by a valid recipient, 173 * 'false' otherwise. 174 */ reportDropResult(IWindow window, boolean consumed)175 oneway void reportDropResult(IWindow window, boolean consumed); 176 177 /** 178 * Cancel the current drag operation. 179 * skipAnimation is 'true' when it should skip the drag cancel animation which brings the drag 180 * shadow image back to the drag start position. 181 */ cancelDragAndDrop(IBinder dragToken, boolean skipAnimation)182 oneway void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation); 183 184 /** 185 * Tell the OS that we've just dragged into a View that is willing to accept the drop 186 */ dragRecipientEntered(IWindow window)187 oneway void dragRecipientEntered(IWindow window); 188 189 /** 190 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop 191 */ dragRecipientExited(IWindow window)192 oneway void dragRecipientExited(IWindow window); 193 194 /** 195 * For windows with the wallpaper behind them, and the wallpaper is 196 * larger than the screen, set the offset within the screen. 197 * For multi screen launcher type applications, xstep and ystep indicate 198 * how big the increment is from one screen to another. 199 */ setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep)200 oneway void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); 201 202 /** 203 * For wallpaper windows, sets the scale of the wallpaper based on 204 * SystemUI behavior. 205 */ setWallpaperZoomOut(IBinder windowToken, float scale)206 oneway void setWallpaperZoomOut(IBinder windowToken, float scale); 207 208 /** 209 * For wallpaper windows, sets whether the wallpaper should actually be 210 * scaled when setWallpaperZoomOut is called. If set to false, the WallpaperService will 211 * receive the zoom out value but the surface won't be scaled. 212 */ setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom)213 oneway void setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom); 214 215 @UnsupportedAppUsage wallpaperOffsetsComplete(IBinder window)216 oneway void wallpaperOffsetsComplete(IBinder window); 217 218 /** 219 * Apply a raw offset to the wallpaper service when shown behind this window. 220 */ setWallpaperDisplayOffset(IBinder windowToken, int x, int y)221 oneway void setWallpaperDisplayOffset(IBinder windowToken, int x, int y); 222 sendWallpaperCommand(IBinder window, String action, int x, int y, int z, in Bundle extras, boolean sync)223 oneway void sendWallpaperCommand(IBinder window, String action, int x, int y, 224 int z, in Bundle extras, boolean sync); 225 226 @UnsupportedAppUsage wallpaperCommandComplete(IBinder window, in Bundle result)227 oneway void wallpaperCommandComplete(IBinder window, in Bundle result); 228 229 /** 230 * Notifies that a rectangle on the screen has been requested. 231 */ onRectangleOnScreenRequested(IBinder token, in Rect rectangle)232 oneway void onRectangleOnScreenRequested(IBinder token, in Rect rectangle); 233 getWindowId(IBinder window)234 IWindowId getWindowId(IBinder window); 235 236 /** 237 * When the system is dozing in a low-power partially suspended state, pokes a short 238 * lived wake lock and ensures that the display is ready to accept the next frame 239 * of content drawn in the window. 240 * 241 * This mechanism is bound to the window rather than to the display manager or the 242 * power manager so that the system can ensure that the window is actually visible 243 * and prevent runaway applications from draining the battery. This is similar to how 244 * FLAG_KEEP_SCREEN_ON works. 245 * 246 * This method is synchronous because it may need to acquire a wake lock before returning. 247 * The assumption is that this method will be called rather infrequently. 248 */ pokeDrawLock(IBinder window)249 void pokeDrawLock(IBinder window); 250 251 /** 252 * Starts a task window move with {startX, startY} as starting point. The amount of move 253 * will be the offset between {startX, startY} and the new cursor position. 254 * 255 * Returns true if the move started successfully; false otherwise. 256 */ startMovingTask(IWindow window, float startX, float startY)257 boolean startMovingTask(IWindow window, float startX, float startY); 258 finishMovingTask(IWindow window)259 oneway void finishMovingTask(IWindow window); 260 261 /** 262 * Update a tap exclude region identified by provided id in the window. Touches on this region 263 * will neither be dispatched to this window nor change the focus to this window. Passing an 264 * invalid region will remove the area from the exclude region of this window. 265 */ updateTapExcludeRegion(IWindow window, in Region region)266 oneway void updateTapExcludeRegion(IWindow window, in Region region); 267 268 /** 269 * Updates the requested visible types of insets. 270 */ updateRequestedVisibleTypes(IWindow window, int requestedVisibleTypes, in @nullable ImeTracker.Token imeStatsToken)271 oneway void updateRequestedVisibleTypes(IWindow window, int requestedVisibleTypes, 272 in @nullable ImeTracker.Token imeStatsToken); 273 274 /** 275 * Notifies WindowState what insets types are currently running within the Window. 276 * see {@link com.android.server.wm.WindowState#mInsetsAnimationRunning). 277 * 278 * @param window The window that is insets animaiton is running. 279 * @param animatingTypes Indicates the currently animating insets types. 280 * @param imeStatsToken the token tracking the current IME request or {@code null} otherwise. 281 */ updateAnimatingTypes(IWindow window, int animatingTypes, in @nullable ImeTracker.Token imeStatsToken)282 oneway void updateAnimatingTypes(IWindow window, int animatingTypes, 283 in @nullable ImeTracker.Token imeStatsToken); 284 285 /** 286 * Called when the system gesture exclusion has changed. 287 */ reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects)288 oneway void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects); 289 290 /** 291 * Called when the DecorView gesture interception state has changed. 292 */ reportDecorViewGestureInterceptionChanged(IWindow window, in boolean intercepted)293 oneway void reportDecorViewGestureInterceptionChanged(IWindow window, in boolean intercepted); 294 295 /** 296 * Called when the keep-clear areas for this window have changed. 297 */ reportKeepClearAreasChanged(IWindow window, in List<Rect> restricted, in List<Rect> unrestricted)298 oneway void reportKeepClearAreasChanged(IWindow window, in List<Rect> restricted, 299 in List<Rect> unrestricted); 300 301 /** 302 * Request the server to call setInputWindowInfo on a given Surface, and return 303 * an input channel where the client can receive input. For windows, the clientToken should be 304 * the IWindow binder object. For other requests, the token can be any unique IBinder token to 305 * be used as unique identifier. 306 */ grantInputChannel(int displayId, in SurfaceControl surface, in IBinder clientToken, in @nullable InputTransferToken hostInputTransferToken, int flags, int privateFlags, int inputFeatures, int type, in IBinder windowToken, in InputTransferToken embeddedInputTransferToken, String inputHandleName, out InputChannel outInputChannel)307 void grantInputChannel(int displayId, in SurfaceControl surface, in IBinder clientToken, 308 in @nullable InputTransferToken hostInputTransferToken, int flags, int privateFlags, 309 int inputFeatures, int type, in IBinder windowToken, 310 in InputTransferToken embeddedInputTransferToken, String inputHandleName, 311 out InputChannel outInputChannel); 312 313 /** 314 * Update the flags on an input channel associated with a particular surface. 315 */ updateInputChannel(in IBinder channelToken, int displayId, in SurfaceControl surface, int flags, int privateFlags, int inputFeatures, in Region region)316 oneway void updateInputChannel(in IBinder channelToken, int displayId, 317 in SurfaceControl surface, int flags, int privateFlags, int inputFeatures, 318 in Region region); 319 320 /** 321 * Transfer window focus to an embedded window if the calling window has focus. 322 * 323 * @param window - calling window owned by the caller. Window can be null if there 324 * is no host window but the caller must have permissions to create an embedded 325 * window without a host window. 326 * @param inputToken - token identifying the embedded window that should gain focus. 327 * @param grantFocus - true if focus should be granted to the embedded window, false if focus 328 * should be transferred back to the host window. If there is no host 329 * window, the system will try to find a new focus target. 330 */ grantEmbeddedWindowFocus(IWindow window, in InputTransferToken inputToken, boolean grantFocus)331 void grantEmbeddedWindowFocus(IWindow window, in InputTransferToken inputToken, 332 boolean grantFocus); 333 334 /** 335 * Generates an DisplayHash that can be used to validate whether specific content was on 336 * screen. 337 * 338 * @param window The token for the window to generate the hash of. 339 * @param boundsInWindow The size and position in the window of where to generate the hash. 340 * @param hashAlgorithm The String for the hash algorithm to use based on values returned 341 * from {@link IWindowManager#getSupportedDisplayHashAlgorithms()} 342 * @param callback The callback invoked to get the results of generateDisplayHash 343 */ generateDisplayHash(IWindow window, in Rect boundsInWindow, in String hashAlgorithm, in RemoteCallback callback)344 oneway void generateDisplayHash(IWindow window, in Rect boundsInWindow, 345 in String hashAlgorithm, in RemoteCallback callback); 346 347 /** 348 * Sets the {@link OnBackInvokedCallbackInfo} containing the callback to be invoked for 349 * a window when back is triggered. 350 * 351 * @param window The token for the window to set the callback to. 352 * @param callbackInfo The {@link OnBackInvokedCallbackInfo} to set. 353 */ setOnBackInvokedCallbackInfo( IWindow window, in OnBackInvokedCallbackInfo callbackInfo)354 oneway void setOnBackInvokedCallbackInfo( 355 IWindow window, in OnBackInvokedCallbackInfo callbackInfo); 356 357 /** 358 * Clears a touchable region set by {@link #setInsets}. 359 */ clearTouchableRegion(IWindow window)360 void clearTouchableRegion(IWindow window); 361 362 /** 363 * Returns whether this window needs to cancel draw and retry later. 364 */ cancelDraw(IWindow window)365 boolean cancelDraw(IWindow window); 366 367 /** 368 * Moves the focus to the adjacent window if there is one in the given direction. This can only 369 * move the focus to the window in the same leaf task. 370 * 371 * @param fromWindow The calling window that the focus is moved from. 372 * @param direction The {@link android.view.View.FocusDirection} that the new focus should go. 373 * @return {@code true} if the focus changes. Otherwise, {@code false}. 374 */ moveFocusToAdjacentWindow(IWindow fromWindow, int direction)375 boolean moveFocusToAdjacentWindow(IWindow fromWindow, int direction); 376 377 /** 378 * Notifies the statsToken and IME visibility to the ImeInsetsSourceProvider. 379 * 380 * @param window The window that is used to get the ImeInsetsSourceProvider. 381 * @param visible {@code true} to make it visible, {@code false} to hide it. 382 * @param statsToken the token tracking the current IME request. 383 */ notifyImeWindowVisibilityChangedFromClient(IWindow window, boolean visible, in ImeTracker.Token statsToken)384 oneway void notifyImeWindowVisibilityChangedFromClient(IWindow window, boolean visible, 385 in ImeTracker.Token statsToken); 386 } 387