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