IWindowManager.aidl revision 672cf45de7aa5ad6fd1f75512ee5a451a16c0b39
1/*
2** Copyright 2006, The Android Open Source Project
3**
4** Licensed under the Apache License, Version 2.0 (the "License");
5** you may not use this file except in compliance with the License.
6** You may obtain a copy of the License at
7**
8**     http://www.apache.org/licenses/LICENSE-2.0
9**
10** Unless required by applicable law or agreed to in writing, software
11** distributed under the License is distributed on an "AS IS" BASIS,
12** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13** See the License for the specific language governing permissions and
14** limitations under the License.
15*/
16
17package android.view;
18
19import com.android.internal.view.IInputContext;
20import com.android.internal.view.IInputMethodClient;
21
22import android.content.res.CompatibilityInfo;
23import android.content.res.Configuration;
24import android.graphics.Bitmap;
25import android.graphics.Point;
26import android.graphics.Rect;
27import android.os.Bundle;
28import android.os.IRemoteCallback;
29import android.view.IApplicationToken;
30import android.view.IMagnificationCallbacks;
31import android.view.IOnKeyguardExitResult;
32import android.view.IRotationWatcher;
33import android.view.IWindowSession;
34import android.view.KeyEvent;
35import android.view.InputEvent;
36import android.view.MagnificationSpec;
37import android.view.MotionEvent;
38import android.view.InputChannel;
39import android.view.InputDevice;
40import android.view.IInputFilter;
41
42/**
43 * System private interface to the window manager.
44 *
45 * {@hide}
46 */
47interface IWindowManager
48{
49    /**
50     * ===== NOTICE =====
51     * The first three methods must remain the first three methods. Scripts
52     * and tools rely on their transaction number to work properly.
53     */
54    // This is used for debugging
55    boolean startViewServer(int port);   // Transaction #1
56    boolean stopViewServer();            // Transaction #2
57    boolean isViewServerRunning();       // Transaction #3
58
59    IWindowSession openSession(in IInputMethodClient client,
60            in IInputContext inputContext);
61    boolean inputMethodClientHasFocus(IInputMethodClient client);
62
63    void getInitialDisplaySize(int displayId, out Point size);
64    void getBaseDisplaySize(int displayId, out Point size);
65    void setForcedDisplaySize(int displayId, int width, int height);
66    void clearForcedDisplaySize(int displayId);
67    int getInitialDisplayDensity(int displayId);
68    int getBaseDisplayDensity(int displayId);
69    void setForcedDisplayDensity(int displayId, int density);
70    void clearForcedDisplayDensity(int displayId);
71
72    void setOverscan(int displayId, int left, int top, int right, int bottom);
73
74    // Is the device configured to have a full system bar for larger screens?
75    boolean hasSystemNavBar();
76
77    // These can only be called when holding the MANAGE_APP_TOKENS permission.
78    void pauseKeyDispatching(IBinder token);
79    void resumeKeyDispatching(IBinder token);
80    void setEventDispatching(boolean enabled);
81    void addWindowToken(IBinder token, int type);
82    void removeWindowToken(IBinder token);
83    void addAppToken(int addPos, IApplicationToken token,
84            int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
85    void setAppGroupId(IBinder token, int groupId);
86    void setAppOrientation(IApplicationToken token, int requestedOrientation);
87    int getAppOrientation(IApplicationToken token);
88    void setFocusedApp(IBinder token, boolean moveFocusNow);
89    void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
90    int getPendingAppTransition();
91    void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
92            IRemoteCallback startedCallback);
93    void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
94            int startHeight);
95    void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
96            IRemoteCallback startedCallback, boolean scaleUp);
97    void executeAppTransition();
98    void setAppStartingWindow(IBinder token, String pkg, int theme,
99            in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
100            int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
101    void setAppWillBeHidden(IBinder token);
102    void setAppVisibility(IBinder token, boolean visible);
103    void startAppFreezingScreen(IBinder token, int configChanges);
104    void stopAppFreezingScreen(IBinder token, boolean force);
105    void removeAppToken(IBinder token);
106    void moveAppToken(int index, IBinder token);
107    void moveAppTokensToTop(in List<IBinder> tokens);
108    void moveAppTokensToBottom(in List<IBinder> tokens);
109
110    // Re-evaluate the current orientation from the caller's state.
111    // If there is a change, the new Configuration is returned and the
112    // caller must call setNewConfiguration() sometime later.
113    Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
114            IBinder freezeThisOneIfNeeded);
115    void setNewConfiguration(in Configuration config);
116
117    void startFreezingScreen(int exitAnim, int enterAnim);
118    void stopFreezingScreen();
119
120    // these require DISABLE_KEYGUARD permission
121    void disableKeyguard(IBinder token, String tag);
122    void reenableKeyguard(IBinder token);
123    void exitKeyguardSecurely(IOnKeyguardExitResult callback);
124    boolean isKeyguardLocked();
125    boolean isKeyguardSecure();
126    boolean inKeyguardRestrictedInputMode();
127    void dismissKeyguard();
128
129    void closeSystemDialogs(String reason);
130
131    // These can only be called with the SET_ANIMATON_SCALE permission.
132    float getAnimationScale(int which);
133    float[] getAnimationScales();
134    void setAnimationScale(int which, float scale);
135    void setAnimationScales(in float[] scales);
136
137    // For testing
138    void setInTouchMode(boolean showFocus);
139
140    // For StrictMode flashing a red border on violations from the UI
141    // thread.  The uid/pid is implicit from the Binder call, and the Window
142    // Manager uses that to determine whether or not the red border should
143    // actually be shown.  (it will be ignored that pid doesn't have windows
144    // on screen)
145    void showStrictModeViolation(boolean on);
146
147    // Proxy to set the system property for whether the flashing
148    // should be enabled.  The 'enabled' value is null or blank for
149    // the system default (differs per build variant) or any valid
150    // boolean string as parsed by SystemProperties.getBoolean().
151    void setStrictModeVisualIndicatorPreference(String enabled);
152
153    // These can only be called with the SET_ORIENTATION permission.
154    /**
155     * Update the current screen rotation based on the current state of
156     * the world.
157     * @param alwaysSendConfiguration Flag to force a new configuration to
158     * be evaluated.  This can be used when there are other parameters in
159     * configuration that are changing.
160     * @param forceRelayout If true, the window manager will always do a relayout
161     * of its windows even if the rotation hasn't changed.
162     */
163    void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
164
165    /**
166     * Retrieve the current screen orientation, constants as per
167     * {@link android.view.Surface}.
168     */
169    int getRotation();
170
171    /**
172     * Watch the rotation of the screen.  Returns the current rotation,
173     * calls back when it changes.
174     */
175    int watchRotation(IRotationWatcher watcher);
176
177    /**
178     * Determine the preferred edge of the screen to pin the compact options menu against.
179     * @return a Gravity value for the options menu panel
180     * @hide
181     */
182    int getPreferredOptionsPanelGravity();
183
184    /**
185     * Lock the device orientation to the specified rotation, or to the
186     * current rotation if -1.  Sensor input will be ignored until
187     * thawRotation() is called.
188     * @hide
189     */
190    void freezeRotation(int rotation);
191
192    /**
193     * Release the orientation lock imposed by freezeRotation().
194     * @hide
195     */
196    void thawRotation();
197
198    /**
199     * Gets whether the rotation is frozen.
200     *
201     * @return Whether the rotation is frozen.
202     */
203    boolean isRotationFrozen();
204
205    /**
206     * Create a screenshot of the applications currently displayed.
207     */
208    Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
209
210    /**
211     * Called by the status bar to notify Views of changes to System UI visiblity.
212     */
213    void statusBarVisibilityChanged(int visibility);
214
215    /**
216     * Block until the given window has been drawn to the screen.
217     * Returns true if really waiting, false if the window does not exist.
218     */
219    boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
220
221    /**
222     * Device has a software navigation bar (separate from the status bar).
223     */
224    boolean hasNavigationBar();
225
226    /**
227     * Lock the device immediately with the specified options (can be null).
228     */
229    void lockNow(in Bundle options);
230
231    /**
232     * Gets the token for the focused window.
233     */
234    IBinder getFocusedWindowToken();
235
236    /**
237     * Sets an input filter for manipulating the input event stream.
238     */
239    void setInputFilter(in IInputFilter filter);
240
241    /**
242     * Gets the frame of a window given its token.
243     */
244    void getWindowFrame(IBinder token, out Rect outFrame);
245
246    /**
247     * Device is in safe mode.
248     */
249    boolean isSafeModeEnabled();
250
251    /**
252     * Tell keyguard to show the assistant (Intent.ACTION_ASSIST) after asking for the user's
253     * credentials.
254     */
255    void showAssistant();
256
257    /**
258     * Sets the display magnification callbacks. These callbacks notify
259     * the client for contextual changes related to display magnification.
260     *
261     * @param callbacks The magnification callbacks.
262     */
263    void setMagnificationCallbacks(IMagnificationCallbacks callbacks);
264
265    /**
266     * Sets the magnification spec to be applied to all windows that can be
267     * magnified.
268     *
269     * @param spec The current magnification spec.
270     */
271    void setMagnificationSpec(in MagnificationSpec spec);
272
273    /**
274     * Gets the magnification spec for a window given its token. If the
275     * window has a compatibility scale it is also folded in the returned
276     * magnification spec.
277     *
278     * @param windowToken The unique window token.
279     * @return The magnification spec if such or null.
280     */
281    MagnificationSpec getCompatibleMagnificationSpecForWindow(in IBinder windowToken);
282}
283