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