IWindowManager.aidl revision 044d52934e57a337665f707aa4be1d423ee3fb29
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.IOnKeyguardExitResult;
31import android.view.IRotationWatcher;
32import android.view.IWindowSession;
33import android.view.IWindowSessionCallback;
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;
41import android.view.WindowContentFrameStats;
42
43/**
44 * System private interface to the window manager.
45 *
46 * {@hide}
47 */
48interface IWindowManager
49{
50    /**
51     * ===== NOTICE =====
52     * The first three methods must remain the first three methods. Scripts
53     * and tools rely on their transaction number to work properly.
54     */
55    // This is used for debugging
56    boolean startViewServer(int port);   // Transaction #1
57    boolean stopViewServer();            // Transaction #2
58    boolean isViewServerRunning();       // Transaction #3
59
60    IWindowSession openSession(in IWindowSessionCallback callback, in IInputMethodClient client,
61            in IInputContext inputContext);
62    boolean inputMethodClientHasFocus(IInputMethodClient client);
63
64    void getInitialDisplaySize(int displayId, out Point size);
65    void getBaseDisplaySize(int displayId, out Point size);
66    void setForcedDisplaySize(int displayId, int width, int height);
67    void clearForcedDisplaySize(int displayId);
68    int getInitialDisplayDensity(int displayId);
69    int getBaseDisplayDensity(int displayId);
70    void setForcedDisplayDensity(int displayId, int density);
71    void clearForcedDisplayDensity(int displayId);
72
73    void setOverscan(int displayId, int left, int top, int right, int bottom);
74
75    // These can only be called when holding the MANAGE_APP_TOKENS permission.
76    void pauseKeyDispatching(IBinder token);
77    void resumeKeyDispatching(IBinder token);
78    void setEventDispatching(boolean enabled);
79    void addWindowToken(IBinder token, int type);
80    void removeWindowToken(IBinder token);
81    void addAppToken(int addPos, IApplicationToken token, int groupId, int stackId,
82            int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
83            int configChanges, boolean voiceInteraction, boolean launchTaskBehind);
84    void setAppGroupId(IBinder token, int groupId);
85    void setAppOrientation(IApplicationToken token, int requestedOrientation);
86    int getAppOrientation(IApplicationToken token);
87    void setFocusedApp(IBinder token, boolean moveFocusNow);
88    void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
89    int getPendingAppTransition();
90    void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
91            IRemoteCallback startedCallback);
92    void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
93            int startHeight);
94    void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
95            IRemoteCallback startedCallback, boolean scaleUp);
96    void overridePendingAppTransitionAspectScaledThumb(in Bitmap srcThumb, int startX,
97            int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
98            boolean scaleUp);
99    void overridePendingAppTransitionInPlace(String packageName, int anim);
100    void executeAppTransition();
101    void setAppStartingWindow(IBinder token, String pkg, int theme,
102            in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
103            int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
104    void setAppWillBeHidden(IBinder token);
105    void setAppVisibility(IBinder token, boolean visible);
106    void startAppFreezingScreen(IBinder token, int configChanges);
107    void stopAppFreezingScreen(IBinder token, boolean force);
108    void removeAppToken(IBinder token);
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    void keyguardGoingAway(boolean disableWindowAnimations,
129            boolean keyguardGoingToNotificationShade);
130
131    void closeSystemDialogs(String reason);
132
133    // These can only be called with the SET_ANIMATON_SCALE permission.
134    float getAnimationScale(int which);
135    float[] getAnimationScales();
136    void setAnimationScale(int which, float scale);
137    void setAnimationScales(in float[] scales);
138
139    float getCurrentAnimatorScale();
140
141    // For testing
142    void setInTouchMode(boolean showFocus);
143
144    // For StrictMode flashing a red border on violations from the UI
145    // thread.  The uid/pid is implicit from the Binder call, and the Window
146    // Manager uses that to determine whether or not the red border should
147    // actually be shown.  (it will be ignored that pid doesn't have windows
148    // on screen)
149    void showStrictModeViolation(boolean on);
150
151    // Proxy to set the system property for whether the flashing
152    // should be enabled.  The 'enabled' value is null or blank for
153    // the system default (differs per build variant) or any valid
154    // boolean string as parsed by SystemProperties.getBoolean().
155    void setStrictModeVisualIndicatorPreference(String enabled);
156
157    /**
158     * Set whether screen capture is disabled for all windows of a specific user
159     */
160    void setScreenCaptureDisabled(int userId, boolean disabled);
161
162    // These can only be called with the SET_ORIENTATION permission.
163    /**
164     * Update the current screen rotation based on the current state of
165     * the world.
166     * @param alwaysSendConfiguration Flag to force a new configuration to
167     * be evaluated.  This can be used when there are other parameters in
168     * configuration that are changing.
169     * @param forceRelayout If true, the window manager will always do a relayout
170     * of its windows even if the rotation hasn't changed.
171     */
172    void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
173
174    /**
175     * Retrieve the current screen orientation, constants as per
176     * {@link android.view.Surface}.
177     */
178    int getRotation();
179
180    /**
181     * Watch the rotation of the screen.  Returns the current rotation,
182     * calls back when it changes.
183     */
184    int watchRotation(IRotationWatcher watcher);
185
186    /**
187     * Remove a rotation watcher set using watchRotation.
188     * @hide
189     */
190    void removeRotationWatcher(IRotationWatcher watcher);
191
192    /**
193     * Determine the preferred edge of the screen to pin the compact options menu against.
194     * @return a Gravity value for the options menu panel
195     * @hide
196     */
197    int getPreferredOptionsPanelGravity();
198
199    /**
200     * Lock the device orientation to the specified rotation, or to the
201     * current rotation if -1.  Sensor input will be ignored until
202     * thawRotation() is called.
203     * @hide
204     */
205    void freezeRotation(int rotation);
206
207    /**
208     * Release the orientation lock imposed by freezeRotation().
209     * @hide
210     */
211    void thawRotation();
212
213    /**
214     * Gets whether the rotation is frozen.
215     *
216     * @return Whether the rotation is frozen.
217     */
218    boolean isRotationFrozen();
219
220    /**
221     * Create a screenshot of the applications currently displayed.
222     */
223    Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth,
224            int maxHeight, boolean force565);
225
226    /**
227     * Called by the status bar to notify Views of changes to System UI visiblity.
228     */
229    oneway void statusBarVisibilityChanged(int visibility);
230
231    /**
232     * Device has a software navigation bar (separate from the status bar).
233     */
234    boolean hasNavigationBar();
235
236    /**
237     * Lock the device immediately with the specified options (can be null).
238     */
239    void lockNow(in Bundle options);
240
241    /**
242     * Device is in safe mode.
243     */
244    boolean isSafeModeEnabled();
245
246    /**
247     * Enables the screen if all conditions are met.
248     */
249    void enableScreenIfNeeded();
250
251    /**
252     * Clears the frame statistics for a given window.
253     *
254     * @param token The window token.
255     * @return Whether the frame statistics were cleared.
256     */
257    boolean clearWindowContentFrameStats(IBinder token);
258
259    /**
260     * Gets the content frame statistics for a given window.
261     *
262     * @param token The window token.
263     * @return The frame statistics or null if the window does not exist.
264     */
265    WindowContentFrameStats getWindowContentFrameStats(IBinder token);
266}
267