blob: f58cd836f9f3ee97bb5d61879e47483b0c978caa [file] [log] [blame]
Dianne Hackborn7da6ac32010-12-09 19:22:04 -08001/*
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002** 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
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070022import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.res.Configuration;
Dianne Hackborn0aae2d42010-12-07 23:51:29 -080024import android.graphics.Bitmap;
Dianne Hackbornac8dea12011-04-20 18:18:51 -070025import android.graphics.Point;
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -070026import android.graphics.Rect;
Dianne Hackborn38e29a62011-09-18 14:43:08 -070027import android.os.IRemoteCallback;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.view.IApplicationToken;
29import android.view.IOnKeyguardExitResult;
30import android.view.IRotationWatcher;
31import android.view.IWindowSession;
32import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070033import android.view.InputEvent;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070035import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070036import android.view.InputDevice;
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -070037import android.view.IInputFilter;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038
39/**
40 * System private interface to the window manager.
41 *
42 * {@hide}
43 */
44interface IWindowManager
45{
46 /**
47 * ===== NOTICE =====
48 * The first three methods must remain the first three methods. Scripts
49 * and tools rely on their transaction number to work properly.
50 */
51 // This is used for debugging
52 boolean startViewServer(int port); // Transaction #1
53 boolean stopViewServer(); // Transaction #2
54 boolean isViewServerRunning(); // Transaction #3
55
56 IWindowSession openSession(in IInputMethodClient client,
57 in IInputContext inputContext);
58 boolean inputMethodClientHasFocus(IInputMethodClient client);
Dianne Hackbornac8dea12011-04-20 18:18:51 -070059
Craig Mautner59c00972012-07-30 12:10:24 -070060 void setForcedDisplaySize(int displayId, int longDimen, int shortDimen);
61 void clearForcedDisplaySize(int displayId);
Dianne Hackborn7916ac62011-05-16 20:45:48 -070062
Dianne Hackbornf87d1962012-04-04 12:48:24 -070063 // Is the device configured to have a full system bar for larger screens?
64 boolean hasSystemNavBar();
Dianne Hackborn81e56d52011-05-26 00:55:58 -070065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 // These can only be called when holding the MANAGE_APP_TOKENS permission.
67 void pauseKeyDispatching(IBinder token);
68 void resumeKeyDispatching(IBinder token);
69 void setEventDispatching(boolean enabled);
Dianne Hackborne4fbd622009-03-27 18:09:16 -070070 void addWindowToken(IBinder token, int type);
71 void removeWindowToken(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 void addAppToken(int addPos, IApplicationToken token,
73 int groupId, int requestedOrientation, boolean fullscreen);
74 void setAppGroupId(IBinder token, int groupId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 void setAppOrientation(IApplicationToken token, int requestedOrientation);
76 int getAppOrientation(IApplicationToken token);
77 void setFocusedApp(IBinder token, boolean moveFocusNow);
Dianne Hackborn7da6ac32010-12-09 19:22:04 -080078 void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 int getPendingAppTransition();
Dianne Hackborn84375872012-06-01 19:03:50 -070080 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
81 IRemoteCallback startedCallback);
Dianne Hackborneabfb3a2012-04-16 16:28:22 -070082 void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
83 int startHeight);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070084 void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
Michael Jurka21385cd2012-05-03 10:57:31 -070085 IRemoteCallback startedCallback, boolean delayed);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 void executeAppTransition();
87 void setAppStartingWindow(IBinder token, String pkg, int theme,
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070088 in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
Dianne Hackborn7eec10e2010-11-12 18:03:47 -080089 int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090 void setAppWillBeHidden(IBinder token);
91 void setAppVisibility(IBinder token, boolean visible);
92 void startAppFreezingScreen(IBinder token, int configChanges);
93 void stopAppFreezingScreen(IBinder token, boolean force);
94 void removeAppToken(IBinder token);
95 void moveAppToken(int index, IBinder token);
96 void moveAppTokensToTop(in List<IBinder> tokens);
97 void moveAppTokensToBottom(in List<IBinder> tokens);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098
Dianne Hackborne36d6e22010-02-17 19:46:25 -080099 // Re-evaluate the current orientation from the caller's state.
100 // If there is a change, the new Configuration is returned and the
101 // caller must call setNewConfiguration() sometime later.
102 Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
103 IBinder freezeThisOneIfNeeded);
104 void setNewConfiguration(in Configuration config);
105
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 // these require DISABLE_KEYGUARD permission
107 void disableKeyguard(IBinder token, String tag);
108 void reenableKeyguard(IBinder token);
109 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500110 boolean isKeyguardLocked();
111 boolean isKeyguardSecure();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 boolean inKeyguardRestrictedInputMode();
Dianne Hackborn90c52de2011-09-23 12:57:44 -0700113 void dismissKeyguard();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114
Dianne Hackbornffa42482009-09-23 22:20:11 -0700115 void closeSystemDialogs(String reason);
116
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 // These can only be called with the SET_ANIMATON_SCALE permission.
118 float getAnimationScale(int which);
119 float[] getAnimationScales();
120 void setAnimationScale(int which, float scale);
121 void setAnimationScales(in float[] scales);
122
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 // For testing
124 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800125
126 // For StrictMode flashing a red border on violations from the UI
127 // thread. The uid/pid is implicit from the Binder call, and the Window
128 // Manager uses that to determine whether or not the red border should
129 // actually be shown. (it will be ignored that pid doesn't have windows
130 // on screen)
131 void showStrictModeViolation(boolean on);
132
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800133 // Proxy to set the system property for whether the flashing
134 // should be enabled. The 'enabled' value is null or blank for
135 // the system default (differs per build variant) or any valid
136 // boolean string as parsed by SystemProperties.getBoolean().
137 void setStrictModeVisualIndicatorPreference(String enabled);
138
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 // These can only be called with the SET_ORIENTATION permission.
140 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700141 * Update the current screen rotation based on the current state of
142 * the world.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 * @param alwaysSendConfiguration Flag to force a new configuration to
144 * be evaluated. This can be used when there are other parameters in
145 * configuration that are changing.
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700146 * @param forceRelayout If true, the window manager will always do a relayout
147 * of its windows even if the rotation hasn't changed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148 */
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700149 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800150
151 /**
152 * Retrieve the current screen orientation, constants as per
153 * {@link android.view.Surface}.
154 */
155 int getRotation();
156
157 /**
158 * Watch the rotation of the screen. Returns the current rotation,
159 * calls back when it changes.
160 */
161 int watchRotation(IRotationWatcher watcher);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400162
Adam Powelldfee59a2011-08-05 20:48:30 -0700163 /**
164 * Determine the preferred edge of the screen to pin the compact options menu against.
165 * @return a Gravity value for the options menu panel
166 * @hide
167 */
168 int getPreferredOptionsPanelGravity();
169
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400170 /**
Jeff Brown4dfce202011-10-05 12:00:10 -0700171 * Lock the device orientation to the specified rotation, or to the
172 * current rotation if -1. Sensor input will be ignored until
173 * thawRotation() is called.
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400174 * @hide
175 */
Jeff Brown4dfce202011-10-05 12:00:10 -0700176 void freezeRotation(int rotation);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400177
178 /**
179 * Release the orientation lock imposed by freezeRotation().
180 * @hide
181 */
182 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800183
184 /**
185 * Create a screenshot of the applications currently displayed.
186 */
Craig Mautner59c00972012-07-30 12:10:24 -0700187 Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
Joe Onorato664644d2011-01-23 17:53:23 -0800188
189 /**
190 * Called by the status bar to notify Views of changes to System UI visiblity.
191 */
192 void statusBarVisibilityChanged(int visibility);
Jeff Brown1a84fd12011-06-02 01:26:32 -0700193
194 /**
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700195 * Block until the given window has been drawn to the screen.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700196 */
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700197 void waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
Daniel Sandler0c4ccff2011-10-19 16:39:14 -0400198
199 /**
200 * Device has a software navigation bar (separate from the status bar).
201 */
202 boolean hasNavigationBar();
Jim Miller93c518e2012-01-17 15:55:31 -0800203
204 /**
205 * Lock the device immediately.
206 */
207 void lockNow();
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -0700208
209 /**
210 * Gets the token for the focused window.
211 */
212 IBinder getFocusedWindowToken();
213
214 /**
215 * Gets the frame on the screen of the window given its token.
216 */
217 boolean getWindowFrame(IBinder token, out Rect outBounds);
218
219 /**
220 * Gets the compatibility scale of e window given its token.
221 */
222 float getWindowCompatibilityScale(IBinder windowToken);
223
224 /**
225 * Sets an input filter for manipulating the input event stream.
226 */
227 void setInputFilter(in IInputFilter filter);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800228}