blob: d6625c837128c0c909242935a6eefab0fda45a3d [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);
Dianne Hackborn7916ac62011-05-16 20:45:48 -070073
Dianne Hackbornc652de82013-02-15 16:32:56 -080074 void setOverscan(int displayId, int left, int top, int right, int bottom);
75
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 // These can only be called when holding the MANAGE_APP_TOKENS permission.
77 void pauseKeyDispatching(IBinder token);
78 void resumeKeyDispatching(IBinder token);
79 void setEventDispatching(boolean enabled);
Dianne Hackborne4fbd622009-03-27 18:09:16 -070080 void addWindowToken(IBinder token, int type);
81 void removeWindowToken(IBinder token);
Craig Mautnerc00204b2013-03-05 15:02:14 -080082 void addAppToken(int addPos, IApplicationToken token, int groupId, int stackId,
Craig Mautner5d9f5472013-11-12 14:02:52 -080083 int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
Craig Mautnerbb742462014-07-07 15:28:55 -070084 int configChanges, boolean voiceInteraction, boolean launchTaskBehind);
Craig Mautner83162a92015-01-26 14:43:30 -080085 void setAppTask(IBinder token, int taskId);
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);
Chet Haase10e23ab2015-02-11 15:08:38 -080095 void overridePendingAppTransitionClipReveal(int startX, int startY,
96 int startWidth, int startHeight);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070097 void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
Michael Jurka832cb222012-04-13 09:32:47 -070098 IRemoteCallback startedCallback, boolean scaleUp);
Winson Chunga4ccb862014-08-22 15:26:27 -070099 void overridePendingAppTransitionAspectScaledThumb(in Bitmap srcThumb, int startX,
Winson Chung2e7f3bd2014-09-05 13:17:22 +0200100 int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
101 boolean scaleUp);
Winson Chung044d5292014-11-06 11:05:19 -0800102 void overridePendingAppTransitionInPlace(String packageName, int anim);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 void executeAppTransition();
104 void setAppStartingWindow(IBinder token, String pkg, int theme,
Dianne Hackborn2f0b1752011-05-31 17:59:49 -0700105 in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
Adam Powell04fe6eb2013-05-31 14:39:48 -0700106 int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 void setAppWillBeHidden(IBinder token);
108 void setAppVisibility(IBinder token, boolean visible);
109 void startAppFreezingScreen(IBinder token, int configChanges);
110 void stopAppFreezingScreen(IBinder token, boolean force);
111 void removeAppToken(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112
Dianne Hackborne36d6e22010-02-17 19:46:25 -0800113 // Re-evaluate the current orientation from the caller's state.
114 // If there is a change, the new Configuration is returned and the
115 // caller must call setNewConfiguration() sometime later.
116 Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
117 IBinder freezeThisOneIfNeeded);
118 void setNewConfiguration(in Configuration config);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800119
Dianne Hackborn9d9ece32012-09-10 15:33:52 -0700120 void startFreezingScreen(int exitAnim, int enterAnim);
121 void stopFreezingScreen();
122
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 // these require DISABLE_KEYGUARD permission
124 void disableKeyguard(IBinder token, String tag);
125 void reenableKeyguard(IBinder token);
126 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500127 boolean isKeyguardLocked();
128 boolean isKeyguardSecure();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 boolean inKeyguardRestrictedInputMode();
Dianne Hackborn90c52de2011-09-23 12:57:44 -0700130 void dismissKeyguard();
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200131 void keyguardGoingAway(boolean disableWindowAnimations,
132 boolean keyguardGoingToNotificationShade);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133
Dianne Hackbornffa42482009-09-23 22:20:11 -0700134 void closeSystemDialogs(String reason);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800135
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 // These can only be called with the SET_ANIMATON_SCALE permission.
137 float getAnimationScale(int which);
138 float[] getAnimationScales();
139 void setAnimationScale(int which, float scale);
140 void setAnimationScales(in float[] scales);
Jim Miller4eeb4f62012-11-08 00:04:29 -0800141
Dianne Hackborneb94fa72014-06-03 17:48:12 -0700142 float getCurrentAnimatorScale();
143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 // For testing
145 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800146
147 // For StrictMode flashing a red border on violations from the UI
148 // thread. The uid/pid is implicit from the Binder call, and the Window
149 // Manager uses that to determine whether or not the red border should
150 // actually be shown. (it will be ignored that pid doesn't have windows
151 // on screen)
152 void showStrictModeViolation(boolean on);
153
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800154 // Proxy to set the system property for whether the flashing
155 // should be enabled. The 'enabled' value is null or blank for
156 // the system default (differs per build variant) or any valid
157 // boolean string as parsed by SystemProperties.getBoolean().
158 void setStrictModeVisualIndicatorPreference(String enabled);
159
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100160 /**
Sander Alewijnsea87863a2014-07-29 12:01:38 +0100161 * Set whether screen capture is disabled for all windows of a specific user
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100162 */
Sander Alewijnsea87863a2014-07-29 12:01:38 +0100163 void setScreenCaptureDisabled(int userId, boolean disabled);
Sander Alewijnsed2a1eec2014-07-09 12:57:05 +0100164
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 // These can only be called with the SET_ORIENTATION permission.
166 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700167 * Update the current screen rotation based on the current state of
168 * the world.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800169 * @param alwaysSendConfiguration Flag to force a new configuration to
170 * be evaluated. This can be used when there are other parameters in
171 * configuration that are changing.
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700172 * @param forceRelayout If true, the window manager will always do a relayout
173 * of its windows even if the rotation hasn't changed.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174 */
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700175 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800176
177 /**
178 * Retrieve the current screen orientation, constants as per
179 * {@link android.view.Surface}.
180 */
181 int getRotation();
Jim Miller4eeb4f62012-11-08 00:04:29 -0800182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800183 /**
184 * Watch the rotation of the screen. Returns the current rotation,
185 * calls back when it changes.
186 */
187 int watchRotation(IRotationWatcher watcher);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400188
Adam Powelldfee59a2011-08-05 20:48:30 -0700189 /**
Brian Colonnab1b9a8a2013-03-29 11:52:42 -0400190 * Remove a rotation watcher set using watchRotation.
191 * @hide
192 */
193 void removeRotationWatcher(IRotationWatcher watcher);
194
195 /**
Adam Powelldfee59a2011-08-05 20:48:30 -0700196 * Determine the preferred edge of the screen to pin the compact options menu against.
197 * @return a Gravity value for the options menu panel
198 * @hide
199 */
200 int getPreferredOptionsPanelGravity();
201
Jim Miller4eeb4f62012-11-08 00:04:29 -0800202 /**
203 * Lock the device orientation to the specified rotation, or to the
204 * current rotation if -1. Sensor input will be ignored until
205 * thawRotation() is called.
206 * @hide
207 */
208 void freezeRotation(int rotation);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400209
Jim Miller4eeb4f62012-11-08 00:04:29 -0800210 /**
211 * Release the orientation lock imposed by freezeRotation().
212 * @hide
213 */
214 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800215
Jim Miller4eeb4f62012-11-08 00:04:29 -0800216 /**
Svetoslav8e3feb12014-02-24 13:46:47 -0800217 * Gets whether the rotation is frozen.
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800218 *
219 * @return Whether the rotation is frozen.
220 */
221 boolean isRotationFrozen();
222
223 /**
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700224 * Used only for assist -- request a screenshot of the current application.
225 */
226 boolean requestAssistScreenshot(IAssistScreenshotReceiver receiver);
227
228 /**
Jim Miller4eeb4f62012-11-08 00:04:29 -0800229 * Create a screenshot of the applications currently displayed.
230 */
Dianne Hackborn27eac1d2015-03-16 17:15:53 -0700231 Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
Joe Onorato664644d2011-01-23 17:53:23 -0800232
233 /**
234 * Called by the status bar to notify Views of changes to System UI visiblity.
235 */
John Spurlocke7c28572013-10-29 14:23:51 -0400236 oneway void statusBarVisibilityChanged(int visibility);
Jeff Brown1a84fd12011-06-02 01:26:32 -0700237
238 /**
Daniel Sandler0c4ccff2011-10-19 16:39:14 -0400239 * Device has a software navigation bar (separate from the status bar).
240 */
241 boolean hasNavigationBar();
Jim Miller93c518e2012-01-17 15:55:31 -0800242
243 /**
Adam Cohenf7522022012-10-03 20:03:18 -0700244 * Lock the device immediately with the specified options (can be null).
Jim Miller93c518e2012-01-17 15:55:31 -0800245 */
Adam Cohenf7522022012-10-03 20:03:18 -0700246 void lockNow(in Bundle options);
Svetoslav Ganovc9c9a482012-07-16 08:46:07 -0700247
248 /**
Jim Millerbfec0a82012-11-05 20:05:22 -0800249 * Device is in safe mode.
250 */
251 boolean isSafeModeEnabled();
Jorim Jaggicff0acb2014-03-31 16:35:15 +0200252
253 /**
254 * Enables the screen if all conditions are met.
255 */
256 void enableScreenIfNeeded();
Svetoslavdd137a82014-04-10 12:48:07 -0700257
258 /**
Svetoslav1376d602014-03-13 11:17:26 -0700259 * Clears the frame statistics for a given window.
260 *
261 * @param token The window token.
262 * @return Whether the frame statistics were cleared.
263 */
264 boolean clearWindowContentFrameStats(IBinder token);
265
266 /**
267 * Gets the content frame statistics for a given window.
268 *
269 * @param token The window token.
270 * @return The frame statistics or null if the window does not exist.
271 */
272 WindowContentFrameStats getWindowContentFrameStats(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800273}