blob: 5994d4fbae39838ef6c4659dc42b8b39077c88f4 [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
Dianne Hackborn27eac1d2015-03-16 17:15:53 -070019import com.android.internal.app.IAssistScreenshotReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import com.android.internal.view.IInputContext;
21import com.android.internal.view.IInputMethodClient;
22
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070023import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.res.Configuration;
Dianne Hackborn0aae2d42010-12-07 23:51:29 -080025import android.graphics.Bitmap;
Dianne Hackbornac8dea12011-04-20 18:18:51 -070026import android.graphics.Point;
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -070027import android.graphics.Rect;
Adam Cohenf7522022012-10-03 20:03:18 -070028import android.os.Bundle;
Dianne Hackborn38e29a62011-09-18 14:43:08 -070029import android.os.IRemoteCallback;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.view.IApplicationToken;
31import android.view.IOnKeyguardExitResult;
32import android.view.IRotationWatcher;
33import android.view.IWindowSession;
Dianne Hackborneb94fa72014-06-03 17:48:12 -070034import android.view.IWindowSessionCallback;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070036import android.view.InputEvent;
Svetoslav Ganov152e9bb2012-10-12 20:15:29 -070037import android.view.MagnificationSpec;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070039import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070040import android.view.InputDevice;
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -070041import android.view.IInputFilter;
Svetoslav1376d602014-03-13 11:17:26 -070042import android.view.WindowContentFrameStats;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043
44/**
45 * System private interface to the window manager.
46 *
47 * {@hide}
48 */
49interface IWindowManager
50{
51 /**
52 * ===== NOTICE =====
53 * The first three methods must remain the first three methods. Scripts
54 * and tools rely on their transaction number to work properly.
55 */
56 // This is used for debugging
57 boolean startViewServer(int port); // Transaction #1
58 boolean stopViewServer(); // Transaction #2
59 boolean isViewServerRunning(); // Transaction #3
60
Dianne Hackborneb94fa72014-06-03 17:48:12 -070061 IWindowSession openSession(in IWindowSessionCallback callback, in IInputMethodClient client,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062 in IInputContext inputContext);
63 boolean inputMethodClientHasFocus(IInputMethodClient client);
Dianne Hackbornac8dea12011-04-20 18:18:51 -070064
Dianne Hackborn672cf452013-03-26 15:24:24 -070065 void getInitialDisplaySize(int displayId, out Point size);
66 void getBaseDisplaySize(int displayId, out Point size);
Jeff Brown43aa1592012-09-10 17:36:31 -070067 void setForcedDisplaySize(int displayId, int width, int height);
Craig Mautner59c00972012-07-30 12:10:24 -070068 void clearForcedDisplaySize(int displayId);
Dianne Hackborn672cf452013-03-26 15:24:24 -070069 int getInitialDisplayDensity(int displayId);
70 int getBaseDisplayDensity(int displayId);
Dianne Hackborndde331c2012-08-03 14:01:57 -070071 void setForcedDisplayDensity(int displayId, int density);
72 void clearForcedDisplayDensity(int displayId);
Jeff Brownd46747a2015-04-15 19:02:36 -070073 void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable
Dianne Hackborn7916ac62011-05-16 20:45:48 -070074
Dianne Hackbornc652de82013-02-15 16:32:56 -080075 void setOverscan(int displayId, int left, int top, int right, int bottom);
76
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);
Craig Mautnerc00204b2013-03-05 15:02:14 -080083 void addAppToken(int addPos, IApplicationToken token, int groupId, int stackId,
Craig Mautner5d9f5472013-11-12 14:02:52 -080084 int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
Craig Mautnerbb742462014-07-07 15:28:55 -070085 int configChanges, boolean voiceInteraction, boolean launchTaskBehind);
Craig Mautner83162a92015-01-26 14:43:30 -080086 void setAppTask(IBinder token, int taskId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 void setAppOrientation(IApplicationToken token, int requestedOrientation);
88 int getAppOrientation(IApplicationToken token);
89 void setFocusedApp(IBinder token, boolean moveFocusNow);
Dianne Hackborn7da6ac32010-12-09 19:22:04 -080090 void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 int getPendingAppTransition();
Dianne Hackborn84375872012-06-01 19:03:50 -070092 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
93 IRemoteCallback startedCallback);
Dianne Hackborneabfb3a2012-04-16 16:28:22 -070094 void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
95 int startHeight);
Chet Haase10e23ab2015-02-11 15:08:38 -080096 void overridePendingAppTransitionClipReveal(int startX, int startY,
97 int startWidth, int startHeight);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070098 void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
Michael Jurka832cb222012-04-13 09:32:47 -070099 IRemoteCallback startedCallback, boolean scaleUp);
Winson Chunga4ccb862014-08-22 15:26:27 -0700100 void overridePendingAppTransitionAspectScaledThumb(in Bitmap srcThumb, int startX,
Winson Chung2e7f3bd2014-09-05 13:17:22 +0200101 int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
102 boolean scaleUp);
Winson Chung044d5292014-11-06 11:05:19 -0800103 void overridePendingAppTransitionInPlace(String packageName, int anim);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 void executeAppTransition();
105 void setAppStartingWindow(IBinder token, String pkg, int theme,
Dianne Hackborn2f0b1752011-05-31 17:59:49 -0700106 in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
Adam Powell04fe6eb2013-05-31 14:39:48 -0700107 int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 void setAppWillBeHidden(IBinder token);
109 void setAppVisibility(IBinder token, boolean visible);
110 void startAppFreezingScreen(IBinder token, int configChanges);
111 void stopAppFreezingScreen(IBinder token, boolean force);
112 void removeAppToken(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113
Dianne Hackborne36d6e22010-02-17 19:46:25 -0800114 // Re-evaluate the current orientation from the caller's state.
115 // If there is a change, the new Configuration is returned and the
116 // caller must call setNewConfiguration() sometime later.
117 Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
118 IBinder freezeThisOneIfNeeded);
119 void setNewConfiguration(in Configuration config);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800120
Dianne Hackborn9d9ece32012-09-10 15:33:52 -0700121 void startFreezingScreen(int exitAnim, int enterAnim);
122 void stopFreezingScreen();
123
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 // these require DISABLE_KEYGUARD permission
125 void disableKeyguard(IBinder token, String tag);
126 void reenableKeyguard(IBinder token);
127 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500128 boolean isKeyguardLocked();
129 boolean isKeyguardSecure();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 boolean inKeyguardRestrictedInputMode();
Dianne Hackborn90c52de2011-09-23 12:57:44 -0700131 void dismissKeyguard();
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200132 void keyguardGoingAway(boolean disableWindowAnimations,
133 boolean keyguardGoingToNotificationShade);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134
Dianne Hackbornffa42482009-09-23 22:20:11 -0700135 void closeSystemDialogs(String reason);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800136
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 // These can only be called with the SET_ANIMATON_SCALE permission.
138 float getAnimationScale(int which);
139 float[] getAnimationScales();
140 void setAnimationScale(int which, float scale);
141 void setAnimationScales(in float[] scales);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800142
Dianne Hackborneb94fa72014-06-03 17:48:12 -0700143 float getCurrentAnimatorScale();
144
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800145 // For testing
146 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800147
148 // For StrictMode flashing a red border on violations from the UI
149 // thread. The uid/pid is implicit from the Binder call, and the Window
150 // Manager uses that to determine whether or not the red border should
151 // actually be shown. (it will be ignored that pid doesn't have windows
152 // on screen)
153 void showStrictModeViolation(boolean on);
154
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800155 // Proxy to set the system property for whether the flashing
156 // should be enabled. The 'enabled' value is null or blank for
157 // the system default (differs per build variant) or any valid
158 // boolean string as parsed by SystemProperties.getBoolean().
159 void setStrictModeVisualIndicatorPreference(String enabled);
160
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100161 /**
Sander Alewijnsea87863a2014-07-29 12:01:38 +0100162 * Set whether screen capture is disabled for all windows of a specific user
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100163 */
Sander Alewijnsea87863a2014-07-29 12:01:38 +0100164 void setScreenCaptureDisabled(int userId, boolean disabled);
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100165
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 // These can only be called with the SET_ORIENTATION permission.
167 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700168 * Update the current screen rotation based on the current state of
169 * the world.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800170 * @param alwaysSendConfiguration Flag to force a new configuration to
171 * be evaluated. This can be used when there are other parameters in
172 * configuration that are changing.
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700173 * @param forceRelayout If true, the window manager will always do a relayout
174 * of its windows even if the rotation hasn't changed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 */
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700176 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800177
178 /**
179 * Retrieve the current screen orientation, constants as per
180 * {@link android.view.Surface}.
181 */
182 int getRotation();
Jim Miller4eeb4f62012-11-08 00:04:29 -0800183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184 /**
185 * Watch the rotation of the screen. Returns the current rotation,
186 * calls back when it changes.
187 */
188 int watchRotation(IRotationWatcher watcher);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400189
Adam Powelldfee59a2011-08-05 20:48:30 -0700190 /**
Brian Colonnab1b9a8a2013-03-29 11:52:42 -0400191 * Remove a rotation watcher set using watchRotation.
192 * @hide
193 */
194 void removeRotationWatcher(IRotationWatcher watcher);
195
196 /**
Adam Powelldfee59a2011-08-05 20:48:30 -0700197 * Determine the preferred edge of the screen to pin the compact options menu against.
198 * @return a Gravity value for the options menu panel
199 * @hide
200 */
201 int getPreferredOptionsPanelGravity();
202
Jim Miller4eeb4f62012-11-08 00:04:29 -0800203 /**
204 * Lock the device orientation to the specified rotation, or to the
205 * current rotation if -1. Sensor input will be ignored until
206 * thawRotation() is called.
207 * @hide
208 */
209 void freezeRotation(int rotation);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400210
Jim Miller4eeb4f62012-11-08 00:04:29 -0800211 /**
212 * Release the orientation lock imposed by freezeRotation().
213 * @hide
214 */
215 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800216
Jim Miller4eeb4f62012-11-08 00:04:29 -0800217 /**
Svetoslav8e3feb12014-02-24 13:46:47 -0800218 * Gets whether the rotation is frozen.
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800219 *
220 * @return Whether the rotation is frozen.
221 */
222 boolean isRotationFrozen();
223
224 /**
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700225 * Used only for assist -- request a screenshot of the current application.
226 */
227 boolean requestAssistScreenshot(IAssistScreenshotReceiver receiver);
228
229 /**
Jim Miller4eeb4f62012-11-08 00:04:29 -0800230 * Create a screenshot of the applications currently displayed.
231 */
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700232 Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
Joe Onorato664644d2011-01-23 17:53:23 -0800233
234 /**
235 * Called by the status bar to notify Views of changes to System UI visiblity.
236 */
John Spurlocke7c28572013-10-29 14:23:51 -0400237 oneway void statusBarVisibilityChanged(int visibility);
Jeff Brown1a84fd12011-06-02 01:26:32 -0700238
239 /**
Daniel Sandler0c4ccff2011-10-19 16:39:14 -0400240 * Device has a software navigation bar (separate from the status bar).
241 */
242 boolean hasNavigationBar();
Jim Miller93c518e2012-01-17 15:55:31 -0800243
244 /**
Adam Cohenf7522022012-10-03 20:03:18 -0700245 * Lock the device immediately with the specified options (can be null).
Jim Miller93c518e2012-01-17 15:55:31 -0800246 */
Adam Cohenf7522022012-10-03 20:03:18 -0700247 void lockNow(in Bundle options);
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -0700248
249 /**
Jim Millerbfec0a82012-11-05 20:05:22 -0800250 * Device is in safe mode.
251 */
252 boolean isSafeModeEnabled();
Jorim Jaggicff0acb2014-03-31 16:35:15 +0200253
254 /**
255 * Enables the screen if all conditions are met.
256 */
257 void enableScreenIfNeeded();
Svetoslavdd137a82014-04-10 12:48:07 -0700258
259 /**
Svetoslav1376d602014-03-13 11:17:26 -0700260 * Clears the frame statistics for a given window.
261 *
262 * @param token The window token.
263 * @return Whether the frame statistics were cleared.
264 */
265 boolean clearWindowContentFrameStats(IBinder token);
266
267 /**
268 * Gets the content frame statistics for a given window.
269 *
270 * @param token The window token.
271 * @return The frame statistics or null if the window does not exist.
272 */
273 WindowContentFrameStats getWindowContentFrameStats(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800274}