The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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. |
Andrii Kulian | 4460796 | 2017-03-16 11:06:24 -0700 | [diff] [blame] | 14 | ** See the License for the specific language governing permissions and |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | package android.view; |
| 19 | |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 20 | import android.content.ClipData; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import android.graphics.Rect; |
| 22 | import android.graphics.Region; |
Dianne Hackborn | 7580493 | 2009-10-20 20:15:20 -0700 | [diff] [blame] | 23 | import android.os.Bundle; |
Andrii Kulian | 4460796 | 2017-03-16 11:06:24 -0700 | [diff] [blame] | 24 | import android.util.MergedConfiguration; |
Jeff Brown | 46b9ac0 | 2010-04-22 18:58:52 -0700 | [diff] [blame] | 25 | import android.view.InputChannel; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.view.IWindow; |
Dianne Hackborn | e3f23a3 | 2013-03-01 13:25:35 -0800 | [diff] [blame] | 27 | import android.view.IWindowId; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 { |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 38 | int add(IWindow window, int seq, in WindowManager.LayoutParams attrs, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 39 | in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets, |
Jeff Brown | 46b9ac0 | 2010-04-22 18:58:52 -0700 | [diff] [blame] | 40 | out InputChannel outInputChannel); |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 41 | int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, |
| 42 | in int viewVisibility, in int layerStackId, out Rect outContentInsets, |
Filip Gruszczynski | 0ec1328 | 2015-06-25 11:26:01 -0700 | [diff] [blame] | 43 | out Rect outStableInsets, out Rect outOutsets, out InputChannel outInputChannel); |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 44 | int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 45 | in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets); |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 46 | int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 47 | in int viewVisibility, in int layerStackId, out Rect outContentInsets, |
| 48 | out Rect outStableInsets); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | void remove(IWindow window); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 50 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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. |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 59 | * @param seq Ordering sequence number. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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. |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 64 | * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}, |
| 65 | * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 66 | * @param outFrame Rect in which is placed the new position/size on |
| 67 | * screen. |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 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. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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. |
Filip Gruszczynski | 2217f61 | 2015-05-26 11:32:08 -0700 | [diff] [blame] | 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. |
Jorim Jaggi | 2e95a48 | 2016-01-14 17:36:55 -0800 | [diff] [blame] | 84 | * @param outBackdropFrame Rect which is used draw the resizing background during a resize |
| 85 | * operation. |
Andrii Kulian | 4460796 | 2017-03-16 11:06:24 -0700 | [diff] [blame] | 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. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | * @param outSurface Object in which is placed the new display surface. |
Filip Gruszczynski | 2217f61 | 2015-05-26 11:32:08 -0700 | [diff] [blame] | 90 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 91 | * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS}, |
| 92 | * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 93 | */ |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 94 | int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | int requestedWidth, int requestedHeight, int viewVisibility, |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 96 | int flags, out Rect outFrame, out Rect outOverscanInsets, |
Adrian Roos | fa10423 | 2014-06-20 16:10:14 -0700 | [diff] [blame] | 97 | out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets, |
Andrii Kulian | 4460796 | 2017-03-16 11:06:24 -0700 | [diff] [blame] | 98 | out Rect outOutsets, out Rect outBackdropFrame, |
| 99 | out MergedConfiguration outMergedConfiguration, out Surface outSurface); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | |
Robert Carr | 23fa16b | 2016-01-13 13:19:58 -0800 | [diff] [blame] | 101 | /* |
| 102 | * Notify the window manager that an application is relaunching and |
Robert Carr | 77bdfb5 | 2016-05-02 18:18:31 -0700 | [diff] [blame] | 103 | * windows should be prepared for replacement. |
Robert Carr | 23fa16b | 2016-01-13 13:19:58 -0800 | [diff] [blame] | 104 | * |
| 105 | * @param appToken The application |
Robert Carr | 77bdfb5 | 2016-05-02 18:18:31 -0700 | [diff] [blame] | 106 | * @param childrenOnly Whether to only prepare child windows for replacement |
| 107 | * (for example when main windows are being reused via preservation). |
Robert Carr | 23fa16b | 2016-01-13 13:19:58 -0800 | [diff] [blame] | 108 | */ |
Robert Carr | 77bdfb5 | 2016-05-02 18:18:31 -0700 | [diff] [blame] | 109 | void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly); |
Robert Carr | 23fa16b | 2016-01-13 13:19:58 -0800 | [diff] [blame] | 110 | |
Rob Carr | 64e516f | 2015-10-29 00:20:45 +0000 | [diff] [blame] | 111 | /** |
Dianne Hackborn | 6482517 | 2011-03-02 21:32:58 -0800 | [diff] [blame] | 112 | * Called by a client to report that it ran out of graphics memory. |
| 113 | */ |
| 114 | boolean outOfMemory(IWindow window); |
| 115 | |
| 116 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | */ |
| 121 | void setTransparentRegion(IWindow window, in Region region); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 122 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | */ |
| 133 | void setInsets(IWindow window, int touchableInsets, in Rect contentInsets, |
Jeff Brown | fbf0977 | 2011-01-16 14:06:57 -0800 | [diff] [blame] | 134 | in Rect visibleInsets, in Region touchableRegion); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 135 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 136 | /** |
| 137 | * Return the current display size in which the window is being laid out, |
| 138 | * accounting for screen decorations around it. |
| 139 | */ |
| 140 | void getDisplayFrame(IWindow window, out Rect outDisplayFrame); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 141 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 142 | void finishDrawing(IWindow window); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 143 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 144 | void setInTouchMode(boolean showFocus); |
| 145 | boolean getInTouchMode(); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 146 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 147 | boolean performHapticFeedback(IWindow window, int effectId, boolean always); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 148 | |
Dianne Hackborn | c8a0a75 | 2009-08-10 23:05:49 -0700 | [diff] [blame] | 149 | /** |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 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 | */ |
Christopher Tate | 02d2b3b | 2011-01-10 20:43:53 -0800 | [diff] [blame] | 154 | IBinder prepareDrag(IWindow window, int flags, |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 155 | int thumbnailWidth, int thumbnailHeight, out Surface outSurface); |
| 156 | |
| 157 | /** |
| 158 | * Initiate the drag operation itself |
| 159 | */ |
Vladislav Kaznacheev | ba76112 | 2016-01-22 12:09:45 -0800 | [diff] [blame] | 160 | boolean performDrag(IWindow window, IBinder dragToken, int touchSource, |
| 161 | float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data); |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 162 | |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 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 | */ |
Chris Tate | d4533f1 | 2010-10-19 15:15:08 -0700 | [diff] [blame] | 168 | void reportDropResult(IWindow window, boolean consumed); |
| 169 | |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 170 | /** |
Vladislav Kaznacheev | 8206391 | 2015-11-20 14:20:13 -0800 | [diff] [blame] | 171 | * Cancel the current drag operation. |
| 172 | */ |
| 173 | void cancelDragAndDrop(IBinder dragToken); |
| 174 | |
| 175 | /** |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 176 | * Tell the OS that we've just dragged into a View that is willing to accept the drop |
| 177 | */ |
| 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 | */ |
| 183 | void dragRecipientExited(IWindow window); |
| 184 | |
| 185 | /** |
Dianne Hackborn | c8a0a75 | 2009-08-10 23:05:49 -0700 | [diff] [blame] | 186 | * For windows with the wallpaper behind them, and the wallpaper is |
| 187 | * larger than the screen, set the offset within the screen. |
Marco Nelissen | bf6956b | 2009-11-09 15:21:13 -0800 | [diff] [blame] | 188 | * For multi screen launcher type applications, xstep and ystep indicate |
| 189 | * how big the increment is from one screen to another. |
Dianne Hackborn | c8a0a75 | 2009-08-10 23:05:49 -0700 | [diff] [blame] | 190 | */ |
Marco Nelissen | bf6956b | 2009-11-09 15:21:13 -0800 | [diff] [blame] | 191 | void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 192 | |
Dianne Hackborn | 19382ac | 2009-09-11 21:13:37 -0700 | [diff] [blame] | 193 | void wallpaperOffsetsComplete(IBinder window); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 194 | |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 195 | /** |
| 196 | * Apply a raw offset to the wallpaper service when shown behind this window. |
| 197 | */ |
| 198 | void setWallpaperDisplayOffset(IBinder windowToken, int x, int y); |
| 199 | |
Dianne Hackborn | 7580493 | 2009-10-20 20:15:20 -0700 | [diff] [blame] | 200 | Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, |
| 201 | int z, in Bundle extras, boolean sync); |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 202 | |
Dianne Hackborn | 7580493 | 2009-10-20 20:15:20 -0700 | [diff] [blame] | 203 | void wallpaperCommandComplete(IBinder window, in Bundle result); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 204 | |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 205 | /** |
| 206 | * Notifies that a rectangle on the screen has been requested. |
| 207 | */ |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 208 | void onRectangleOnScreenRequested(IBinder token, in Rect rectangle); |
Dianne Hackborn | e3f23a3 | 2013-03-01 13:25:35 -0800 | [diff] [blame] | 209 | |
| 210 | IWindowId getWindowId(IBinder window); |
Jeff Brown | c2932a1 | 2014-11-20 18:04:05 -0800 | [diff] [blame] | 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 | */ |
| 225 | void pokeDrawLock(IBinder window); |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 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 | */ |
| 233 | boolean startMovingTask(IWindow window, float startX, float startY); |
Vladislav Kaznacheev | 989b58a | 2016-02-10 12:19:33 -0800 | [diff] [blame] | 234 | |
| 235 | void updatePointerIcon(IWindow window); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 236 | } |