1 /* 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.CompatibilityInfo; 23 import android.content.res.Configuration; 24 import android.graphics.Bitmap; 25 import android.graphics.Point; 26 import android.graphics.Rect; 27 import android.os.Bundle; 28 import android.os.IRemoteCallback; 29 import android.view.IApplicationToken; 30 import android.view.IOnKeyguardExitResult; 31 import android.view.IRotationWatcher; 32 import android.view.IWindowSession; 33 import android.view.IWindowSessionCallback; 34 import android.view.KeyEvent; 35 import android.view.InputEvent; 36 import android.view.MagnificationSpec; 37 import android.view.MotionEvent; 38 import android.view.InputChannel; 39 import android.view.InputDevice; 40 import android.view.IInputFilter; 41 import android.view.WindowContentFrameStats; 42 43 /** 44 * System private interface to the window manager. 45 * 46 * {@hide} 47 */ 48 interface IWindowManager 49 { 50 /** 51 * ===== NOTICE ===== 52 * The first three methods must remain the first three methods. Scripts 53 * and tools rely on their transaction number to work properly. 54 */ 55 // This is used for debugging 56 boolean startViewServer(int port); // Transaction #1 57 boolean stopViewServer(); // Transaction #2 58 boolean isViewServerRunning(); // Transaction #3 59 60 IWindowSession openSession(in IWindowSessionCallback callback, in IInputMethodClient client, 61 in IInputContext inputContext); 62 boolean inputMethodClientHasFocus(IInputMethodClient client); 63 64 void getInitialDisplaySize(int displayId, out Point size); 65 void getBaseDisplaySize(int displayId, out Point size); 66 void setForcedDisplaySize(int displayId, int width, int height); 67 void clearForcedDisplaySize(int displayId); 68 int getInitialDisplayDensity(int displayId); 69 int getBaseDisplayDensity(int displayId); 70 void setForcedDisplayDensity(int displayId, int density); 71 void clearForcedDisplayDensity(int displayId); 72 73 void setOverscan(int displayId, int left, int top, int right, int bottom); 74 75 // These can only be called when holding the MANAGE_APP_TOKENS permission. 76 void pauseKeyDispatching(IBinder token); 77 void resumeKeyDispatching(IBinder token); 78 void setEventDispatching(boolean enabled); 79 void addWindowToken(IBinder token, int type); 80 void removeWindowToken(IBinder token); 81 void addAppToken(int addPos, IApplicationToken token, int groupId, int stackId, 82 int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId, 83 int configChanges, boolean voiceInteraction, boolean launchTaskBehind); 84 void setAppGroupId(IBinder token, int groupId); 85 void setAppOrientation(IApplicationToken token, int requestedOrientation); 86 int getAppOrientation(IApplicationToken token); 87 void setFocusedApp(IBinder token, boolean moveFocusNow); 88 void prepareAppTransition(int transit, boolean alwaysKeepCurrent); 89 int getPendingAppTransition(); 90 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim, 91 IRemoteCallback startedCallback); 92 void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, 93 int startHeight); 94 void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY, 95 IRemoteCallback startedCallback, boolean scaleUp); 96 void overridePendingAppTransitionAspectScaledThumb(in Bitmap srcThumb, int startX, 97 int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback, 98 boolean scaleUp); 99 void executeAppTransition(); 100 void setAppStartingWindow(IBinder token, String pkg, int theme, 101 in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, 102 int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded); 103 void setAppWillBeHidden(IBinder token); 104 void setAppVisibility(IBinder token, boolean visible); 105 void startAppFreezingScreen(IBinder token, int configChanges); 106 void stopAppFreezingScreen(IBinder token, boolean force); 107 void removeAppToken(IBinder token); 108 109 // Re-evaluate the current orientation from the caller's state. 110 // If there is a change, the new Configuration is returned and the 111 // caller must call setNewConfiguration() sometime later. 112 Configuration updateOrientationFromAppTokens(in Configuration currentConfig, 113 IBinder freezeThisOneIfNeeded); 114 void setNewConfiguration(in Configuration config); 115 116 void startFreezingScreen(int exitAnim, int enterAnim); 117 void stopFreezingScreen(); 118 119 // these require DISABLE_KEYGUARD permission 120 void disableKeyguard(IBinder token, String tag); 121 void reenableKeyguard(IBinder token); 122 void exitKeyguardSecurely(IOnKeyguardExitResult callback); 123 boolean isKeyguardLocked(); 124 boolean isKeyguardSecure(); 125 boolean inKeyguardRestrictedInputMode(); 126 void dismissKeyguard(); 127 void keyguardGoingAway(boolean disableWindowAnimations, 128 boolean keyguardGoingToNotificationShade); 129 130 void closeSystemDialogs(String reason); 131 132 // These can only be called with the SET_ANIMATON_SCALE permission. 133 float getAnimationScale(int which); 134 float[] getAnimationScales(); 135 void setAnimationScale(int which, float scale); 136 void setAnimationScales(in float[] scales); 137 138 float getCurrentAnimatorScale(); 139 140 // For testing 141 void setInTouchMode(boolean showFocus); 142 143 // For StrictMode flashing a red border on violations from the UI 144 // thread. The uid/pid is implicit from the Binder call, and the Window 145 // Manager uses that to determine whether or not the red border should 146 // actually be shown. (it will be ignored that pid doesn't have windows 147 // on screen) 148 void showStrictModeViolation(boolean on); 149 150 // Proxy to set the system property for whether the flashing 151 // should be enabled. The 'enabled' value is null or blank for 152 // the system default (differs per build variant) or any valid 153 // boolean string as parsed by SystemProperties.getBoolean(). 154 void setStrictModeVisualIndicatorPreference(String enabled); 155 156 /** 157 * Set whether screen capture is disabled for all windows of a specific user 158 */ 159 void setScreenCaptureDisabled(int userId, boolean disabled); 160 161 // These can only be called with the SET_ORIENTATION permission. 162 /** 163 * Update the current screen rotation based on the current state of 164 * the world. 165 * @param alwaysSendConfiguration Flag to force a new configuration to 166 * be evaluated. This can be used when there are other parameters in 167 * configuration that are changing. 168 * @param forceRelayout If true, the window manager will always do a relayout 169 * of its windows even if the rotation hasn't changed. 170 */ 171 void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout); 172 173 /** 174 * Retrieve the current screen orientation, constants as per 175 * {@link android.view.Surface}. 176 */ 177 int getRotation(); 178 179 /** 180 * Watch the rotation of the screen. Returns the current rotation, 181 * calls back when it changes. 182 */ 183 int watchRotation(IRotationWatcher watcher); 184 185 /** 186 * Remove a rotation watcher set using watchRotation. 187 * @hide 188 */ 189 void removeRotationWatcher(IRotationWatcher watcher); 190 191 /** 192 * Determine the preferred edge of the screen to pin the compact options menu against. 193 * @return a Gravity value for the options menu panel 194 * @hide 195 */ 196 int getPreferredOptionsPanelGravity(); 197 198 /** 199 * Lock the device orientation to the specified rotation, or to the 200 * current rotation if -1. Sensor input will be ignored until 201 * thawRotation() is called. 202 * @hide 203 */ 204 void freezeRotation(int rotation); 205 206 /** 207 * Release the orientation lock imposed by freezeRotation(). 208 * @hide 209 */ 210 void thawRotation(); 211 212 /** 213 * Gets whether the rotation is frozen. 214 * 215 * @return Whether the rotation is frozen. 216 */ 217 boolean isRotationFrozen(); 218 219 /** 220 * Create a screenshot of the applications currently displayed. 221 */ 222 Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, 223 int maxHeight, boolean force565); 224 225 /** 226 * Called by the status bar to notify Views of changes to System UI visiblity. 227 */ 228 oneway void statusBarVisibilityChanged(int visibility); 229 230 /** 231 * Device has a software navigation bar (separate from the status bar). 232 */ 233 boolean hasNavigationBar(); 234 235 /** 236 * Lock the device immediately with the specified options (can be null). 237 */ 238 void lockNow(in Bundle options); 239 240 /** 241 * Device is in safe mode. 242 */ 243 boolean isSafeModeEnabled(); 244 245 /** 246 * Enables the screen if all conditions are met. 247 */ 248 void enableScreenIfNeeded(); 249 250 /** 251 * Clears the frame statistics for a given window. 252 * 253 * @param token The window token. 254 * @return Whether the frame statistics were cleared. 255 */ 256 boolean clearWindowContentFrameStats(IBinder token); 257 258 /** 259 * Gets the content frame statistics for a given window. 260 * 261 * @param token The window token. 262 * @return The frame statistics or null if the window does not exist. 263 */ 264 WindowContentFrameStats getWindowContentFrameStats(IBinder token); 265 } 266