blob: adafb59aac3a475c8c4081a01433d0c11bdf5f24 [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
22import android.content.res.Configuration;
Dianne Hackborn0aae2d42010-12-07 23:51:29 -080023import android.graphics.Bitmap;
Dianne Hackbornac8dea12011-04-20 18:18:51 -070024import android.graphics.Point;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.view.IApplicationToken;
26import android.view.IOnKeyguardExitResult;
27import android.view.IRotationWatcher;
28import android.view.IWindowSession;
29import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070030import android.view.InputEvent;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070032import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070033import android.view.InputDevice;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034
35/**
36 * System private interface to the window manager.
37 *
38 * {@hide}
39 */
40interface IWindowManager
41{
42 /**
43 * ===== NOTICE =====
44 * The first three methods must remain the first three methods. Scripts
45 * and tools rely on their transaction number to work properly.
46 */
47 // This is used for debugging
48 boolean startViewServer(int port); // Transaction #1
49 boolean stopViewServer(); // Transaction #2
50 boolean isViewServerRunning(); // Transaction #3
51
52 IWindowSession openSession(in IInputMethodClient client,
53 in IInputContext inputContext);
54 boolean inputMethodClientHasFocus(IInputMethodClient client);
55
Dianne Hackbornac8dea12011-04-20 18:18:51 -070056 void getDisplaySize(out Point size);
57 int getMaximumSizeDimension();
58
Dianne Hackborn7916ac62011-05-16 20:45:48 -070059 void setForcedDisplaySize(int longDimen, int shortDimen);
60 void clearForcedDisplaySize();
61
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062 // These can only be called when injecting events to your own window,
Jeff Brown6ec402b2010-07-28 15:48:59 -070063 // or by holding the INJECT_EVENTS permission. These methods may block
64 // until pending input events are finished being dispatched even when 'sync' is false.
65 // Avoid calling these methods on your UI thread or use the 'NoWait' version instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 boolean injectKeyEvent(in KeyEvent ev, boolean sync);
67 boolean injectPointerEvent(in MotionEvent ev, boolean sync);
68 boolean injectTrackballEvent(in MotionEvent ev, boolean sync);
Jeff Brown6ec402b2010-07-28 15:48:59 -070069 boolean injectInputEventNoWait(in InputEvent ev);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070
71 // These can only be called when holding the MANAGE_APP_TOKENS permission.
72 void pauseKeyDispatching(IBinder token);
73 void resumeKeyDispatching(IBinder token);
74 void setEventDispatching(boolean enabled);
Dianne Hackborne4fbd622009-03-27 18:09:16 -070075 void addWindowToken(IBinder token, int type);
76 void removeWindowToken(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 void addAppToken(int addPos, IApplicationToken token,
78 int groupId, int requestedOrientation, boolean fullscreen);
79 void setAppGroupId(IBinder token, int groupId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 void setAppOrientation(IApplicationToken token, int requestedOrientation);
81 int getAppOrientation(IApplicationToken token);
82 void setFocusedApp(IBinder token, boolean moveFocusNow);
Dianne Hackborn7da6ac32010-12-09 19:22:04 -080083 void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084 int getPendingAppTransition();
Dianne Hackborn3b3e1452009-09-24 19:22:12 -070085 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 void executeAppTransition();
87 void setAppStartingWindow(IBinder token, String pkg, int theme,
88 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();
113
Dianne Hackbornffa42482009-09-23 22:20:11 -0700114 void closeSystemDialogs(String reason);
115
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 // These can only be called with the SET_ANIMATON_SCALE permission.
117 float getAnimationScale(int which);
118 float[] getAnimationScales();
119 void setAnimationScale(int which, float scale);
120 void setAnimationScales(in float[] scales);
121
122 // These require the READ_INPUT_STATE permission.
123 int getSwitchState(int sw);
124 int getSwitchStateForDevice(int devid, int sw);
125 int getScancodeState(int sw);
126 int getScancodeStateForDevice(int devid, int sw);
Dianne Hackborn1d62ea92009-11-17 12:49:50 -0800127 int getTrackballScancodeState(int sw);
128 int getDPadScancodeState(int sw);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 int getKeycodeState(int sw);
130 int getKeycodeStateForDevice(int devid, int sw);
Dianne Hackborn1d62ea92009-11-17 12:49:50 -0800131 int getTrackballKeycodeState(int sw);
132 int getDPadKeycodeState(int sw);
Jeff Browna41ca772010-08-11 14:46:32 -0700133 InputChannel monitorInput(String inputChannelName);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 // Report whether the hardware supports the given keys; returns true if successful
136 boolean hasKeys(in int[] keycodes, inout boolean[] keyExists);
137
Jeff Brown8d608662010-08-30 03:02:23 -0700138 // Get input device information.
139 InputDevice getInputDevice(int deviceId);
140 int[] getInputDeviceIds();
141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 // For testing
143 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800144
145 // For StrictMode flashing a red border on violations from the UI
146 // thread. The uid/pid is implicit from the Binder call, and the Window
147 // Manager uses that to determine whether or not the red border should
148 // actually be shown. (it will be ignored that pid doesn't have windows
149 // on screen)
150 void showStrictModeViolation(boolean on);
151
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800152 // Proxy to set the system property for whether the flashing
153 // should be enabled. The 'enabled' value is null or blank for
154 // the system default (differs per build variant) or any valid
155 // boolean string as parsed by SystemProperties.getBoolean().
156 void setStrictModeVisualIndicatorPreference(String enabled);
157
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158 // These can only be called with the SET_ORIENTATION permission.
159 /**
160 * Change the current screen rotation, constants as per
161 * {@link android.view.Surface}.
162 * @param rotation the intended rotation.
163 * @param alwaysSendConfiguration Flag to force a new configuration to
164 * be evaluated. This can be used when there are other parameters in
165 * configuration that are changing.
Dianne Hackborne4fbd622009-03-27 18:09:16 -0700166 * @param animFlags Animation flags as per {@link android.view.Surface}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 */
Dianne Hackborne4fbd622009-03-27 18:09:16 -0700168 void setRotation(int rotation, boolean alwaysSendConfiguration, int animFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800169
170 /**
171 * Retrieve the current screen orientation, constants as per
172 * {@link android.view.Surface}.
173 */
174 int getRotation();
175
176 /**
177 * Watch the rotation of the screen. Returns the current rotation,
178 * calls back when it changes.
179 */
180 int watchRotation(IRotationWatcher watcher);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400181
182 /**
183 * Lock the device orientation to the current rotation. Sensor input will
184 * be ignored until thawRotation() is called.
185 * @hide
186 */
187 void freezeRotation();
188
189 /**
190 * Release the orientation lock imposed by freezeRotation().
191 * @hide
192 */
193 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800194
195 /**
196 * Create a screenshot of the applications currently displayed.
197 */
Dianne Hackbornd2835932010-12-13 16:28:46 -0800198 Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight);
Joe Onorato664644d2011-01-23 17:53:23 -0800199
200 /**
201 * Called by the status bar to notify Views of changes to System UI visiblity.
202 */
203 void statusBarVisibilityChanged(int visibility);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800204}