Home | History | Annotate | Download | only in view
      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.content.res.Configuration;
     22 import android.graphics.Rect;
     23 import android.graphics.Region;
     24 import android.os.Bundle;
     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 {
     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);
     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);
     44     int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
     45             in int viewVisibility, 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);
     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 outConfiguration New configuration of window, if it is now
     87      * becoming visible and the global configuration has changed since it
     88      * 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      */
     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, out Configuration outConfig,
     99             out Surface outSurface);
    100 
    101     /**
    102      *  Position a window relative to it's parent (attached) window without triggering
    103      *  a full relayout. This action may be deferred until a given frame number
    104      *  for the parent window appears. This allows for synchronizing movement of a child
    105      *  to repainting the contents of the parent.
    106      *
    107      *  "width" and "height" correspond to the width and height members of
    108      *  WindowManager.LayoutParams in the {@link #relayout relayout()} case.
    109      *  This may differ from the surface buffer size in the
    110      *  case of {@link LayoutParams#FLAG_SCALED} and {@link #relayout relayout()}
    111      *  must be used with requestedWidth/height if this must be changed.
    112      *
    113      *  @param window The window being modified. Must be attached to a parent window
    114      *  or this call will fail.
    115      *  @param left The new left position
    116      *  @param top The new top position
    117      *  @param right The new right position
    118      *  @param bottom The new bottom position
    119      *  @param deferTransactionUntilFrame Frame number from our parent (attached) to
    120      *  defer this action until.
    121      *  @param outFrame Rect in which is placed the new position/size on screen.
    122      */
    123     void repositionChild(IWindow childWindow, int left, int top, int right, int bottom,
    124             long deferTransactionUntilFrame, out Rect outFrame);
    125 
    126     /*
    127      * Notify the window manager that an application is relaunching and
    128      * windows should be prepared for replacement.
    129      *
    130      * @param appToken The application
    131      * @param childrenOnly Whether to only prepare child windows for replacement
    132      * (for example when main windows are being reused via preservation).
    133      */
    134     void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly);
    135 
    136     /**
    137      * If a call to relayout() asked to have the surface destroy deferred,
    138      * it must call this once it is okay to destroy that surface.
    139      */
    140     void performDeferredDestroy(IWindow window);
    141 
    142     /**
    143      * Called by a client to report that it ran out of graphics memory.
    144      */
    145     boolean outOfMemory(IWindow window);
    146 
    147     /**
    148      * Give the window manager a hint of the part of the window that is
    149      * completely transparent, allowing it to work with the surface flinger
    150      * to optimize compositing of this part of the window.
    151      */
    152     void setTransparentRegion(IWindow window, in Region region);
    153 
    154     /**
    155      * Tell the window manager about the content and visible insets of the
    156      * given window, which can be used to adjust the <var>outContentInsets</var>
    157      * and <var>outVisibleInsets</var> values returned by
    158      * {@link #relayout relayout()} for windows behind this one.
    159      *
    160      * @param touchableInsets Controls which part of the window inside of its
    161      * frame can receive pointer events, as defined by
    162      * {@link android.view.ViewTreeObserver.InternalInsetsInfo}.
    163      */
    164     void setInsets(IWindow window, int touchableInsets, in Rect contentInsets,
    165             in Rect visibleInsets, in Region touchableRegion);
    166 
    167     /**
    168      * Return the current display size in which the window is being laid out,
    169      * accounting for screen decorations around it.
    170      */
    171     void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
    172 
    173     void finishDrawing(IWindow window);
    174 
    175     void setInTouchMode(boolean showFocus);
    176     boolean getInTouchMode();
    177 
    178     boolean performHapticFeedback(IWindow window, int effectId, boolean always);
    179 
    180     /**
    181      * Allocate the drag's thumbnail surface.  Also assigns a token that identifies
    182      * the drag to the OS and passes that as the return value.  A return value of
    183      * null indicates failure.
    184      */
    185     IBinder prepareDrag(IWindow window, int flags,
    186             int thumbnailWidth, int thumbnailHeight, out Surface outSurface);
    187 
    188     /**
    189      * Initiate the drag operation itself
    190      */
    191     boolean performDrag(IWindow window, IBinder dragToken, int touchSource,
    192             float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
    193 
    194    /**
    195      * Report the result of a drop action targeted to the given window.
    196      * consumed is 'true' when the drop was accepted by a valid recipient,
    197      * 'false' otherwise.
    198      */
    199 	void reportDropResult(IWindow window, boolean consumed);
    200 
    201     /**
    202      * Cancel the current drag operation.
    203      */
    204     void cancelDragAndDrop(IBinder dragToken);
    205 
    206     /**
    207      * Tell the OS that we've just dragged into a View that is willing to accept the drop
    208      */
    209     void dragRecipientEntered(IWindow window);
    210 
    211     /**
    212      * Tell the OS that we've just dragged *off* of a View that was willing to accept the drop
    213      */
    214     void dragRecipientExited(IWindow window);
    215 
    216     /**
    217      * For windows with the wallpaper behind them, and the wallpaper is
    218      * larger than the screen, set the offset within the screen.
    219      * For multi screen launcher type applications, xstep and ystep indicate
    220      * how big the increment is from one screen to another.
    221      */
    222     void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
    223 
    224     void wallpaperOffsetsComplete(IBinder window);
    225 
    226     /**
    227      * Apply a raw offset to the wallpaper service when shown behind this window.
    228      */
    229     void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);
    230 
    231     Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
    232             int z, in Bundle extras, boolean sync);
    233 
    234     void wallpaperCommandComplete(IBinder window, in Bundle result);
    235 
    236     /**
    237      * Notifies that a rectangle on the screen has been requested.
    238      */
    239     void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);
    240 
    241     IWindowId getWindowId(IBinder window);
    242 
    243     /**
    244      * When the system is dozing in a low-power partially suspended state, pokes a short
    245      * lived wake lock and ensures that the display is ready to accept the next frame
    246      * of content drawn in the window.
    247      *
    248      * This mechanism is bound to the window rather than to the display manager or the
    249      * power manager so that the system can ensure that the window is actually visible
    250      * and prevent runaway applications from draining the battery.  This is similar to how
    251      * FLAG_KEEP_SCREEN_ON works.
    252      *
    253      * This method is synchronous because it may need to acquire a wake lock before returning.
    254      * The assumption is that this method will be called rather infrequently.
    255      */
    256     void pokeDrawLock(IBinder window);
    257 
    258     /**
    259      * Starts a task window move with {startX, startY} as starting point. The amount of move
    260      * will be the offset between {startX, startY} and the new cursor position.
    261      *
    262      * Returns true if the move started successfully; false otherwise.
    263      */
    264     boolean startMovingTask(IWindow window, float startX, float startY);
    265 
    266     void updatePointerIcon(IWindow window);
    267 }
    268