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.InputChannel; 26 import android.view.IWindow; 27 import android.view.IWindowId; 28 import android.view.MotionEvent; 29 import android.view.WindowManager; 30 import android.view.Surface; 31 32 /** 33 * System private per-application interface to the window manager. 34 * 35 * {@hide} 36 */ 37 interface IWindowSession { add(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets, out InputChannel outInputChannel)38 int add(IWindow window, int seq, in WindowManager.LayoutParams attrs, 39 in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets, 40 out InputChannel outInputChannel); addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets, out InputChannel outInputChannel)41 int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, 42 in int viewVisibility, in int layerStackId, out Rect outContentInsets, 43 out Rect outStableInsets, out Rect outOutsets, out InputChannel outInputChannel); addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets)44 int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, 45 in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets); addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outContentInsets, out Rect outStableInsets)46 int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, 47 in int viewVisibility, in int layerStackId, out Rect outContentInsets, 48 out Rect outStableInsets); remove(IWindow window)49 void remove(IWindow window); 50 51 /** 52 * Change the parameters of a window. You supply the 53 * new parameters, it returns the new frame of the window on screen (the 54 * position should be ignored) and surface of the window. The surface 55 * will be invalid if the window is currently hidden, else you can use it 56 * to draw the window's contents. 57 * 58 * @param window The window being modified. 59 * @param seq Ordering sequence number. 60 * @param attrs If non-null, new attributes to apply to the window. 61 * @param requestedWidth The width the window wants to be. 62 * @param requestedHeight The height the window wants to be. 63 * @param viewVisibility Window root view's visibility. 64 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}, 65 * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}. 66 * @param outFrame Rect in which is placed the new position/size on 67 * screen. 68 * @param outOverscanInsets Rect in which is placed the offsets from 69 * <var>outFrame</var> in which the content of the window are inside 70 * of the display's overlay region. 71 * @param outContentInsets Rect in which is placed the offsets from 72 * <var>outFrame</var> in which the content of the window should be 73 * placed. This can be used to modify the window layout to ensure its 74 * contents are visible to the user, taking into account system windows 75 * like the status bar or a soft keyboard. 76 * @param outVisibleInsets Rect in which is placed the offsets from 77 * <var>outFrame</var> in which the window is actually completely visible 78 * to the user. This can be used to temporarily scroll the window's 79 * contents to make sure the user can see it. This is different than 80 * <var>outContentInsets</var> in that these insets change transiently, 81 * so complex relayout of the window should not happen based on them. 82 * @param outOutsets Rect in which is placed the dead area of the screen that we would like to 83 * treat as real display. Example of such area is a chin in some models of wearable devices. 84 * @param outBackdropFrame Rect which is used draw the resizing background during a resize 85 * operation. 86 * @param outMergedConfiguration New config container that holds global, override and merged 87 * config for window, if it is now becoming visible and the merged configuration has changed 88 * since it was last displayed. 89 * @param outSurface Object in which is placed the new display surface. 90 * 91 * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS}, 92 * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}. 93 */ relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, out Rect outFrame, out Rect outOverscanInsets, out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets, out Rect outOutsets, out Rect outBackdropFrame, out MergedConfiguration outMergedConfiguration, out Surface outSurface)94 int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs, 95 int requestedWidth, int requestedHeight, int viewVisibility, 96 int flags, out Rect outFrame, out Rect outOverscanInsets, 97 out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets, 98 out Rect outOutsets, out Rect outBackdropFrame, 99 out MergedConfiguration outMergedConfiguration, out Surface outSurface); 100 101 /* 102 * Notify the window manager that an application is relaunching and 103 * windows should be prepared for replacement. 104 * 105 * @param appToken The application 106 * @param childrenOnly Whether to only prepare child windows for replacement 107 * (for example when main windows are being reused via preservation). 108 */ prepareToReplaceWindows(IBinder appToken, boolean childrenOnly)109 void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly); 110 111 /** 112 * Called by a client to report that it ran out of graphics memory. 113 */ outOfMemory(IWindow window)114 boolean outOfMemory(IWindow window); 115 116 /** 117 * Give the window manager a hint of the part of the window that is 118 * completely transparent, allowing it to work with the surface flinger 119 * to optimize compositing of this part of the window. 120 */ setTransparentRegion(IWindow window, in Region region)121 void setTransparentRegion(IWindow window, in Region region); 122 123 /** 124 * Tell the window manager about the content and visible insets of the 125 * given window, which can be used to adjust the <var>outContentInsets</var> 126 * and <var>outVisibleInsets</var> values returned by 127 * {@link #relayout relayout()} for windows behind this one. 128 * 129 * @param touchableInsets Controls which part of the window inside of its 130 * frame can receive pointer events, as defined by 131 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}. 132 */ setInsets(IWindow window, int touchableInsets, in Rect contentInsets, in Rect visibleInsets, in Region touchableRegion)133 void setInsets(IWindow window, int touchableInsets, in Rect contentInsets, 134 in Rect visibleInsets, in Region touchableRegion); 135 136 /** 137 * Return the current display size in which the window is being laid out, 138 * accounting for screen decorations around it. 139 */ getDisplayFrame(IWindow window, out Rect outDisplayFrame)140 void getDisplayFrame(IWindow window, out Rect outDisplayFrame); 141 finishDrawing(IWindow window)142 void finishDrawing(IWindow window); 143 setInTouchMode(boolean showFocus)144 void setInTouchMode(boolean showFocus); getInTouchMode()145 boolean getInTouchMode(); 146 performHapticFeedback(IWindow window, int effectId, boolean always)147 boolean performHapticFeedback(IWindow window, int effectId, boolean always); 148 149 /** 150 * Allocate the drag's thumbnail surface. Also assigns a token that identifies 151 * the drag to the OS and passes that as the return value. A return value of 152 * null indicates failure. 153 */ prepareDrag(IWindow window, int flags, int thumbnailWidth, int thumbnailHeight, out Surface outSurface)154 IBinder prepareDrag(IWindow window, int flags, 155 int thumbnailWidth, int thumbnailHeight, out Surface outSurface); 156 157 /** 158 * Initiate the drag operation itself 159 */ performDrag(IWindow window, IBinder dragToken, int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data)160 boolean performDrag(IWindow window, IBinder dragToken, int touchSource, 161 float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); 162 163 /** 164 * Report the result of a drop action targeted to the given window. 165 * consumed is 'true' when the drop was accepted by a valid recipient, 166 * 'false' otherwise. 167 */ reportDropResult(IWindow window, boolean consumed)168 void reportDropResult(IWindow window, boolean consumed); 169 170 /** 171 * Cancel the current drag operation. 172 */ cancelDragAndDrop(IBinder dragToken)173 void cancelDragAndDrop(IBinder dragToken); 174 175 /** 176 * Tell the OS that we've just dragged into a View that is willing to accept the drop 177 */ dragRecipientEntered(IWindow window)178 void dragRecipientEntered(IWindow window); 179 180 /** 181 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop 182 */ dragRecipientExited(IWindow window)183 void dragRecipientExited(IWindow window); 184 185 /** 186 * For windows with the wallpaper behind them, and the wallpaper is 187 * larger than the screen, set the offset within the screen. 188 * For multi screen launcher type applications, xstep and ystep indicate 189 * how big the increment is from one screen to another. 190 */ setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep)191 void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); 192 wallpaperOffsetsComplete(IBinder window)193 void wallpaperOffsetsComplete(IBinder window); 194 195 /** 196 * Apply a raw offset to the wallpaper service when shown behind this window. 197 */ setWallpaperDisplayOffset(IBinder windowToken, int x, int y)198 void setWallpaperDisplayOffset(IBinder windowToken, int x, int y); 199 sendWallpaperCommand(IBinder window, String action, int x, int y, int z, in Bundle extras, boolean sync)200 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, 201 int z, in Bundle extras, boolean sync); 202 wallpaperCommandComplete(IBinder window, in Bundle result)203 void wallpaperCommandComplete(IBinder window, in Bundle result); 204 205 /** 206 * Notifies that a rectangle on the screen has been requested. 207 */ onRectangleOnScreenRequested(IBinder token, in Rect rectangle)208 void onRectangleOnScreenRequested(IBinder token, in Rect rectangle); 209 getWindowId(IBinder window)210 IWindowId getWindowId(IBinder window); 211 212 /** 213 * When the system is dozing in a low-power partially suspended state, pokes a short 214 * lived wake lock and ensures that the display is ready to accept the next frame 215 * of content drawn in the window. 216 * 217 * This mechanism is bound to the window rather than to the display manager or the 218 * power manager so that the system can ensure that the window is actually visible 219 * and prevent runaway applications from draining the battery. This is similar to how 220 * FLAG_KEEP_SCREEN_ON works. 221 * 222 * This method is synchronous because it may need to acquire a wake lock before returning. 223 * The assumption is that this method will be called rather infrequently. 224 */ pokeDrawLock(IBinder window)225 void pokeDrawLock(IBinder window); 226 227 /** 228 * Starts a task window move with {startX, startY} as starting point. The amount of move 229 * will be the offset between {startX, startY} and the new cursor position. 230 * 231 * Returns true if the move started successfully; false otherwise. 232 */ startMovingTask(IWindow window, float startX, float startY)233 boolean startMovingTask(IWindow window, float startX, float startY); 234 updatePointerIcon(IWindow window)235 void updatePointerIcon(IWindow window); 236 } 237