• 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.IDisplayContentChangeListener;
31 import android.view.IOnKeyguardExitResult;
32 import android.view.IRotationWatcher;
33 import android.view.IWindowSession;
34 import android.view.KeyEvent;
35 import android.view.InputEvent;
36 import android.view.MotionEvent;
37 import android.view.InputChannel;
38 import android.view.InputDevice;
39 import android.view.IInputFilter;
40 import android.view.WindowInfo;
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
startViewServer(int port)55     boolean startViewServer(int port);   // Transaction #1
stopViewServer()56     boolean stopViewServer();            // Transaction #2
isViewServerRunning()57     boolean isViewServerRunning();       // Transaction #3
58 
openSession(in IInputMethodClient client, in IInputContext inputContext)59     IWindowSession openSession(in IInputMethodClient client,
60             in IInputContext inputContext);
inputMethodClientHasFocus(IInputMethodClient client)61     boolean inputMethodClientHasFocus(IInputMethodClient client);
62 
setForcedDisplaySize(int displayId, int width, int height)63     void setForcedDisplaySize(int displayId, int width, int height);
clearForcedDisplaySize(int displayId)64     void clearForcedDisplaySize(int displayId);
setForcedDisplayDensity(int displayId, int density)65     void setForcedDisplayDensity(int displayId, int density);
clearForcedDisplayDensity(int displayId)66     void clearForcedDisplayDensity(int displayId);
67 
68     // Is the device configured to have a full system bar for larger screens?
hasSystemNavBar()69     boolean hasSystemNavBar();
70 
71     // These can only be called when holding the MANAGE_APP_TOKENS permission.
pauseKeyDispatching(IBinder token)72     void pauseKeyDispatching(IBinder token);
resumeKeyDispatching(IBinder token)73     void resumeKeyDispatching(IBinder token);
setEventDispatching(boolean enabled)74     void setEventDispatching(boolean enabled);
addWindowToken(IBinder token, int type)75     void addWindowToken(IBinder token, int type);
removeWindowToken(IBinder token)76     void removeWindowToken(IBinder token);
addAppToken(int addPos, int userId, IApplicationToken token, int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked)77     void addAppToken(int addPos, int userId, IApplicationToken token,
78             int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
setAppGroupId(IBinder token, int groupId)79     void setAppGroupId(IBinder token, int groupId);
setAppOrientation(IApplicationToken token, int requestedOrientation)80     void setAppOrientation(IApplicationToken token, int requestedOrientation);
getAppOrientation(IApplicationToken token)81     int getAppOrientation(IApplicationToken token);
setFocusedApp(IBinder token, boolean moveFocusNow)82     void setFocusedApp(IBinder token, boolean moveFocusNow);
prepareAppTransition(int transit, boolean alwaysKeepCurrent)83     void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
getPendingAppTransition()84     int getPendingAppTransition();
overridePendingAppTransition(String packageName, int enterAnim, int exitAnim, IRemoteCallback startedCallback)85     void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
86             IRemoteCallback startedCallback);
overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, int startHeight)87     void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
88             int startHeight);
overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY, IRemoteCallback startedCallback, boolean scaleUp)89     void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
90             IRemoteCallback startedCallback, boolean scaleUp);
executeAppTransition()91     void executeAppTransition();
setAppStartingWindow(IBinder token, String pkg, int theme, in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded)92     void setAppStartingWindow(IBinder token, String pkg, int theme,
93             in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
94             int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
setAppWillBeHidden(IBinder token)95     void setAppWillBeHidden(IBinder token);
setAppVisibility(IBinder token, boolean visible)96     void setAppVisibility(IBinder token, boolean visible);
startAppFreezingScreen(IBinder token, int configChanges)97     void startAppFreezingScreen(IBinder token, int configChanges);
stopAppFreezingScreen(IBinder token, boolean force)98     void stopAppFreezingScreen(IBinder token, boolean force);
removeAppToken(IBinder token)99     void removeAppToken(IBinder token);
moveAppToken(int index, IBinder token)100     void moveAppToken(int index, IBinder token);
moveAppTokensToTop(in List<IBinder> tokens)101     void moveAppTokensToTop(in List<IBinder> tokens);
moveAppTokensToBottom(in List<IBinder> tokens)102     void moveAppTokensToBottom(in List<IBinder> tokens);
103 
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.
updateOrientationFromAppTokens(in Configuration currentConfig, IBinder freezeThisOneIfNeeded)107     Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
108             IBinder freezeThisOneIfNeeded);
setNewConfiguration(in Configuration config)109     void setNewConfiguration(in Configuration config);
110 
startFreezingScreen(int exitAnim, int enterAnim)111     void startFreezingScreen(int exitAnim, int enterAnim);
stopFreezingScreen()112     void stopFreezingScreen();
113 
114     // these require DISABLE_KEYGUARD permission
disableKeyguard(IBinder token, String tag)115     void disableKeyguard(IBinder token, String tag);
reenableKeyguard(IBinder token)116     void reenableKeyguard(IBinder token);
exitKeyguardSecurely(IOnKeyguardExitResult callback)117     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
isKeyguardLocked()118     boolean isKeyguardLocked();
isKeyguardSecure()119     boolean isKeyguardSecure();
inKeyguardRestrictedInputMode()120     boolean inKeyguardRestrictedInputMode();
dismissKeyguard()121     void dismissKeyguard();
122 
closeSystemDialogs(String reason)123     void closeSystemDialogs(String reason);
124 
125     // These can only be called with the SET_ANIMATON_SCALE permission.
getAnimationScale(int which)126     float getAnimationScale(int which);
getAnimationScales()127     float[] getAnimationScales();
setAnimationScale(int which, float scale)128     void setAnimationScale(int which, float scale);
setAnimationScales(in float[] scales)129     void setAnimationScales(in float[] scales);
130 
131     // For testing
setInTouchMode(boolean showFocus)132     void setInTouchMode(boolean showFocus);
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)
showStrictModeViolation(boolean on)139     void showStrictModeViolation(boolean on);
140 
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().
setStrictModeVisualIndicatorPreference(String enabled)145     void setStrictModeVisualIndicatorPreference(String enabled);
146 
147     // These can only be called with the SET_ORIENTATION permission.
148     /**
149      * Update the current screen rotation based on the current state of
150      * the world.
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.
154      * @param forceRelayout If true, the window manager will always do a relayout
155      * of its windows even if the rotation hasn't changed.
156      */
updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout)157     void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
158 
159     /**
160      * Retrieve the current screen orientation, constants as per
161      * {@link android.view.Surface}.
162      */
getRotation()163     int getRotation();
164 
165     /**
166      * Watch the rotation of the screen.  Returns the current rotation,
167      * calls back when it changes.
168      */
watchRotation(IRotationWatcher watcher)169     int watchRotation(IRotationWatcher watcher);
170 
171     /**
172      * Determine the preferred edge of the screen to pin the compact options menu against.
173      * @return a Gravity value for the options menu panel
174      * @hide
175      */
getPreferredOptionsPanelGravity()176     int getPreferredOptionsPanelGravity();
177 
178     /**
179      * Lock the device orientation to the specified rotation, or to the
180      * current rotation if -1.  Sensor input will be ignored until
181      * thawRotation() is called.
182      * @hide
183      */
freezeRotation(int rotation)184     void freezeRotation(int rotation);
185 
186     /**
187      * Release the orientation lock imposed by freezeRotation().
188      * @hide
189      */
thawRotation()190     void thawRotation();
191 
192     /**
193      * Create a screenshot of the applications currently displayed.
194      */
screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight)195     Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
196 
197     /**
198      * Called by the status bar to notify Views of changes to System UI visiblity.
199      */
statusBarVisibilityChanged(int visibility)200     void statusBarVisibilityChanged(int visibility);
201 
202     /**
203      * Block until the given window has been drawn to the screen.
204      * Returns true if really waiting, false if the window does not exist.
205      */
waitForWindowDrawn(IBinder token, in IRemoteCallback callback)206     boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
207 
208     /**
209      * Device has a software navigation bar (separate from the status bar).
210      */
hasNavigationBar()211     boolean hasNavigationBar();
212 
213     /**
214      * Lock the device immediately with the specified options (can be null).
215      */
lockNow(in Bundle options)216     void lockNow(in Bundle options);
217 
218     /**
219      * Gets the token for the focused window.
220      */
getFocusedWindowToken()221     IBinder getFocusedWindowToken();
222 
223     /**
224      * Gets the compatibility scale of e window given its token.
225      */
getWindowCompatibilityScale(IBinder windowToken)226     float getWindowCompatibilityScale(IBinder windowToken);
227 
228     /**
229      * Sets an input filter for manipulating the input event stream.
230      */
setInputFilter(in IInputFilter filter)231     void setInputFilter(in IInputFilter filter);
232 
233     /**
234      * Sets the scale and offset for implementing accessibility magnification.
235      */
magnifyDisplay(int dipslayId, float scale, float offsetX, float offsetY)236     void magnifyDisplay(int dipslayId, float scale, float offsetX, float offsetY);
237 
238     /**
239      * Adds a listener for display content changes.
240      */
addDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener)241     void addDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener);
242 
243     /**
244      * Removes a listener for display content changes.
245      */
removeDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener)246     void removeDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener);
247 
248     /**
249      * Gets the info for a window given its token.
250      */
getWindowInfo(IBinder token)251     WindowInfo getWindowInfo(IBinder token);
252 
253     /**
254      * Gets the infos for all visible windows.
255      */
getVisibleWindowsForDisplay(int displayId, out List<WindowInfo> outInfos)256     void getVisibleWindowsForDisplay(int displayId, out List<WindowInfo> outInfos);
257 
258     /**
259      * Device is in safe mode.
260      */
isSafeModeEnabled()261     boolean isSafeModeEnabled();
262 
263     /**
264      * Tell keyguard to show the assistant (Intent.ACTION_ASSIST) after asking for the user's
265      * credentials.
266      */
showAssistant()267     void showAssistant();
268 }
269