blob: 2c8ca8be33f0f4f9a551bb0956a4727aab5757b0 [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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.view.IApplicationToken;
25import android.view.IOnKeyguardExitResult;
26import android.view.IRotationWatcher;
27import android.view.IWindowSession;
28import android.view.KeyEvent;
Jeff Brown6ec402b2010-07-28 15:48:59 -070029import android.view.InputEvent;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.view.MotionEvent;
Jeff Browna41ca772010-08-11 14:46:32 -070031import android.view.InputChannel;
Jeff Brown8d608662010-08-30 03:02:23 -070032import android.view.InputDevice;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033
34/**
35 * System private interface to the window manager.
36 *
37 * {@hide}
38 */
39interface IWindowManager
40{
41 /**
42 * ===== NOTICE =====
43 * The first three methods must remain the first three methods. Scripts
44 * and tools rely on their transaction number to work properly.
45 */
46 // This is used for debugging
47 boolean startViewServer(int port); // Transaction #1
48 boolean stopViewServer(); // Transaction #2
49 boolean isViewServerRunning(); // Transaction #3
50
51 IWindowSession openSession(in IInputMethodClient client,
52 in IInputContext inputContext);
53 boolean inputMethodClientHasFocus(IInputMethodClient client);
54
55 // These can only be called when injecting events to your own window,
Jeff Brown6ec402b2010-07-28 15:48:59 -070056 // or by holding the INJECT_EVENTS permission. These methods may block
57 // until pending input events are finished being dispatched even when 'sync' is false.
58 // Avoid calling these methods on your UI thread or use the 'NoWait' version instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059 boolean injectKeyEvent(in KeyEvent ev, boolean sync);
60 boolean injectPointerEvent(in MotionEvent ev, boolean sync);
61 boolean injectTrackballEvent(in MotionEvent ev, boolean sync);
Jeff Brown6ec402b2010-07-28 15:48:59 -070062 boolean injectInputEventNoWait(in InputEvent ev);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063
64 // These can only be called when holding the MANAGE_APP_TOKENS permission.
65 void pauseKeyDispatching(IBinder token);
66 void resumeKeyDispatching(IBinder token);
67 void setEventDispatching(boolean enabled);
Dianne Hackborne4fbd622009-03-27 18:09:16 -070068 void addWindowToken(IBinder token, int type);
69 void removeWindowToken(IBinder token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 void addAppToken(int addPos, IApplicationToken token,
71 int groupId, int requestedOrientation, boolean fullscreen);
72 void setAppGroupId(IBinder token, int groupId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 void setAppOrientation(IApplicationToken token, int requestedOrientation);
74 int getAppOrientation(IApplicationToken token);
75 void setFocusedApp(IBinder token, boolean moveFocusNow);
Dianne Hackborn7da6ac32010-12-09 19:22:04 -080076 void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 int getPendingAppTransition();
Dianne Hackborn3b3e1452009-09-24 19:22:12 -070078 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 void executeAppTransition();
80 void setAppStartingWindow(IBinder token, String pkg, int theme,
81 CharSequence nonLocalizedLabel, int labelRes,
Dianne Hackborn7eec10e2010-11-12 18:03:47 -080082 int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 void setAppWillBeHidden(IBinder token);
84 void setAppVisibility(IBinder token, boolean visible);
85 void startAppFreezingScreen(IBinder token, int configChanges);
86 void stopAppFreezingScreen(IBinder token, boolean force);
87 void removeAppToken(IBinder token);
88 void moveAppToken(int index, IBinder token);
89 void moveAppTokensToTop(in List<IBinder> tokens);
90 void moveAppTokensToBottom(in List<IBinder> tokens);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091
Dianne Hackborne36d6e22010-02-17 19:46:25 -080092 // Re-evaluate the current orientation from the caller's state.
93 // If there is a change, the new Configuration is returned and the
94 // caller must call setNewConfiguration() sometime later.
95 Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
96 IBinder freezeThisOneIfNeeded);
97 void setNewConfiguration(in Configuration config);
98
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 // these require DISABLE_KEYGUARD permission
100 void disableKeyguard(IBinder token, String tag);
101 void reenableKeyguard(IBinder token);
102 void exitKeyguardSecurely(IOnKeyguardExitResult callback);
103 boolean inKeyguardRestrictedInputMode();
104
Dianne Hackbornffa42482009-09-23 22:20:11 -0700105 void closeSystemDialogs(String reason);
106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 // These can only be called with the SET_ANIMATON_SCALE permission.
108 float getAnimationScale(int which);
109 float[] getAnimationScales();
110 void setAnimationScale(int which, float scale);
111 void setAnimationScales(in float[] scales);
112
113 // These require the READ_INPUT_STATE permission.
114 int getSwitchState(int sw);
115 int getSwitchStateForDevice(int devid, int sw);
116 int getScancodeState(int sw);
117 int getScancodeStateForDevice(int devid, int sw);
Dianne Hackborn1d62ea92009-11-17 12:49:50 -0800118 int getTrackballScancodeState(int sw);
119 int getDPadScancodeState(int sw);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 int getKeycodeState(int sw);
121 int getKeycodeStateForDevice(int devid, int sw);
Dianne Hackborn1d62ea92009-11-17 12:49:50 -0800122 int getTrackballKeycodeState(int sw);
123 int getDPadKeycodeState(int sw);
Jeff Browna41ca772010-08-11 14:46:32 -0700124 InputChannel monitorInput(String inputChannelName);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800125
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 // Report whether the hardware supports the given keys; returns true if successful
127 boolean hasKeys(in int[] keycodes, inout boolean[] keyExists);
128
Jeff Brown8d608662010-08-30 03:02:23 -0700129 // Get input device information.
130 InputDevice getInputDevice(int deviceId);
131 int[] getInputDeviceIds();
132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 // For testing
134 void setInTouchMode(boolean showFocus);
Brad Fitzpatrick68044332010-11-22 18:19:48 -0800135
136 // For StrictMode flashing a red border on violations from the UI
137 // thread. The uid/pid is implicit from the Binder call, and the Window
138 // Manager uses that to determine whether or not the red border should
139 // actually be shown. (it will be ignored that pid doesn't have windows
140 // on screen)
141 void showStrictModeViolation(boolean on);
142
Brad Fitzpatrickc1a968a2010-11-24 08:56:40 -0800143 // Proxy to set the system property for whether the flashing
144 // should be enabled. The 'enabled' value is null or blank for
145 // the system default (differs per build variant) or any valid
146 // boolean string as parsed by SystemProperties.getBoolean().
147 void setStrictModeVisualIndicatorPreference(String enabled);
148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 // These can only be called with the SET_ORIENTATION permission.
150 /**
151 * Change the current screen rotation, constants as per
152 * {@link android.view.Surface}.
153 * @param rotation the intended rotation.
154 * @param alwaysSendConfiguration Flag to force a new configuration to
155 * be evaluated. This can be used when there are other parameters in
156 * configuration that are changing.
Dianne Hackborne4fbd622009-03-27 18:09:16 -0700157 * @param animFlags Animation flags as per {@link android.view.Surface}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158 */
Dianne Hackborne4fbd622009-03-27 18:09:16 -0700159 void setRotation(int rotation, boolean alwaysSendConfiguration, int animFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800160
161 /**
162 * Retrieve the current screen orientation, constants as per
163 * {@link android.view.Surface}.
164 */
165 int getRotation();
166
167 /**
168 * Watch the rotation of the screen. Returns the current rotation,
169 * calls back when it changes.
170 */
171 int watchRotation(IRotationWatcher watcher);
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400172
173 /**
174 * Lock the device orientation to the current rotation. Sensor input will
175 * be ignored until thawRotation() is called.
176 * @hide
177 */
178 void freezeRotation();
179
180 /**
181 * Release the orientation lock imposed by freezeRotation().
182 * @hide
183 */
184 void thawRotation();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800185
186 /**
187 * Create a screenshot of the applications currently displayed.
188 */
189 Bitmap screenshotApplications(int maxWidth, int maxHeight);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800190}