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 | ** |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 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 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 7 | ** |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 8 | ** http://www.apache.org/licenses/LICENSE-2.0 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 9 | ** |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 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 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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; |
Svetoslav Ganov | c9c9a48 | 2012-07-16 08:46:07 -0700 | [diff] [blame] | 26 | import android.graphics.Rect; |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 27 | import android.os.Bundle; |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 28 | import android.os.IRemoteCallback; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | import android.view.IApplicationToken; |
Svetoslav Ganov | 545252f | 2012-12-10 18:29:24 -0800 | [diff] [blame] | 30 | import android.view.IMagnificationCallbacks; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | import android.view.IOnKeyguardExitResult; |
| 32 | import android.view.IRotationWatcher; |
| 33 | import android.view.IWindowSession; |
| 34 | import android.view.KeyEvent; |
Jeff Brown | 6ec402b | 2010-07-28 15:48:59 -0700 | [diff] [blame] | 35 | import android.view.InputEvent; |
Svetoslav Ganov | 152e9bb | 2012-10-12 20:15:29 -0700 | [diff] [blame] | 36 | import android.view.MagnificationSpec; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | import android.view.MotionEvent; |
Jeff Brown | a41ca77 | 2010-08-11 14:46:32 -0700 | [diff] [blame] | 38 | import android.view.InputChannel; |
Jeff Brown | 8d60866 | 2010-08-30 03:02:23 -0700 | [diff] [blame] | 39 | import android.view.InputDevice; |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 40 | import android.view.IInputFilter; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * System private interface to the window manager. |
| 44 | * |
| 45 | * {@hide} |
| 46 | */ |
| 47 | interface IWindowManager |
| 48 | { |
| 49 | /** |
| 50 | * ===== NOTICE ===== |
| 51 | * The first three methods must remain the first three methods. Scripts |
| 52 | * and tools rely on their transaction number to work properly. |
| 53 | */ |
| 54 | // This is used for debugging |
| 55 | boolean startViewServer(int port); // Transaction #1 |
| 56 | boolean stopViewServer(); // Transaction #2 |
| 57 | boolean isViewServerRunning(); // Transaction #3 |
| 58 | |
| 59 | IWindowSession openSession(in IInputMethodClient client, |
| 60 | in IInputContext inputContext); |
| 61 | boolean inputMethodClientHasFocus(IInputMethodClient client); |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 62 | |
Dianne Hackborn | 672cf45 | 2013-03-26 15:24:24 -0700 | [diff] [blame] | 63 | void getInitialDisplaySize(int displayId, out Point size); |
| 64 | void getBaseDisplaySize(int displayId, out Point size); |
Jeff Brown | 43aa159 | 2012-09-10 17:36:31 -0700 | [diff] [blame] | 65 | void setForcedDisplaySize(int displayId, int width, int height); |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 66 | void clearForcedDisplaySize(int displayId); |
Dianne Hackborn | 672cf45 | 2013-03-26 15:24:24 -0700 | [diff] [blame] | 67 | int getInitialDisplayDensity(int displayId); |
| 68 | int getBaseDisplayDensity(int displayId); |
Dianne Hackborn | dde331c | 2012-08-03 14:01:57 -0700 | [diff] [blame] | 69 | void setForcedDisplayDensity(int displayId, int density); |
| 70 | void clearForcedDisplayDensity(int displayId); |
Dianne Hackborn | 7916ac6 | 2011-05-16 20:45:48 -0700 | [diff] [blame] | 71 | |
Dianne Hackborn | c652de8 | 2013-02-15 16:32:56 -0800 | [diff] [blame] | 72 | void setOverscan(int displayId, int left, int top, int right, int bottom); |
| 73 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | // These can only be called when holding the MANAGE_APP_TOKENS permission. |
| 75 | void pauseKeyDispatching(IBinder token); |
| 76 | void resumeKeyDispatching(IBinder token); |
| 77 | void setEventDispatching(boolean enabled); |
Dianne Hackborn | e4fbd62 | 2009-03-27 18:09:16 -0700 | [diff] [blame] | 78 | void addWindowToken(IBinder token, int type); |
| 79 | void removeWindowToken(IBinder token); |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 80 | void addAppToken(int addPos, IApplicationToken token, int groupId, int stackId, |
| 81 | int requestedOrientation, boolean fullscreen, boolean showWhenLocked); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | void setAppGroupId(IBinder token, int groupId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | void setAppOrientation(IApplicationToken token, int requestedOrientation); |
| 84 | int getAppOrientation(IApplicationToken token); |
| 85 | void setFocusedApp(IBinder token, boolean moveFocusNow); |
Dianne Hackborn | 7da6ac3 | 2010-12-09 19:22:04 -0800 | [diff] [blame] | 86 | void prepareAppTransition(int transit, boolean alwaysKeepCurrent); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 | int getPendingAppTransition(); |
Dianne Hackborn | 8437587 | 2012-06-01 19:03:50 -0700 | [diff] [blame] | 88 | void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim, |
| 89 | IRemoteCallback startedCallback); |
Dianne Hackborn | eabfb3a | 2012-04-16 16:28:22 -0700 | [diff] [blame] | 90 | void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, |
| 91 | int startHeight); |
Dianne Hackborn | 8078d8c | 2012-03-20 11:11:26 -0700 | [diff] [blame] | 92 | void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY, |
Michael Jurka | 832cb22 | 2012-04-13 09:32:47 -0700 | [diff] [blame] | 93 | IRemoteCallback startedCallback, boolean scaleUp); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 94 | void executeAppTransition(); |
| 95 | void setAppStartingWindow(IBinder token, String pkg, int theme, |
Dianne Hackborn | 2f0b175 | 2011-05-31 17:59:49 -0700 | [diff] [blame] | 96 | in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 97 | int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 98 | 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); |
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); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 110 | |
Dianne Hackborn | 9d9ece3 | 2012-09-10 15:33:52 -0700 | [diff] [blame] | 111 | void startFreezingScreen(int exitAnim, int enterAnim); |
| 112 | void stopFreezingScreen(); |
| 113 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 114 | // these require DISABLE_KEYGUARD permission |
| 115 | void disableKeyguard(IBinder token, String tag); |
| 116 | void reenableKeyguard(IBinder token); |
| 117 | void exitKeyguardSecurely(IOnKeyguardExitResult callback); |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 118 | boolean isKeyguardLocked(); |
| 119 | boolean isKeyguardSecure(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 120 | boolean inKeyguardRestrictedInputMode(); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 121 | void dismissKeyguard(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 122 | |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 123 | void closeSystemDialogs(String reason); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 124 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 125 | // 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); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 130 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 131 | // For testing |
| 132 | void setInTouchMode(boolean showFocus); |
Brad Fitzpatrick | 6804433 | 2010-11-22 18:19:48 -0800 | [diff] [blame] | 133 | |
| 134 | // For StrictMode flashing a red border on violations from the UI |
| 135 | // thread. The uid/pid is implicit from the Binder call, and the Window |
| 136 | // Manager uses that to determine whether or not the red border should |
| 137 | // actually be shown. (it will be ignored that pid doesn't have windows |
| 138 | // on screen) |
| 139 | void showStrictModeViolation(boolean on); |
| 140 | |
Brad Fitzpatrick | c1a968a | 2010-11-24 08:56:40 -0800 | [diff] [blame] | 141 | // Proxy to set the system property for whether the flashing |
| 142 | // should be enabled. The 'enabled' value is null or blank for |
| 143 | // the system default (differs per build variant) or any valid |
| 144 | // boolean string as parsed by SystemProperties.getBoolean(). |
| 145 | void setStrictModeVisualIndicatorPreference(String enabled); |
| 146 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 147 | // These can only be called with the SET_ORIENTATION permission. |
| 148 | /** |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 149 | * Update the current screen rotation based on the current state of |
| 150 | * the world. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 151 | * @param alwaysSendConfiguration Flag to force a new configuration to |
| 152 | * be evaluated. This can be used when there are other parameters in |
| 153 | * configuration that are changing. |
Dianne Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 154 | * @param forceRelayout If true, the window manager will always do a relayout |
| 155 | * of its windows even if the rotation hasn't changed. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 156 | */ |
Dianne Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 157 | void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 158 | |
| 159 | /** |
| 160 | * Retrieve the current screen orientation, constants as per |
| 161 | * {@link android.view.Surface}. |
| 162 | */ |
| 163 | int getRotation(); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 164 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 165 | /** |
| 166 | * Watch the rotation of the screen. Returns the current rotation, |
| 167 | * calls back when it changes. |
| 168 | */ |
| 169 | int watchRotation(IRotationWatcher watcher); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 170 | |
Adam Powell | dfee59a | 2011-08-05 20:48:30 -0700 | [diff] [blame] | 171 | /** |
Brian Colonna | b1b9a8a | 2013-03-29 11:52:42 -0400 | [diff] [blame] | 172 | * Remove a rotation watcher set using watchRotation. |
| 173 | * @hide |
| 174 | */ |
| 175 | void removeRotationWatcher(IRotationWatcher watcher); |
| 176 | |
| 177 | /** |
Adam Powell | dfee59a | 2011-08-05 20:48:30 -0700 | [diff] [blame] | 178 | * Determine the preferred edge of the screen to pin the compact options menu against. |
| 179 | * @return a Gravity value for the options menu panel |
| 180 | * @hide |
| 181 | */ |
| 182 | int getPreferredOptionsPanelGravity(); |
| 183 | |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 184 | /** |
| 185 | * Lock the device orientation to the specified rotation, or to the |
| 186 | * current rotation if -1. Sensor input will be ignored until |
| 187 | * thawRotation() is called. |
| 188 | * @hide |
| 189 | */ |
| 190 | void freezeRotation(int rotation); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 191 | |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 192 | /** |
| 193 | * Release the orientation lock imposed by freezeRotation(). |
| 194 | * @hide |
| 195 | */ |
| 196 | void thawRotation(); |
Dianne Hackborn | 0aae2d4 | 2010-12-07 23:51:29 -0800 | [diff] [blame] | 197 | |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 198 | /** |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 199 | * Gets whether the rotation is frozen. |
| 200 | * |
| 201 | * @return Whether the rotation is frozen. |
| 202 | */ |
| 203 | boolean isRotationFrozen(); |
| 204 | |
| 205 | /** |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 206 | * Create a screenshot of the applications currently displayed. |
| 207 | */ |
| 208 | Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 209 | |
| 210 | /** |
| 211 | * Called by the status bar to notify Views of changes to System UI visiblity. |
| 212 | */ |
| 213 | void statusBarVisibilityChanged(int visibility); |
Jeff Brown | 1a84fd1 | 2011-06-02 01:26:32 -0700 | [diff] [blame] | 214 | |
| 215 | /** |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 216 | * Block until the given window has been drawn to the screen. |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 217 | * Returns true if really waiting, false if the window does not exist. |
Dianne Hackborn | 29aae6f | 2011-08-18 18:30:09 -0700 | [diff] [blame] | 218 | */ |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 219 | boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback); |
Daniel Sandler | 0c4ccff | 2011-10-19 16:39:14 -0400 | [diff] [blame] | 220 | |
| 221 | /** |
| 222 | * Device has a software navigation bar (separate from the status bar). |
| 223 | */ |
| 224 | boolean hasNavigationBar(); |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 225 | |
| 226 | /** |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 227 | * Lock the device immediately with the specified options (can be null). |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 228 | */ |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 229 | void lockNow(in Bundle options); |
Svetoslav Ganov | c9c9a48 | 2012-07-16 08:46:07 -0700 | [diff] [blame] | 230 | |
| 231 | /** |
| 232 | * Gets the token for the focused window. |
| 233 | */ |
| 234 | IBinder getFocusedWindowToken(); |
| 235 | |
| 236 | /** |
Svetoslav Ganov | c9c9a48 | 2012-07-16 08:46:07 -0700 | [diff] [blame] | 237 | * Sets an input filter for manipulating the input event stream. |
| 238 | */ |
| 239 | void setInputFilter(in IInputFilter filter); |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 240 | |
| 241 | /** |
Svetoslav Ganov | 152e9bb | 2012-10-12 20:15:29 -0700 | [diff] [blame] | 242 | * Gets the frame of a window given its token. |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 243 | */ |
Svetoslav Ganov | 152e9bb | 2012-10-12 20:15:29 -0700 | [diff] [blame] | 244 | void getWindowFrame(IBinder token, out Rect outFrame); |
Jim Miller | bfec0a8 | 2012-11-05 20:05:22 -0800 | [diff] [blame] | 245 | |
| 246 | /** |
| 247 | * Device is in safe mode. |
| 248 | */ |
| 249 | boolean isSafeModeEnabled(); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 250 | |
| 251 | /** |
| 252 | * Tell keyguard to show the assistant (Intent.ACTION_ASSIST) after asking for the user's |
| 253 | * credentials. |
| 254 | */ |
| 255 | void showAssistant(); |
Svetoslav Ganov | 545252f | 2012-12-10 18:29:24 -0800 | [diff] [blame] | 256 | |
| 257 | /** |
| 258 | * Sets the display magnification callbacks. These callbacks notify |
| 259 | * the client for contextual changes related to display magnification. |
| 260 | * |
| 261 | * @param callbacks The magnification callbacks. |
| 262 | */ |
| 263 | void setMagnificationCallbacks(IMagnificationCallbacks callbacks); |
| 264 | |
| 265 | /** |
| 266 | * Sets the magnification spec to be applied to all windows that can be |
| 267 | * magnified. |
| 268 | * |
| 269 | * @param spec The current magnification spec. |
| 270 | */ |
| 271 | void setMagnificationSpec(in MagnificationSpec spec); |
| 272 | |
| 273 | /** |
| 274 | * Gets the magnification spec for a window given its token. If the |
| 275 | * window has a compatibility scale it is also folded in the returned |
| 276 | * magnification spec. |
| 277 | * |
| 278 | * @param windowToken The unique window token. |
| 279 | * @return The magnification spec if such or null. |
| 280 | */ |
| 281 | MagnificationSpec getCompatibleMagnificationSpecForWindow(in IBinder windowToken); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 282 | } |