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