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 18package android.view; 19 20import android.content.ClipData; 21import android.content.res.Configuration; 22import android.graphics.Rect; 23import android.graphics.Region; 24import android.os.Bundle; 25import android.view.InputChannel; 26import android.view.IWindow; 27import android.view.MotionEvent; 28import android.view.WindowManager; 29import android.view.Surface; 30 31/** 32 * System private per-application interface to the window manager. 33 * 34 * {@hide} 35 */ 36interface IWindowSession { 37 int add(IWindow window, int seq, in WindowManager.LayoutParams attrs, 38 in int viewVisibility, out Rect outContentInsets, 39 out InputChannel outInputChannel); 40 int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, 41 in int viewVisibility, in int layerStackId, out Rect outContentInsets, 42 out InputChannel outInputChannel); 43 int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, 44 in int viewVisibility, out Rect outContentInsets); 45 int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, 46 in int viewVisibility, in int layerStackId, out Rect outContentInsets); 47 void remove(IWindow window); 48 49 /** 50 * Change the parameters of a window. You supply the 51 * new parameters, it returns the new frame of the window on screen (the 52 * position should be ignored) and surface of the window. The surface 53 * will be invalid if the window is currently hidden, else you can use it 54 * to draw the window's contents. 55 * 56 * @param window The window being modified. 57 * @param seq Ordering sequence number. 58 * @param attrs If non-null, new attributes to apply to the window. 59 * @param requestedWidth The width the window wants to be. 60 * @param requestedHeight The height the window wants to be. 61 * @param viewVisibility Window root view's visibility. 62 * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING}, 63 * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}. 64 * @param outFrame Rect in which is placed the new position/size on 65 * screen. 66 * @param outContentInsets Rect in which is placed the offsets from 67 * <var>outFrame</var> in which the content of the window should be 68 * placed. This can be used to modify the window layout to ensure its 69 * contents are visible to the user, taking into account system windows 70 * like the status bar or a soft keyboard. 71 * @param outVisibleInsets Rect in which is placed the offsets from 72 * <var>outFrame</var> in which the window is actually completely visible 73 * to the user. This can be used to temporarily scroll the window's 74 * contents to make sure the user can see it. This is different than 75 * <var>outContentInsets</var> in that these insets change transiently, 76 * so complex relayout of the window should not happen based on them. 77 * @param outConfiguration New configuration of window, if it is now 78 * becoming visible and the global configuration has changed since it 79 * was last displayed. 80 * @param outSurface Object in which is placed the new display surface. 81 * 82 * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS}, 83 * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}. 84 */ 85 int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs, 86 int requestedWidth, int requestedHeight, int viewVisibility, 87 int flags, out Rect outFrame, 88 out Rect outContentInsets, out Rect outVisibleInsets, 89 out Configuration outConfig, out Surface outSurface); 90 91 /** 92 * If a call to relayout() asked to have the surface destroy deferred, 93 * it must call this once it is okay to destroy that surface. 94 */ 95 void performDeferredDestroy(IWindow window); 96 97 /** 98 * Called by a client to report that it ran out of graphics memory. 99 */ 100 boolean outOfMemory(IWindow window); 101 102 /** 103 * Give the window manager a hint of the part of the window that is 104 * completely transparent, allowing it to work with the surface flinger 105 * to optimize compositing of this part of the window. 106 */ 107 void setTransparentRegion(IWindow window, in Region region); 108 109 /** 110 * Tell the window manager about the content and visible insets of the 111 * given window, which can be used to adjust the <var>outContentInsets</var> 112 * and <var>outVisibleInsets</var> values returned by 113 * {@link #relayout relayout()} for windows behind this one. 114 * 115 * @param touchableInsets Controls which part of the window inside of its 116 * frame can receive pointer events, as defined by 117 * {@link android.view.ViewTreeObserver.InternalInsetsInfo}. 118 */ 119 void setInsets(IWindow window, int touchableInsets, in Rect contentInsets, 120 in Rect visibleInsets, in Region touchableRegion); 121 122 /** 123 * Return the current display size in which the window is being laid out, 124 * accounting for screen decorations around it. 125 */ 126 void getDisplayFrame(IWindow window, out Rect outDisplayFrame); 127 128 void finishDrawing(IWindow window); 129 130 void setInTouchMode(boolean showFocus); 131 boolean getInTouchMode(); 132 133 boolean performHapticFeedback(IWindow window, int effectId, boolean always); 134 135 /** 136 * Allocate the drag's thumbnail surface. Also assigns a token that identifies 137 * the drag to the OS and passes that as the return value. A return value of 138 * null indicates failure. 139 */ 140 IBinder prepareDrag(IWindow window, int flags, 141 int thumbnailWidth, int thumbnailHeight, out Surface outSurface); 142 143 /** 144 * Initiate the drag operation itself 145 */ 146 boolean performDrag(IWindow window, IBinder dragToken, float touchX, float touchY, 147 float thumbCenterX, float thumbCenterY, in ClipData data); 148 149 /** 150 * Report the result of a drop action targeted to the given window. 151 * consumed is 'true' when the drop was accepted by a valid recipient, 152 * 'false' otherwise. 153 */ 154 void reportDropResult(IWindow window, boolean consumed); 155 156 /** 157 * Tell the OS that we've just dragged into a View that is willing to accept the drop 158 */ 159 void dragRecipientEntered(IWindow window); 160 161 /** 162 * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop 163 */ 164 void dragRecipientExited(IWindow window); 165 166 /** 167 * For windows with the wallpaper behind them, and the wallpaper is 168 * larger than the screen, set the offset within the screen. 169 * For multi screen launcher type applications, xstep and ystep indicate 170 * how big the increment is from one screen to another. 171 */ 172 void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); 173 174 void wallpaperOffsetsComplete(IBinder window); 175 176 Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, 177 int z, in Bundle extras, boolean sync); 178 179 void wallpaperCommandComplete(IBinder window, in Bundle result); 180 181 void setUniverseTransform(IBinder window, float alpha, float offx, float offy, 182 float dsdx, float dtdx, float dsdy, float dtdy); 183 184 /** 185 * Notifies that a rectangle on the screen has been requested. 186 */ 187 void onRectangleOnScreenRequested(IBinder token, in Rect rectangle, boolean immediate); 188} 189