Dianne Hackborn | 7da6ac3 | 2010-12-09 19:22:04 -0800 | [diff] [blame] | 1 | /* |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2 | ** 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 | |
| 17 | package android.view; |
| 18 | |
| 19 | import com.android.internal.view.IInputContext; |
| 20 | import com.android.internal.view.IInputMethodClient; |
| 21 | |
Dianne Hackborn | 2f0b175 | 2011-05-31 17:59:49 -0700 | [diff] [blame] | 22 | import android.content.res.CompatibilityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | import android.content.res.Configuration; |
Dianne Hackborn | 0aae2d4 | 2010-12-07 23:51:29 -0800 | [diff] [blame] | 24 | import android.graphics.Bitmap; |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 25 | import android.graphics.Point; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.view.IApplicationToken; |
| 27 | import android.view.IOnKeyguardExitResult; |
| 28 | import android.view.IRotationWatcher; |
| 29 | import android.view.IWindowSession; |
| 30 | import android.view.KeyEvent; |
Jeff Brown | 6ec402b | 2010-07-28 15:48:59 -0700 | [diff] [blame] | 31 | import android.view.InputEvent; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | import android.view.MotionEvent; |
Jeff Brown | a41ca77 | 2010-08-11 14:46:32 -0700 | [diff] [blame] | 33 | import android.view.InputChannel; |
Jeff Brown | 8d60866 | 2010-08-30 03:02:23 -0700 | [diff] [blame] | 34 | import android.view.InputDevice; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * System private interface to the window manager. |
| 38 | * |
| 39 | * {@hide} |
| 40 | */ |
| 41 | interface IWindowManager |
| 42 | { |
| 43 | /** |
| 44 | * ===== NOTICE ===== |
| 45 | * The first three methods must remain the first three methods. Scripts |
| 46 | * and tools rely on their transaction number to work properly. |
| 47 | */ |
| 48 | // This is used for debugging |
| 49 | boolean startViewServer(int port); // Transaction #1 |
| 50 | boolean stopViewServer(); // Transaction #2 |
| 51 | boolean isViewServerRunning(); // Transaction #3 |
| 52 | |
| 53 | IWindowSession openSession(in IInputMethodClient client, |
| 54 | in IInputContext inputContext); |
| 55 | boolean inputMethodClientHasFocus(IInputMethodClient client); |
| 56 | |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 57 | void getDisplaySize(out Point size); |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 58 | void getRealDisplaySize(out Point size); |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 59 | int getMaximumSizeDimension(); |
| 60 | |
Dianne Hackborn | 7916ac6 | 2011-05-16 20:45:48 -0700 | [diff] [blame] | 61 | void setForcedDisplaySize(int longDimen, int shortDimen); |
| 62 | void clearForcedDisplaySize(); |
| 63 | |
Dianne Hackborn | 81e56d5 | 2011-05-26 00:55:58 -0700 | [diff] [blame] | 64 | // Is device configured with a hideable status bar or a tablet system bar? |
| 65 | boolean canStatusBarHide(); |
| 66 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 67 | // These can only be called when injecting events to your own window, |
Jeff Brown | 6ec402b | 2010-07-28 15:48:59 -0700 | [diff] [blame] | 68 | // or by holding the INJECT_EVENTS permission. These methods may block |
| 69 | // until pending input events are finished being dispatched even when 'sync' is false. |
| 70 | // Avoid calling these methods on your UI thread or use the 'NoWait' version instead. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 71 | boolean injectKeyEvent(in KeyEvent ev, boolean sync); |
| 72 | boolean injectPointerEvent(in MotionEvent ev, boolean sync); |
| 73 | boolean injectTrackballEvent(in MotionEvent ev, boolean sync); |
Jeff Brown | 6ec402b | 2010-07-28 15:48:59 -0700 | [diff] [blame] | 74 | boolean injectInputEventNoWait(in InputEvent ev); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | |
| 76 | // 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 Hackborn | e4fbd62 | 2009-03-27 18:09:16 -0700 | [diff] [blame] | 80 | void addWindowToken(IBinder token, int type); |
| 81 | void removeWindowToken(IBinder token); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | void addAppToken(int addPos, IApplicationToken token, |
| 83 | int groupId, int requestedOrientation, boolean fullscreen); |
| 84 | void setAppGroupId(IBinder token, int groupId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | void setAppOrientation(IApplicationToken token, int requestedOrientation); |
| 86 | int getAppOrientation(IApplicationToken token); |
| 87 | void setFocusedApp(IBinder token, boolean moveFocusNow); |
Dianne Hackborn | 7da6ac3 | 2010-12-09 19:22:04 -0800 | [diff] [blame] | 88 | void prepareAppTransition(int transit, boolean alwaysKeepCurrent); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | int getPendingAppTransition(); |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 90 | void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 91 | void executeAppTransition(); |
| 92 | void setAppStartingWindow(IBinder token, String pkg, int theme, |
Dianne Hackborn | 2f0b175 | 2011-05-31 17:59:49 -0700 | [diff] [blame] | 93 | in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, |
Dianne Hackborn | 7eec10e | 2010-11-12 18:03:47 -0800 | [diff] [blame] | 94 | int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | void setAppWillBeHidden(IBinder token); |
| 96 | void setAppVisibility(IBinder token, boolean visible); |
| 97 | void startAppFreezingScreen(IBinder token, int configChanges); |
| 98 | void stopAppFreezingScreen(IBinder token, boolean force); |
| 99 | void removeAppToken(IBinder token); |
| 100 | void moveAppToken(int index, IBinder token); |
| 101 | void moveAppTokensToTop(in List<IBinder> tokens); |
| 102 | void moveAppTokensToBottom(in List<IBinder> tokens); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 103 | |
Dianne Hackborn | e36d6e2 | 2010-02-17 19:46:25 -0800 | [diff] [blame] | 104 | // Re-evaluate the current orientation from the caller's state. |
| 105 | // If there is a change, the new Configuration is returned and the |
| 106 | // caller must call setNewConfiguration() sometime later. |
| 107 | Configuration updateOrientationFromAppTokens(in Configuration currentConfig, |
| 108 | IBinder freezeThisOneIfNeeded); |
| 109 | void setNewConfiguration(in Configuration config); |
| 110 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 111 | // these require DISABLE_KEYGUARD permission |
| 112 | void disableKeyguard(IBinder token, String tag); |
| 113 | void reenableKeyguard(IBinder token); |
| 114 | void exitKeyguardSecurely(IOnKeyguardExitResult callback); |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 115 | boolean isKeyguardLocked(); |
| 116 | boolean isKeyguardSecure(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 117 | boolean inKeyguardRestrictedInputMode(); |
| 118 | |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 119 | void closeSystemDialogs(String reason); |
| 120 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 121 | // These can only be called with the SET_ANIMATON_SCALE permission. |
| 122 | float getAnimationScale(int which); |
| 123 | float[] getAnimationScales(); |
| 124 | void setAnimationScale(int which, float scale); |
| 125 | void setAnimationScales(in float[] scales); |
| 126 | |
| 127 | // These require the READ_INPUT_STATE permission. |
| 128 | int getSwitchState(int sw); |
| 129 | int getSwitchStateForDevice(int devid, int sw); |
| 130 | int getScancodeState(int sw); |
| 131 | int getScancodeStateForDevice(int devid, int sw); |
Dianne Hackborn | 1d62ea9 | 2009-11-17 12:49:50 -0800 | [diff] [blame] | 132 | int getTrackballScancodeState(int sw); |
| 133 | int getDPadScancodeState(int sw); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 134 | int getKeycodeState(int sw); |
| 135 | int getKeycodeStateForDevice(int devid, int sw); |
Dianne Hackborn | 1d62ea9 | 2009-11-17 12:49:50 -0800 | [diff] [blame] | 136 | int getTrackballKeycodeState(int sw); |
| 137 | int getDPadKeycodeState(int sw); |
Jeff Brown | a41ca77 | 2010-08-11 14:46:32 -0700 | [diff] [blame] | 138 | InputChannel monitorInput(String inputChannelName); |
Brad Fitzpatrick | 6804433 | 2010-11-22 18:19:48 -0800 | [diff] [blame] | 139 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 140 | // Report whether the hardware supports the given keys; returns true if successful |
| 141 | boolean hasKeys(in int[] keycodes, inout boolean[] keyExists); |
| 142 | |
Jeff Brown | 8d60866 | 2010-08-30 03:02:23 -0700 | [diff] [blame] | 143 | // Get input device information. |
| 144 | InputDevice getInputDevice(int deviceId); |
| 145 | int[] getInputDeviceIds(); |
| 146 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 147 | // For testing |
| 148 | void setInTouchMode(boolean showFocus); |
Brad Fitzpatrick | 6804433 | 2010-11-22 18:19:48 -0800 | [diff] [blame] | 149 | |
| 150 | // For StrictMode flashing a red border on violations from the UI |
| 151 | // thread. The uid/pid is implicit from the Binder call, and the Window |
| 152 | // Manager uses that to determine whether or not the red border should |
| 153 | // actually be shown. (it will be ignored that pid doesn't have windows |
| 154 | // on screen) |
| 155 | void showStrictModeViolation(boolean on); |
| 156 | |
Brad Fitzpatrick | c1a968a | 2010-11-24 08:56:40 -0800 | [diff] [blame] | 157 | // Proxy to set the system property for whether the flashing |
| 158 | // should be enabled. The 'enabled' value is null or blank for |
| 159 | // the system default (differs per build variant) or any valid |
| 160 | // boolean string as parsed by SystemProperties.getBoolean(). |
| 161 | void setStrictModeVisualIndicatorPreference(String enabled); |
| 162 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 163 | // These can only be called with the SET_ORIENTATION permission. |
| 164 | /** |
| 165 | * Change the current screen rotation, constants as per |
| 166 | * {@link android.view.Surface}. |
| 167 | * @param rotation the intended rotation. |
| 168 | * @param alwaysSendConfiguration Flag to force a new configuration to |
| 169 | * be evaluated. This can be used when there are other parameters in |
| 170 | * configuration that are changing. |
Dianne Hackborn | e4fbd62 | 2009-03-27 18:09:16 -0700 | [diff] [blame] | 171 | * @param animFlags Animation flags as per {@link android.view.Surface}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 172 | */ |
Dianne Hackborn | e4fbd62 | 2009-03-27 18:09:16 -0700 | [diff] [blame] | 173 | void setRotation(int rotation, boolean alwaysSendConfiguration, int animFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 174 | |
| 175 | /** |
| 176 | * Retrieve the current screen orientation, constants as per |
| 177 | * {@link android.view.Surface}. |
| 178 | */ |
| 179 | int getRotation(); |
| 180 | |
| 181 | /** |
| 182 | * Watch the rotation of the screen. Returns the current rotation, |
| 183 | * calls back when it changes. |
| 184 | */ |
| 185 | int watchRotation(IRotationWatcher watcher); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 186 | |
Adam Powell | dfee59a | 2011-08-05 20:48:30 -0700 | [diff] [blame] | 187 | /** |
| 188 | * Determine the preferred edge of the screen to pin the compact options menu against. |
| 189 | * @return a Gravity value for the options menu panel |
| 190 | * @hide |
| 191 | */ |
| 192 | int getPreferredOptionsPanelGravity(); |
| 193 | |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 194 | /** |
| 195 | * Lock the device orientation to the current rotation. Sensor input will |
| 196 | * be ignored until thawRotation() is called. |
| 197 | * @hide |
| 198 | */ |
| 199 | void freezeRotation(); |
| 200 | |
| 201 | /** |
| 202 | * Release the orientation lock imposed by freezeRotation(). |
| 203 | * @hide |
| 204 | */ |
| 205 | void thawRotation(); |
Dianne Hackborn | 0aae2d4 | 2010-12-07 23:51:29 -0800 | [diff] [blame] | 206 | |
| 207 | /** |
| 208 | * Create a screenshot of the applications currently displayed. |
| 209 | */ |
Dianne Hackborn | d283593 | 2010-12-13 16:28:46 -0800 | [diff] [blame] | 210 | Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 211 | |
| 212 | /** |
| 213 | * Called by the status bar to notify Views of changes to System UI visiblity. |
| 214 | */ |
| 215 | void statusBarVisibilityChanged(int visibility); |
Jeff Brown | 1a84fd1 | 2011-06-02 01:26:32 -0700 | [diff] [blame] | 216 | |
| 217 | /** |
| 218 | * Called by the settings application to temporarily set the pointer speed. |
| 219 | */ |
| 220 | void setPointerSpeed(int speed); |
Dianne Hackborn | 29aae6f | 2011-08-18 18:30:09 -0700 | [diff] [blame^] | 221 | |
| 222 | /** |
| 223 | * Block until all windows the window manager knows about have been drawn. |
| 224 | */ |
| 225 | void waitForAllDrawn(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 226 | } |