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