IWindowManager.aidl revision a6d6aab0e0c2cb297cda9ad6a94bbe934ba515f6
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.os.IResultReceiver;
20import com.android.internal.view.IInputContext;
21import com.android.internal.view.IInputMethodClient;
22import com.android.internal.policy.IKeyguardDismissCallback;
23import com.android.internal.policy.IShortcutService;
24
25import android.app.IAssistDataReceiver;
26import android.content.res.CompatibilityInfo;
27import android.content.res.Configuration;
28import android.graphics.Bitmap;
29import android.graphics.GraphicBuffer;
30import android.graphics.Point;
31import android.graphics.Rect;
32import android.graphics.Region;
33import android.os.Bundle;
34import android.os.IRemoteCallback;
35import android.os.ParcelFileDescriptor;
36import android.view.IApplicationToken;
37import android.view.IAppTransitionAnimationSpecsFuture;
38import android.view.IDockedStackListener;
39import android.view.IOnKeyguardExitResult;
40import android.view.IPinnedStackListener;
41import android.view.RemoteAnimationAdapter;
42import android.view.IRotationWatcher;
43import android.view.IWallpaperVisibilityListener;
44import android.view.IWindowSession;
45import android.view.IWindowSessionCallback;
46import android.view.KeyEvent;
47import android.view.InputEvent;
48import android.view.MagnificationSpec;
49import android.view.MotionEvent;
50import android.view.InputChannel;
51import android.view.InputDevice;
52import android.view.IInputFilter;
53import android.view.AppTransitionAnimationSpec;
54import android.view.WindowContentFrameStats;
55import android.view.WindowManager;
56
57/**
58 * System private interface to the window manager.
59 *
60 * {@hide}
61 */
62interface IWindowManager
63{
64    /**
65     * ===== NOTICE =====
66     * The first three methods must remain the first three methods. Scripts
67     * and tools rely on their transaction number to work properly.
68     */
69    // This is used for debugging
70    boolean startViewServer(int port);   // Transaction #1
71    boolean stopViewServer();            // Transaction #2
72    boolean isViewServerRunning();       // Transaction #3
73
74    IWindowSession openSession(in IWindowSessionCallback callback, in IInputMethodClient client,
75            in IInputContext inputContext);
76    boolean inputMethodClientHasFocus(IInputMethodClient client);
77
78    void getInitialDisplaySize(int displayId, out Point size);
79    void getBaseDisplaySize(int displayId, out Point size);
80    void setForcedDisplaySize(int displayId, int width, int height);
81    void clearForcedDisplaySize(int displayId);
82    int getInitialDisplayDensity(int displayId);
83    int getBaseDisplayDensity(int displayId);
84    void setForcedDisplayDensityForUser(int displayId, int density, int userId);
85    void clearForcedDisplayDensityForUser(int displayId, int userId);
86    void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable
87
88    void setOverscan(int displayId, int left, int top, int right, int bottom);
89
90    // These can only be called when holding the MANAGE_APP_TOKENS permission.
91    void setEventDispatching(boolean enabled);
92    void addWindowToken(IBinder token, int type, int displayId);
93    void removeWindowToken(IBinder token, int displayId);
94    void setFocusedApp(IBinder token, boolean moveFocusNow);
95    void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
96    int getPendingAppTransition();
97    void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
98            IRemoteCallback startedCallback);
99    void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
100            int startHeight);
101    void overridePendingAppTransitionClipReveal(int startX, int startY,
102            int startWidth, int startHeight);
103    void overridePendingAppTransitionThumb(in GraphicBuffer srcThumb, int startX, int startY,
104            IRemoteCallback startedCallback, boolean scaleUp);
105    void overridePendingAppTransitionAspectScaledThumb(in GraphicBuffer srcThumb, int startX,
106            int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
107            boolean scaleUp);
108    /**
109     * Overrides animation for app transition that exits from an application to a multi-window
110     * environment and allows specifying transition animation parameters for each window.
111     *
112     * @param specs Array of transition animation descriptions for entering windows.
113     *
114     * @hide
115     */
116    void overridePendingAppTransitionMultiThumb(in AppTransitionAnimationSpec[] specs,
117            IRemoteCallback startedCallback, IRemoteCallback finishedCallback, boolean scaleUp);
118    void overridePendingAppTransitionInPlace(String packageName, int anim);
119
120    /**
121     * Like overridePendingAppTransitionMultiThumb, but uses a future to supply the specs. This is
122     * used for recents, where generating the thumbnails of the specs takes a non-trivial amount of
123     * time, so we want to move that off the critical path for starting the new activity.
124     */
125    void overridePendingAppTransitionMultiThumbFuture(
126            IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
127            boolean scaleUp);
128    void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter);
129    void executeAppTransition();
130
131    /** Used by system ui to report that recents has shown itself. */
132    void endProlongedAnimations();
133
134    // Re-evaluate the current orientation from the caller's state.
135    // If there is a change, the new Configuration is returned and the
136    // caller must call setNewConfiguration() sometime later.
137    Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
138            IBinder freezeThisOneIfNeeded, int displayId);
139    // Notify window manager of the new display override configuration. Returns an array of stack
140    // ids that were affected by the update, ActivityManager should resize these stacks.
141    int[] setNewDisplayOverrideConfiguration(in Configuration overrideConfig, int displayId);
142
143    void startFreezingScreen(int exitAnim, int enterAnim);
144    void stopFreezingScreen();
145
146    // these require DISABLE_KEYGUARD permission
147    void disableKeyguard(IBinder token, String tag);
148    void reenableKeyguard(IBinder token);
149    void exitKeyguardSecurely(IOnKeyguardExitResult callback);
150    boolean isKeyguardLocked();
151    boolean isKeyguardSecure();
152    void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message);
153
154    // Requires INTERACT_ACROSS_USERS_FULL permission
155    void setSwitchingUser(boolean switching);
156
157    void closeSystemDialogs(String reason);
158
159    // These can only be called with the SET_ANIMATON_SCALE permission.
160    float getAnimationScale(int which);
161    float[] getAnimationScales();
162    void setAnimationScale(int which, float scale);
163    void setAnimationScales(in float[] scales);
164
165    float getCurrentAnimatorScale();
166
167    // For testing
168    void setInTouchMode(boolean showFocus);
169
170    // For StrictMode flashing a red border on violations from the UI
171    // thread.  The uid/pid is implicit from the Binder call, and the Window
172    // Manager uses that to determine whether or not the red border should
173    // actually be shown.  (it will be ignored that pid doesn't have windows
174    // on screen)
175    void showStrictModeViolation(boolean on);
176
177    // Proxy to set the system property for whether the flashing
178    // should be enabled.  The 'enabled' value is null or blank for
179    // the system default (differs per build variant) or any valid
180    // boolean string as parsed by SystemProperties.getBoolean().
181    void setStrictModeVisualIndicatorPreference(String enabled);
182
183    /**
184     * Set whether screen capture is disabled for all windows of a specific user from
185     * the device policy cache.
186     */
187    void refreshScreenCaptureDisabled(int userId);
188
189    // These can only be called with the SET_ORIENTATION permission.
190    /**
191     * Update the current screen rotation based on the current state of
192     * the world.
193     * @param alwaysSendConfiguration Flag to force a new configuration to
194     * be evaluated.  This can be used when there are other parameters in
195     * configuration that are changing.
196     * @param forceRelayout If true, the window manager will always do a relayout
197     * of its windows even if the rotation hasn't changed.
198     */
199    void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
200
201    /**
202     * Retrieve the current orientation of the primary screen.
203     * @return Constant as per {@link android.view.Surface.Rotation}.
204     *
205     * @see android.view.Display#DEFAULT_DISPLAY
206     */
207    int getDefaultDisplayRotation();
208
209    /**
210     * Watch the rotation of the specified screen.  Returns the current rotation,
211     * calls back when it changes.
212     */
213    int watchRotation(IRotationWatcher watcher, int displayId);
214
215    /**
216     * Remove a rotation watcher set using watchRotation.
217     * @hide
218     */
219    void removeRotationWatcher(IRotationWatcher watcher);
220
221    /**
222     * Determine the preferred edge of the screen to pin the compact options menu against.
223     * @return a Gravity value for the options menu panel
224     * @hide
225     */
226    int getPreferredOptionsPanelGravity();
227
228    /**
229     * Lock the device orientation to the specified rotation, or to the
230     * current rotation if -1.  Sensor input will be ignored until
231     * thawRotation() is called.
232     * @hide
233     */
234    void freezeRotation(int rotation);
235
236    /**
237     * Release the orientation lock imposed by freezeRotation().
238     * @hide
239     */
240    void thawRotation();
241
242    /**
243     * Gets whether the rotation is frozen.
244     *
245     * @return Whether the rotation is frozen.
246     */
247    boolean isRotationFrozen();
248
249    /**
250     * Screenshot the current wallpaper layer, including the whole screen.
251     */
252    Bitmap screenshotWallpaper();
253
254    /**
255     * Registers a wallpaper visibility listener.
256     * @return Current visibility.
257     */
258    boolean registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
259        int displayId);
260
261    /**
262     * Remove a visibility watcher that was added using registerWallpaperVisibilityListener.
263     */
264    void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
265        int displayId);
266
267    /**
268     * Used only for assist -- request a screenshot of the current application.
269     */
270    boolean requestAssistScreenshot(IAssistDataReceiver receiver);
271
272    /**
273     * Called by the status bar to notify Views of changes to System UI visiblity.
274     */
275    oneway void statusBarVisibilityChanged(int visibility);
276
277    /**
278     * Called by System UI to notify of changes to the visibility of Recents.
279     */
280    oneway void setRecentsVisibility(boolean visible);
281
282    /**
283     * Called by System UI to notify of changes to the visibility of PIP.
284     */
285    oneway void setPipVisibility(boolean visible);
286
287    /**
288     * Called by System UI to notify of changes to the visibility and height of the shelf.
289     */
290    void setShelfHeight(boolean visible, int shelfHeight);
291
292    /**
293     * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
294     */
295    void setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled);
296
297    /**
298     * Device has a software navigation bar (separate from the status bar).
299     */
300    boolean hasNavigationBar();
301
302    /**
303     * Get the position of the nav bar
304     */
305    int getNavBarPosition();
306
307    /**
308     * Lock the device immediately with the specified options (can be null).
309     */
310    void lockNow(in Bundle options);
311
312    /**
313     * Device is in safe mode.
314     */
315    boolean isSafeModeEnabled();
316
317    /**
318     * Enables the screen if all conditions are met.
319     */
320    void enableScreenIfNeeded();
321
322    /**
323     * Clears the frame statistics for a given window.
324     *
325     * @param token The window token.
326     * @return Whether the frame statistics were cleared.
327     */
328    boolean clearWindowContentFrameStats(IBinder token);
329
330    /**
331     * Gets the content frame statistics for a given window.
332     *
333     * @param token The window token.
334     * @return The frame statistics or null if the window does not exist.
335     */
336    WindowContentFrameStats getWindowContentFrameStats(IBinder token);
337
338    /**
339     * @return the dock side the current docked stack is at; must be one of the
340     *         WindowManagerGlobal.DOCKED_* values
341     */
342    int getDockedStackSide();
343
344    /**
345     * Sets the region the user can touch the divider. This region will be excluded from the region
346     * which is used to cause a focus switch when dispatching touch.
347     */
348    void setDockedStackDividerTouchRegion(in Rect touchableRegion);
349
350    /**
351     * Registers a listener that will be called when the dock divider changes its visibility or when
352     * the docked stack gets added/removed.
353     */
354    void registerDockedStackListener(IDockedStackListener listener);
355
356    /**
357     * Registers a listener that will be called when the pinned stack state changes.
358     */
359    void registerPinnedStackListener(int displayId, IPinnedStackListener listener);
360
361    /**
362     * Updates the dim layer used while resizing.
363     *
364     * @param visible Whether the dim layer should be visible.
365     * @param targetWindowingMode The windowing mode of the stack the dim layer should be placed on.
366     * @param alpha The translucency of the dim layer, between 0 and 1.
367     */
368    void setResizeDimLayer(boolean visible, int targetWindowingMode, float alpha);
369
370    /**
371     * Requests Keyboard Shortcuts from the displayed window.
372     *
373     * @param receiver The receiver to deliver the results to.
374     */
375    void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId);
376
377    /**
378     * Retrieves the current stable insets from the primary display.
379     */
380    void getStableInsets(int displayId, out Rect outInsets);
381
382    /**
383     * Register shortcut key. Shortcut code is packed as:
384     * (MetaState << Integer.SIZE) | KeyCode
385     * @hide
386     */
387    void registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber);
388
389    /**
390     * Create an input consumer by name.
391     */
392    void createInputConsumer(IBinder token, String name, out InputChannel inputChannel);
393
394    /**
395     * Destroy an input consumer by name.  This method will also dispose the input channels
396     * associated with that InputConsumer.
397     */
398    boolean destroyInputConsumer(String name);
399
400    /**
401     * Return the touch region for the current IME window, or an empty region if there is none.
402     */
403    Region getCurrentImeTouchRegion();
404
405    /**
406     * Starts a window trace.
407     */
408    void startWindowTrace();
409
410    /**
411     * Stops a window trace.
412     */
413    void stopWindowTrace();
414
415    /**
416     * Returns true if window trace is enabled.
417     */
418    boolean isWindowTraceEnabled();
419
420    /**
421     * Requests that the WindowManager sends WindowManagerPolicy#ACTION_USER_ACTIVITY_NOTIFICATION
422     * on the next user activity.
423     */
424    void requestUserActivityNotification();
425
426    /**
427     * Notify WindowManager that it should not override the info in DisplayManager for the specified
428     * display. This can disable letter- or pillar-boxing applied in DisplayManager when the metrics
429     * of the logical display reported from WindowManager do not correspond to the metrics of the
430     * physical display it is based on.
431     *
432     * @param displayId The id of the display.
433     */
434    void dontOverrideDisplayInfo(int displayId);
435}
436