• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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);
executeAppTransition()99     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)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);
setAppWillBeHidden(IBinder token)103     void setAppWillBeHidden(IBinder token);
setAppVisibility(IBinder token, boolean visible)104     void setAppVisibility(IBinder token, boolean visible);
startAppFreezingScreen(IBinder token, int configChanges)105     void startAppFreezingScreen(IBinder token, int configChanges);
stopAppFreezingScreen(IBinder token, boolean force)106     void stopAppFreezingScreen(IBinder token, boolean force);
removeAppToken(IBinder token)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.
updateOrientationFromAppTokens(in Configuration currentConfig, IBinder freezeThisOneIfNeeded)112     Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
113             IBinder freezeThisOneIfNeeded);
setNewConfiguration(in Configuration config)114     void setNewConfiguration(in Configuration config);
115 
startFreezingScreen(int exitAnim, int enterAnim)116     void startFreezingScreen(int exitAnim, int enterAnim);
stopFreezingScreen()117     void stopFreezingScreen();
118 
119     // these require DISABLE_KEYGUARD permission
disableKeyguard(IBinder token, String tag)120     void disableKeyguard(IBinder token, String tag);
reenableKeyguard(IBinder token)121     void reenableKeyguard(IBinder token);
exitKeyguardSecurely(IOnKeyguardExitResult callback)122     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
isKeyguardLocked()123     boolean isKeyguardLocked();
isKeyguardSecure()124     boolean isKeyguardSecure();
inKeyguardRestrictedInputMode()125     boolean inKeyguardRestrictedInputMode();
dismissKeyguard()126     void dismissKeyguard();
keyguardGoingAway(boolean disableWindowAnimations, boolean keyguardGoingToNotificationShade)127     void keyguardGoingAway(boolean disableWindowAnimations,
128             boolean keyguardGoingToNotificationShade);
129 
closeSystemDialogs(String reason)130     void closeSystemDialogs(String reason);
131 
132     // These can only be called with the SET_ANIMATON_SCALE permission.
getAnimationScale(int which)133     float getAnimationScale(int which);
getAnimationScales()134     float[] getAnimationScales();
setAnimationScale(int which, float scale)135     void setAnimationScale(int which, float scale);
setAnimationScales(in float[] scales)136     void setAnimationScales(in float[] scales);
137 
getCurrentAnimatorScale()138     float getCurrentAnimatorScale();
139 
140     // For testing
setInTouchMode(boolean showFocus)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)
showStrictModeViolation(boolean on)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().
setStrictModeVisualIndicatorPreference(String enabled)154     void setStrictModeVisualIndicatorPreference(String enabled);
155 
156     /**
157      * Set whether screen capture is disabled for all windows of a specific user
158      */
setScreenCaptureDisabled(int userId, boolean disabled)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      */
updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout)171     void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
172 
173     /**
174      * Retrieve the current screen orientation, constants as per
175      * {@link android.view.Surface}.
176      */
getRotation()177     int getRotation();
178 
179     /**
180      * Watch the rotation of the screen.  Returns the current rotation,
181      * calls back when it changes.
182      */
watchRotation(IRotationWatcher watcher)183     int watchRotation(IRotationWatcher watcher);
184 
185     /**
186      * Remove a rotation watcher set using watchRotation.
187      * @hide
188      */
removeRotationWatcher(IRotationWatcher watcher)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      */
getPreferredOptionsPanelGravity()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      */
freezeRotation(int rotation)204     void freezeRotation(int rotation);
205 
206     /**
207      * Release the orientation lock imposed by freezeRotation().
208      * @hide
209      */
thawRotation()210     void thawRotation();
211 
212     /**
213      * Gets whether the rotation is frozen.
214      *
215      * @return Whether the rotation is frozen.
216      */
isRotationFrozen()217     boolean isRotationFrozen();
218 
219     /**
220      * Create a screenshot of the applications currently displayed.
221      */
screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight, boolean force565)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      */
statusBarVisibilityChanged(int visibility)228     oneway void statusBarVisibilityChanged(int visibility);
229 
230     /**
231      * Device has a software navigation bar (separate from the status bar).
232      */
hasNavigationBar()233     boolean hasNavigationBar();
234 
235     /**
236      * Lock the device immediately with the specified options (can be null).
237      */
lockNow(in Bundle options)238     void lockNow(in Bundle options);
239 
240     /**
241      * Device is in safe mode.
242      */
isSafeModeEnabled()243     boolean isSafeModeEnabled();
244 
245     /**
246      * Enables the screen if all conditions are met.
247      */
enableScreenIfNeeded()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      */
clearWindowContentFrameStats(IBinder token)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      */
getWindowContentFrameStats(IBinder token)264     WindowContentFrameStats getWindowContentFrameStats(IBinder token);
265 }
266