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; |
Svetoslav Ganov | c9c9a48 | 2012-07-16 08:46:07 -0700 | [diff] [blame^] | 26 | import android.graphics.Rect; |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 27 | import android.os.IRemoteCallback; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | import android.view.IApplicationToken; |
| 29 | import android.view.IOnKeyguardExitResult; |
| 30 | import android.view.IRotationWatcher; |
| 31 | import android.view.IWindowSession; |
| 32 | import android.view.KeyEvent; |
Jeff Brown | 6ec402b | 2010-07-28 15:48:59 -0700 | [diff] [blame] | 33 | import android.view.InputEvent; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | import android.view.MotionEvent; |
Jeff Brown | a41ca77 | 2010-08-11 14:46:32 -0700 | [diff] [blame] | 35 | import android.view.InputChannel; |
Jeff Brown | 8d60866 | 2010-08-30 03:02:23 -0700 | [diff] [blame] | 36 | import android.view.InputDevice; |
Svetoslav Ganov | c9c9a48 | 2012-07-16 08:46:07 -0700 | [diff] [blame^] | 37 | import android.view.IInputFilter; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * System private interface to the window manager. |
| 41 | * |
| 42 | * {@hide} |
| 43 | */ |
| 44 | interface IWindowManager |
| 45 | { |
| 46 | /** |
| 47 | * ===== NOTICE ===== |
| 48 | * The first three methods must remain the first three methods. Scripts |
| 49 | * and tools rely on their transaction number to work properly. |
| 50 | */ |
| 51 | // This is used for debugging |
| 52 | boolean startViewServer(int port); // Transaction #1 |
| 53 | boolean stopViewServer(); // Transaction #2 |
| 54 | boolean isViewServerRunning(); // Transaction #3 |
| 55 | |
| 56 | IWindowSession openSession(in IInputMethodClient client, |
| 57 | in IInputContext inputContext); |
| 58 | boolean inputMethodClientHasFocus(IInputMethodClient client); |
| 59 | |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 60 | void getDisplaySize(out Point size); |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 61 | void getRealDisplaySize(out Point size); |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 62 | int getMaximumSizeDimension(); |
Dianne Hackborn | 68c33ca | 2012-04-19 14:51:25 -0700 | [diff] [blame] | 63 | void getCurrentSizeRange(out Point smallestSize, out Point largestSize); |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 64 | |
Dianne Hackborn | 7916ac6 | 2011-05-16 20:45:48 -0700 | [diff] [blame] | 65 | void setForcedDisplaySize(int longDimen, int shortDimen); |
| 66 | void clearForcedDisplaySize(); |
| 67 | |
Dianne Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 68 | // Is the device configured to have a full system bar for larger screens? |
| 69 | boolean hasSystemNavBar(); |
Dianne Hackborn | 81e56d5 | 2011-05-26 00:55:58 -0700 | [diff] [blame] | 70 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 Hackborn | e4fbd62 | 2009-03-27 18:09:16 -0700 | [diff] [blame] | 75 | void addWindowToken(IBinder token, int type); |
| 76 | void removeWindowToken(IBinder token); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | void addAppToken(int addPos, IApplicationToken token, |
| 78 | int groupId, int requestedOrientation, boolean fullscreen); |
| 79 | void setAppGroupId(IBinder token, int groupId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 80 | void setAppOrientation(IApplicationToken token, int requestedOrientation); |
| 81 | int getAppOrientation(IApplicationToken token); |
| 82 | void setFocusedApp(IBinder token, boolean moveFocusNow); |
Dianne Hackborn | 7da6ac3 | 2010-12-09 19:22:04 -0800 | [diff] [blame] | 83 | void prepareAppTransition(int transit, boolean alwaysKeepCurrent); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 84 | int getPendingAppTransition(); |
Dianne Hackborn | 8437587 | 2012-06-01 19:03:50 -0700 | [diff] [blame] | 85 | void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim, |
| 86 | IRemoteCallback startedCallback); |
Dianne Hackborn | eabfb3a | 2012-04-16 16:28:22 -0700 | [diff] [blame] | 87 | void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, |
| 88 | int startHeight); |
Dianne Hackborn | 8078d8c | 2012-03-20 11:11:26 -0700 | [diff] [blame] | 89 | void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY, |
Michael Jurka | 21385cd | 2012-05-03 10:57:31 -0700 | [diff] [blame] | 90 | IRemoteCallback startedCallback, boolean delayed); |
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(); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 118 | void dismissKeyguard(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 119 | |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 120 | void closeSystemDialogs(String reason); |
| 121 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 122 | // These can only be called with the SET_ANIMATON_SCALE permission. |
| 123 | float getAnimationScale(int which); |
| 124 | float[] getAnimationScales(); |
| 125 | void setAnimationScale(int which, float scale); |
| 126 | void setAnimationScales(in float[] scales); |
| 127 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 128 | // For testing |
| 129 | void setInTouchMode(boolean showFocus); |
Brad Fitzpatrick | 6804433 | 2010-11-22 18:19:48 -0800 | [diff] [blame] | 130 | |
| 131 | // For StrictMode flashing a red border on violations from the UI |
| 132 | // thread. The uid/pid is implicit from the Binder call, and the Window |
| 133 | // Manager uses that to determine whether or not the red border should |
| 134 | // actually be shown. (it will be ignored that pid doesn't have windows |
| 135 | // on screen) |
| 136 | void showStrictModeViolation(boolean on); |
| 137 | |
Brad Fitzpatrick | c1a968a | 2010-11-24 08:56:40 -0800 | [diff] [blame] | 138 | // Proxy to set the system property for whether the flashing |
| 139 | // should be enabled. The 'enabled' value is null or blank for |
| 140 | // the system default (differs per build variant) or any valid |
| 141 | // boolean string as parsed by SystemProperties.getBoolean(). |
| 142 | void setStrictModeVisualIndicatorPreference(String enabled); |
| 143 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 144 | // These can only be called with the SET_ORIENTATION permission. |
| 145 | /** |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 146 | * Update the current screen rotation based on the current state of |
| 147 | * the world. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 148 | * @param alwaysSendConfiguration Flag to force a new configuration to |
| 149 | * be evaluated. This can be used when there are other parameters in |
| 150 | * configuration that are changing. |
Dianne Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 151 | * @param forceRelayout If true, the window manager will always do a relayout |
| 152 | * 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] | 153 | */ |
Dianne Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 154 | void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | |
| 156 | /** |
| 157 | * Retrieve the current screen orientation, constants as per |
| 158 | * {@link android.view.Surface}. |
| 159 | */ |
| 160 | int getRotation(); |
| 161 | |
| 162 | /** |
| 163 | * Watch the rotation of the screen. Returns the current rotation, |
| 164 | * calls back when it changes. |
| 165 | */ |
| 166 | int watchRotation(IRotationWatcher watcher); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 167 | |
Adam Powell | dfee59a | 2011-08-05 20:48:30 -0700 | [diff] [blame] | 168 | /** |
| 169 | * Determine the preferred edge of the screen to pin the compact options menu against. |
| 170 | * @return a Gravity value for the options menu panel |
| 171 | * @hide |
| 172 | */ |
| 173 | int getPreferredOptionsPanelGravity(); |
| 174 | |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 175 | /** |
Jeff Brown | 4dfce20 | 2011-10-05 12:00:10 -0700 | [diff] [blame] | 176 | * Lock the device orientation to the specified rotation, or to the |
| 177 | * current rotation if -1. Sensor input will be ignored until |
| 178 | * thawRotation() is called. |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 179 | * @hide |
| 180 | */ |
Jeff Brown | 4dfce20 | 2011-10-05 12:00:10 -0700 | [diff] [blame] | 181 | void freezeRotation(int rotation); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 182 | |
| 183 | /** |
| 184 | * Release the orientation lock imposed by freezeRotation(). |
| 185 | * @hide |
| 186 | */ |
| 187 | void thawRotation(); |
Dianne Hackborn | 0aae2d4 | 2010-12-07 23:51:29 -0800 | [diff] [blame] | 188 | |
| 189 | /** |
| 190 | * Create a screenshot of the applications currently displayed. |
| 191 | */ |
Dianne Hackborn | d283593 | 2010-12-13 16:28:46 -0800 | [diff] [blame] | 192 | Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 193 | |
| 194 | /** |
| 195 | * Called by the status bar to notify Views of changes to System UI visiblity. |
| 196 | */ |
| 197 | void statusBarVisibilityChanged(int visibility); |
Jeff Brown | 1a84fd1 | 2011-06-02 01:26:32 -0700 | [diff] [blame] | 198 | |
| 199 | /** |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 200 | * Block until the given window has been drawn to the screen. |
Dianne Hackborn | 29aae6f | 2011-08-18 18:30:09 -0700 | [diff] [blame] | 201 | */ |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 202 | void waitForWindowDrawn(IBinder token, in IRemoteCallback callback); |
Daniel Sandler | 0c4ccff | 2011-10-19 16:39:14 -0400 | [diff] [blame] | 203 | |
| 204 | /** |
| 205 | * Device has a software navigation bar (separate from the status bar). |
| 206 | */ |
| 207 | boolean hasNavigationBar(); |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 208 | |
| 209 | /** |
| 210 | * Lock the device immediately. |
| 211 | */ |
| 212 | void lockNow(); |
Svetoslav Ganov | c9c9a48 | 2012-07-16 08:46:07 -0700 | [diff] [blame^] | 213 | |
| 214 | /** |
| 215 | * Gets the token for the focused window. |
| 216 | */ |
| 217 | IBinder getFocusedWindowToken(); |
| 218 | |
| 219 | /** |
| 220 | * Gets the frame on the screen of the window given its token. |
| 221 | */ |
| 222 | boolean getWindowFrame(IBinder token, out Rect outBounds); |
| 223 | |
| 224 | /** |
| 225 | * Gets the compatibility scale of e window given its token. |
| 226 | */ |
| 227 | float getWindowCompatibilityScale(IBinder windowToken); |
| 228 | |
| 229 | /** |
| 230 | * Sets an input filter for manipulating the input event stream. |
| 231 | */ |
| 232 | void setInputFilter(in IInputFilter filter); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 233 | } |