blob: 8ed4a86e9b60ab64de3a5e3b1297d20491be7b10 [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**
Jim Miller4eeb4f62012-11-08 00:04:29 -08004** 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08007**
Jim Miller4eeb4f62012-11-08 00:04:29 -08008** http://www.apache.org/licenses/LICENSE-2.0
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08009**
Jim Miller4eeb4f62012-11-08 00:04:29 -080010** 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080014** 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;
Adam Cohenf7522022012-10-03 20:03:18 -070027import android.os.Bundle;
Dianne Hackborn38e29a62011-09-18 14:43:08 -070028import android.os.IRemoteCallback;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.view.IApplicationToken;
Svetoslav Ganov545252f2012-12-10 18:29:24 -080030import android.view.IMagnificationCallbacks;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.view.IOnKeyguardExitResult;
32import android.view.IRotationWatcher;
33import android.view.IWindowSession;
34import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070035import android.view.InputEvent;
Svetoslav Ganov152e9bb2012-10-12 20:15:29 -070036import android.view.MagnificationSpec;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070038import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070039import android.view.InputDevice;
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -070040import android.view.IInputFilter;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041
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);
Dianne Hackbornac8dea12011-04-20 18:18:51 -070062
Dianne Hackborn672cf452013-03-26 15:24:24 -070063 void getInitialDisplaySize(int displayId, out Point size);
64 void getBaseDisplaySize(int displayId, out Point size);
Jeff Brown43aa1592012-09-10 17:36:31 -070065 void setForcedDisplaySize(int displayId, int width, int height);
Craig Mautner59c00972012-07-30 12:10:24 -070066 void clearForcedDisplaySize(int displayId);
Dianne Hackborn672cf452013-03-26 15:24:24 -070067 int getInitialDisplayDensity(int displayId);
68 int getBaseDisplayDensity(int displayId);
Dianne Hackborndde331c2012-08-03 14:01:57 -070069 void setForcedDisplayDensity(int displayId, int density);
70 void clearForcedDisplayDensity(int displayId);
Dianne Hackborn7916ac62011-05-16 20:45:48 -070071
Dianne Hackbornc652de82013-02-15 16:32:56 -080072 void setOverscan(int displayId, int left, int top, int right, int bottom);
73
Dianne Hackbornf87d1962012-04-04 12:48:24 -070074 // Is the device configured to have a full system bar for larger screens?
75 boolean hasSystemNavBar();
Dianne Hackborn81e56d52011-05-26 00:55:58 -070076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 // 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);
Dianne Hackborne4fbd622009-03-27 18:09:16 -070081 void addWindowToken(IBinder token, int type);
82 void removeWindowToken(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 void addAppToken(int addPos, IApplicationToken token,
Craig Mautner5962b122012-10-05 14:45:52 -070084 int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 void setAppGroupId(IBinder token, int groupId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 void setAppOrientation(IApplicationToken token, int requestedOrientation);
87 int getAppOrientation(IApplicationToken token);
88 void setFocusedApp(IBinder token, boolean moveFocusNow);
Dianne Hackborn7da6ac32010-12-09 19:22:04 -080089 void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090 int getPendingAppTransition();
Dianne Hackborn84375872012-06-01 19:03:50 -070091 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
92 IRemoteCallback startedCallback);
Dianne Hackborneabfb3a2012-04-16 16:28:22 -070093 void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
94 int startHeight);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070095 void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
Michael Jurka832cb222012-04-13 09:32:47 -070096 IRemoteCallback startedCallback, boolean scaleUp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 void executeAppTransition();
98 void setAppStartingWindow(IBinder token, String pkg, int theme,
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070099 in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
Dianne Hackborn7eec10e2010-11-12 18:03:47 -0800100 int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 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);
Craig Mautner2ad92072013-02-25 16:19:24 -0800106 void moveAppToken(int index, IBinder token);
107 void moveAppTokensToTop(in List<IBinder> tokens);
108 void moveAppTokensToBottom(in List<IBinder> tokens);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109
Dianne Hackborne36d6e22010-02-17 19:46:25 -0800110 // 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);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800116
Dianne Hackborn9d9ece32012-09-10 15:33:52 -0700117 void startFreezingScreen(int exitAnim, int enterAnim);
118 void stopFreezingScreen();
119
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 // these require DISABLE_KEYGUARD permission
121 void disableKeyguard(IBinder token, String tag);
122 void reenableKeyguard(IBinder token);
123 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500124 boolean isKeyguardLocked();
125 boolean isKeyguardSecure();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 boolean inKeyguardRestrictedInputMode();
Dianne Hackborn90c52de2011-09-23 12:57:44 -0700127 void dismissKeyguard();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128
Dianne Hackbornffa42482009-09-23 22:20:11 -0700129 void closeSystemDialogs(String reason);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800130
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 // 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);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800136
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 // For testing
138 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800139
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
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800147 // 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 // These can only be called with the SET_ORIENTATION permission.
154 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700155 * Update the current screen rotation based on the current state of
156 * the world.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 * @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.
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700160 * @param forceRelayout If true, the window manager will always do a relayout
161 * of its windows even if the rotation hasn't changed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800162 */
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700163 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164
165 /**
166 * Retrieve the current screen orientation, constants as per
167 * {@link android.view.Surface}.
168 */
169 int getRotation();
Jim Miller4eeb4f62012-11-08 00:04:29 -0800170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800171 /**
172 * Watch the rotation of the screen. Returns the current rotation,
173 * calls back when it changes.
174 */
175 int watchRotation(IRotationWatcher watcher);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400176
Adam Powelldfee59a2011-08-05 20:48:30 -0700177 /**
Brian Colonnab1b9a8a2013-03-29 11:52:42 -0400178 * Remove a rotation watcher set using watchRotation.
179 * @hide
180 */
181 void removeRotationWatcher(IRotationWatcher watcher);
182
183 /**
Adam Powelldfee59a2011-08-05 20:48:30 -0700184 * Determine the preferred edge of the screen to pin the compact options menu against.
185 * @return a Gravity value for the options menu panel
186 * @hide
187 */
188 int getPreferredOptionsPanelGravity();
189
Jim Miller4eeb4f62012-11-08 00:04:29 -0800190 /**
191 * Lock the device orientation to the specified rotation, or to the
192 * current rotation if -1. Sensor input will be ignored until
193 * thawRotation() is called.
194 * @hide
195 */
196 void freezeRotation(int rotation);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400197
Jim Miller4eeb4f62012-11-08 00:04:29 -0800198 /**
199 * Release the orientation lock imposed by freezeRotation().
200 * @hide
201 */
202 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800203
Jim Miller4eeb4f62012-11-08 00:04:29 -0800204 /**
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800205 * Gets whether the rotation is frozen.
206 *
207 * @return Whether the rotation is frozen.
208 */
209 boolean isRotationFrozen();
210
211 /**
Jim Miller4eeb4f62012-11-08 00:04:29 -0800212 * Create a screenshot of the applications currently displayed.
213 */
214 Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
Joe Onorato664644d2011-01-23 17:53:23 -0800215
216 /**
217 * Called by the status bar to notify Views of changes to System UI visiblity.
218 */
219 void statusBarVisibilityChanged(int visibility);
Jeff Brown1a84fd12011-06-02 01:26:32 -0700220
221 /**
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700222 * Block until the given window has been drawn to the screen.
Jeff Brownc38c9be2012-10-04 13:16:19 -0700223 * Returns true if really waiting, false if the window does not exist.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700224 */
Jeff Brownc38c9be2012-10-04 13:16:19 -0700225 boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
Daniel Sandler0c4ccff2011-10-19 16:39:14 -0400226
227 /**
228 * Device has a software navigation bar (separate from the status bar).
229 */
230 boolean hasNavigationBar();
Jim Miller93c518e2012-01-17 15:55:31 -0800231
232 /**
Adam Cohenf7522022012-10-03 20:03:18 -0700233 * Lock the device immediately with the specified options (can be null).
Jim Miller93c518e2012-01-17 15:55:31 -0800234 */
Adam Cohenf7522022012-10-03 20:03:18 -0700235 void lockNow(in Bundle options);
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -0700236
237 /**
238 * Gets the token for the focused window.
239 */
240 IBinder getFocusedWindowToken();
241
242 /**
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -0700243 * Sets an input filter for manipulating the input event stream.
244 */
245 void setInputFilter(in IInputFilter filter);
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700246
247 /**
Svetoslav Ganov152e9bb2012-10-12 20:15:29 -0700248 * Gets the frame of a window given its token.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700249 */
Svetoslav Ganov152e9bb2012-10-12 20:15:29 -0700250 void getWindowFrame(IBinder token, out Rect outFrame);
Jim Millerbfec0a82012-11-05 20:05:22 -0800251
252 /**
253 * Device is in safe mode.
254 */
255 boolean isSafeModeEnabled();
Jim Miller4eeb4f62012-11-08 00:04:29 -0800256
257 /**
258 * Tell keyguard to show the assistant (Intent.ACTION_ASSIST) after asking for the user's
259 * credentials.
260 */
261 void showAssistant();
Svetoslav Ganov545252f2012-12-10 18:29:24 -0800262
263 /**
264 * Sets the display magnification callbacks. These callbacks notify
265 * the client for contextual changes related to display magnification.
266 *
267 * @param callbacks The magnification callbacks.
268 */
269 void setMagnificationCallbacks(IMagnificationCallbacks callbacks);
270
271 /**
272 * Sets the magnification spec to be applied to all windows that can be
273 * magnified.
274 *
275 * @param spec The current magnification spec.
276 */
277 void setMagnificationSpec(in MagnificationSpec spec);
278
279 /**
280 * Gets the magnification spec for a window given its token. If the
281 * window has a compatibility scale it is also folded in the returned
282 * magnification spec.
283 *
284 * @param windowToken The unique window token.
285 * @return The magnification spec if such or null.
286 */
287 MagnificationSpec getCompatibleMagnificationSpecForWindow(in IBinder windowToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288}