blob: 14cd48f118e216a4d81725f27dcb0de1fd7c6f7d [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;
Dianne Hackborn38e29a62011-09-18 14:43:08 -070026import android.os.IRemoteCallback;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.view.IApplicationToken;
28import android.view.IOnKeyguardExitResult;
29import android.view.IRotationWatcher;
30import android.view.IWindowSession;
31import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070032import android.view.InputEvent;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070034import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070035import android.view.InputDevice;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036
37/**
38 * System private interface to the window manager.
39 *
40 * {@hide}
41 */
42interface IWindowManager
43{
44 /**
45 * ===== NOTICE =====
46 * The first three methods must remain the first three methods. Scripts
47 * and tools rely on their transaction number to work properly.
48 */
49 // This is used for debugging
50 boolean startViewServer(int port); // Transaction #1
51 boolean stopViewServer(); // Transaction #2
52 boolean isViewServerRunning(); // Transaction #3
53
54 IWindowSession openSession(in IInputMethodClient client,
55 in IInputContext inputContext);
56 boolean inputMethodClientHasFocus(IInputMethodClient client);
57
Dianne Hackbornac8dea12011-04-20 18:18:51 -070058 void getDisplaySize(out Point size);
Jeff Brownbc68a592011-07-25 12:58:12 -070059 void getRealDisplaySize(out Point size);
Dianne Hackbornac8dea12011-04-20 18:18:51 -070060 int getMaximumSizeDimension();
61
Dianne Hackborn7916ac62011-05-16 20:45:48 -070062 void setForcedDisplaySize(int longDimen, int shortDimen);
63 void clearForcedDisplaySize();
64
Dianne Hackborn81e56d52011-05-26 00:55:58 -070065 // Is device configured with a hideable status bar or a tablet system bar?
66 boolean canStatusBarHide();
67
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 // These can only be called when injecting events to your own window,
Jeff Brown6ec402b2010-07-28 15:48:59 -070069 // or by holding the INJECT_EVENTS permission. These methods may block
70 // until pending input events are finished being dispatched even when 'sync' is false.
71 // Avoid calling these methods on your UI thread or use the 'NoWait' version instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 boolean injectKeyEvent(in KeyEvent ev, boolean sync);
73 boolean injectPointerEvent(in MotionEvent ev, boolean sync);
74 boolean injectTrackballEvent(in MotionEvent ev, boolean sync);
Jeff Brown6ec402b2010-07-28 15:48:59 -070075 boolean injectInputEventNoWait(in InputEvent ev);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076
77 // 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,
84 int groupId, int requestedOrientation, boolean fullscreen);
85 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 Hackborn3b3e1452009-09-24 19:22:12 -070091 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070092 void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
93 IRemoteCallback startedCallback);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 void executeAppTransition();
95 void setAppStartingWindow(IBinder token, String pkg, int theme,
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070096 in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
Dianne Hackborn7eec10e2010-11-12 18:03:47 -080097 int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 void setAppWillBeHidden(IBinder token);
99 void setAppVisibility(IBinder token, boolean visible);
100 void startAppFreezingScreen(IBinder token, int configChanges);
101 void stopAppFreezingScreen(IBinder token, boolean force);
102 void removeAppToken(IBinder token);
103 void moveAppToken(int index, IBinder token);
104 void moveAppTokensToTop(in List<IBinder> tokens);
105 void moveAppTokensToBottom(in List<IBinder> tokens);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106
Dianne Hackborne36d6e22010-02-17 19:46:25 -0800107 // Re-evaluate the current orientation from the caller's state.
108 // If there is a change, the new Configuration is returned and the
109 // caller must call setNewConfiguration() sometime later.
110 Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
111 IBinder freezeThisOneIfNeeded);
112 void setNewConfiguration(in Configuration config);
113
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114 // these require DISABLE_KEYGUARD permission
115 void disableKeyguard(IBinder token, String tag);
116 void reenableKeyguard(IBinder token);
117 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500118 boolean isKeyguardLocked();
119 boolean isKeyguardSecure();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 boolean inKeyguardRestrictedInputMode();
Dianne Hackborn90c52de2011-09-23 12:57:44 -0700121 void dismissKeyguard();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122
Dianne Hackbornffa42482009-09-23 22:20:11 -0700123 void closeSystemDialogs(String reason);
124
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125 // These can only be called with the SET_ANIMATON_SCALE permission.
126 float getAnimationScale(int which);
127 float[] getAnimationScales();
128 void setAnimationScale(int which, float scale);
129 void setAnimationScales(in float[] scales);
130
131 // These require the READ_INPUT_STATE permission.
132 int getSwitchState(int sw);
133 int getSwitchStateForDevice(int devid, int sw);
134 int getScancodeState(int sw);
135 int getScancodeStateForDevice(int devid, int sw);
Dianne Hackborn1d62ea92009-11-17 12:49:50 -0800136 int getTrackballScancodeState(int sw);
137 int getDPadScancodeState(int sw);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 int getKeycodeState(int sw);
139 int getKeycodeStateForDevice(int devid, int sw);
Dianne Hackborn1d62ea92009-11-17 12:49:50 -0800140 int getTrackballKeycodeState(int sw);
141 int getDPadKeycodeState(int sw);
Jeff Browna41ca772010-08-11 14:46:32 -0700142 InputChannel monitorInput(String inputChannelName);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 // Report whether the hardware supports the given keys; returns true if successful
145 boolean hasKeys(in int[] keycodes, inout boolean[] keyExists);
146
Jeff Brown8d608662010-08-30 03:02:23 -0700147 // Get input device information.
148 InputDevice getInputDevice(int deviceId);
149 int[] getInputDeviceIds();
150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800151 // For testing
152 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800153
154 // For StrictMode flashing a red border on violations from the UI
155 // thread. The uid/pid is implicit from the Binder call, and the Window
156 // Manager uses that to determine whether or not the red border should
157 // actually be shown. (it will be ignored that pid doesn't have windows
158 // on screen)
159 void showStrictModeViolation(boolean on);
160
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800161 // Proxy to set the system property for whether the flashing
162 // should be enabled. The 'enabled' value is null or blank for
163 // the system default (differs per build variant) or any valid
164 // boolean string as parsed by SystemProperties.getBoolean().
165 void setStrictModeVisualIndicatorPreference(String enabled);
166
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 // These can only be called with the SET_ORIENTATION permission.
168 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700169 * Update the current screen rotation based on the current state of
170 * the world.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800171 * @param alwaysSendConfiguration Flag to force a new configuration to
172 * be evaluated. This can be used when there are other parameters in
173 * configuration that are changing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174 */
Jeff Brown01a98dd2011-09-20 15:08:29 -0700175 void updateRotation(boolean alwaysSendConfiguration);
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();
182
183 /**
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 /**
190 * Determine the preferred edge of the screen to pin the compact options menu against.
191 * @return a Gravity value for the options menu panel
192 * @hide
193 */
194 int getPreferredOptionsPanelGravity();
195
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400196 /**
Jeff Brown4dfce202011-10-05 12:00:10 -0700197 * Lock the device orientation to the specified rotation, or to the
198 * current rotation if -1. Sensor input will be ignored until
199 * thawRotation() is called.
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400200 * @hide
201 */
Jeff Brown4dfce202011-10-05 12:00:10 -0700202 void freezeRotation(int rotation);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400203
204 /**
205 * Release the orientation lock imposed by freezeRotation().
206 * @hide
207 */
208 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800209
210 /**
211 * Create a screenshot of the applications currently displayed.
212 */
Dianne Hackbornd2835932010-12-13 16:28:46 -0800213 Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight);
Joe Onorato664644d2011-01-23 17:53:23 -0800214
215 /**
216 * Called by the status bar to notify Views of changes to System UI visiblity.
217 */
218 void statusBarVisibilityChanged(int visibility);
Jeff Brown1a84fd12011-06-02 01:26:32 -0700219
220 /**
221 * Called by the settings application to temporarily set the pointer speed.
222 */
223 void setPointerSpeed(int speed);
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700224
225 /**
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700226 * Block until the given window has been drawn to the screen.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700227 */
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700228 void waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
Daniel Sandler0c4ccff2011-10-19 16:39:14 -0400229
230 /**
231 * Device has a software navigation bar (separate from the status bar).
232 */
233 boolean hasNavigationBar();
Jim Miller93c518e2012-01-17 15:55:31 -0800234
235 /**
236 * Lock the device immediately.
237 */
238 void lockNow();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239}