public class PhoneWindowManager extends Object implements WindowManagerPolicy
WindowManagerPolicy.InputConsumer, WindowManagerPolicy.OnKeyguardExitResult, WindowManagerPolicy.PointerEventListener, WindowManagerPolicy.ScreenOnListener, WindowManagerPolicy.UserRotationMode, WindowManagerPolicy.WindowManagerFuncs, WindowManagerPolicy.WindowState
Modifier and Type | Field and Description |
---|---|
static String |
SYSTEM_DIALOG_REASON_ASSIST |
static String |
SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS |
static String |
SYSTEM_DIALOG_REASON_HOME_KEY |
static String |
SYSTEM_DIALOG_REASON_KEY |
static String |
SYSTEM_DIALOG_REASON_RECENT_APPS |
static int |
TOAST_WINDOW_TIMEOUT
Amount of time (in milliseconds) a toast window can be shown.
|
ACTION_HDMI_PLUGGED, ACTION_PASS_TO_USER, EXTRA_FROM_HOME_KEY, EXTRA_HDMI_PLUGGED_STATE, FINISH_LAYOUT_REDO_ANIM, FINISH_LAYOUT_REDO_CONFIG, FINISH_LAYOUT_REDO_LAYOUT, FINISH_LAYOUT_REDO_WALLPAPER, FLAG_DISABLE_KEY_REPEAT, FLAG_FILTERED, FLAG_INJECTED, FLAG_INTERACTIVE, FLAG_PASS_TO_USER, FLAG_TRUSTED, FLAG_VIRTUAL, FLAG_WAKE, KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS, KEYGUARD_GOING_AWAY_FLAG_TO_SHADE, KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER, OFF_BECAUSE_OF_ADMIN, OFF_BECAUSE_OF_TIMEOUT, OFF_BECAUSE_OF_USER, PRESENCE_EXTERNAL, PRESENCE_INTERNAL, TRANSIT_ENTER, TRANSIT_EXIT, TRANSIT_HIDE, TRANSIT_PREVIEW_DONE, TRANSIT_SHOW, USER_ROTATION_FREE, USER_ROTATION_LOCKED, WATCH_POINTER
Constructor and Description |
---|
PhoneWindowManager() |
Modifier and Type | Method and Description |
---|---|
View |
addStartingWindow(IBinder appToken,
String packageName,
int theme,
CompatibilityInfo compatInfo,
CharSequence nonLocalizedLabel,
int labelRes,
int icon,
int logo,
int windowFlags,
Configuration overrideConfig)
Called when the system would like to show a UI to indicate that an
application is starting.
|
void |
adjustConfigurationLw(Configuration config,
int keyboardPresence,
int navigationPresence)
After the window manager has computed the current configuration based
on its knowledge of the display and input devices, it gives the policy
a chance to adjust the information contained in it.
|
int |
adjustSystemUiVisibilityLw(int visibility)
Called when a new system UI visibility is being reported, allowing
the policy to adjust what is actually reported.
|
void |
adjustWindowParamsLw(WindowManager.LayoutParams attrs)
Sanitize the layout parameters coming from a client.
|
boolean |
allowAppAnimationsLw()
Return true if it is okay to perform animations for an app transition
that is about to occur.
|
void |
applyPostLayoutPolicyLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs,
WindowManagerPolicy.WindowState attached)
Called following layout of all window to apply policy to each window.
|
void |
beginLayoutLw(boolean isDefaultDisplay,
int displayWidth,
int displayHeight,
int displayRotation,
int uiMode)
Called when layout of the windows is about to start.
|
void |
beginPostLayoutPolicyLw(int displayWidth,
int displayHeight)
Called following layout of all windows before each window has policy applied.
|
boolean |
canBeForceHidden(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs)
Determine if a window that is behind one that is force hiding
(as determined by
WindowManagerPolicy.isForceHiding(android.view.WindowManager.LayoutParams) ) should actually be hidden. |
boolean |
canMagnifyWindow(int windowType)
Returns whether a given window type can be magnified.
|
boolean |
canShowDismissingWindowWhileLockedLw() |
int |
checkAddPermission(WindowManager.LayoutParams attrs,
int[] outAppOp)
Check permissions when adding a window.
|
boolean |
checkShowToOwnerOnly(WindowManager.LayoutParams attrs)
Check permissions when adding a window.
|
Animation |
createForceHideEnterAnimation(boolean onWallpaper,
boolean goingToNotificationShade)
Create and return an animation to re-display a force hidden window.
|
Animation |
createForceHideWallpaperExitAnimation(boolean goingToNotificationShade)
Create and return an animation to let the wallpaper disappear after being shown on a force
hiding window.
|
void |
dismissKeyguardLw()
Ask the policy to dismiss the keyguard, if it is currently shown.
|
KeyEvent |
dispatchUnhandledKey(WindowManagerPolicy.WindowState win,
KeyEvent event,
int policyFlags)
Called from the input dispatcher thread when an application did not handle
a key that was dispatched to it.
|
void |
dump(String prefix,
PrintWriter pw,
String[] args)
Print the WindowManagerPolicy's state into the given stream.
|
void |
enableKeyguard(boolean enabled)
Tell the policy if anyone is requesting that keyguard not come on.
|
void |
enableScreenAfterBoot()
Called when we have finished booting and can now display the home
screen to the user.
|
void |
exitKeyguardSecurely(WindowManagerPolicy.OnKeyguardExitResult callback)
Tell the policy if anyone is requesting the keyguard to exit securely
(this would be called after the keyguard was disabled)
|
void |
finishedGoingToSleep(int why)
Called when the device has finished going to sleep.
|
void |
finishedWakingUp()
Called when the device has finished waking up.
|
void |
finishLayoutLw()
Called when layout of the windows is finished.
|
int |
finishPostLayoutPolicyLw()
Called following layout of all windows and after policy has been applied
to each window.
|
int |
focusChangedLw(WindowManagerPolicy.WindowState lastFocus,
WindowManagerPolicy.WindowState newFocus)
A new window has been focused.
|
int |
getConfigDisplayHeight(int fullWidth,
int fullHeight,
int rotation,
int uiMode)
Return the available screen height that we should report for the
configuration.
|
int |
getConfigDisplayWidth(int fullWidth,
int fullHeight,
int rotation,
int uiMode)
Return the available screen width that we should report for the
configuration.
|
void |
getContentRectLw(Rect r)
Return the rectangle of the screen that is available for applications to run in.
|
int |
getInputMethodWindowVisibleHeightLw() |
boolean |
getInsetHintLw(WindowManager.LayoutParams attrs,
Rect taskBounds,
int displayRotation,
int displayWidth,
int displayHeight,
Rect outContentInsets,
Rect outStableInsets,
Rect outOutsets)
Return the insets for the areas covered by system windows.
|
int |
getMaxWallpaperLayer()
Get the highest layer (actually one more than) that the wallpaper is
allowed to be in.
|
int |
getNonDecorDisplayHeight(int fullWidth,
int fullHeight,
int rotation,
int uiMode)
Return the display height available after excluding any screen
decorations that could never be removed in Honeycomb.
|
int |
getNonDecorDisplayWidth(int fullWidth,
int fullHeight,
int rotation,
int uiMode)
Return the display width available after excluding any screen
decorations that could never be removed in Honeycomb.
|
void |
getNonDecorInsetsLw(int displayRotation,
int displayWidth,
int displayHeight,
Rect outInsets)
Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system
bar or button bar.
|
void |
getStableInsetsLw(int displayRotation,
int displayWidth,
int displayHeight,
Rect outInsets)
Calculates the stable insets without running a layout.
|
int |
getSystemDecorLayerLw()
Returns the bottom-most layer of the system decor, above which no policy decor should
be applied.
|
int |
getUserRotationMode()
Gets the current user rotation mode.
|
WindowManagerPolicy.WindowState |
getWinShowWhenLockedLw()
Return the window that is hiding the keyguard, if such a thing exists.
|
boolean |
hasNavigationBar()
Specifies whether there is an on-screen navigation bar separate from the status bar.
|
void |
hideBootMessages()
Hide the UI for showing boot messages, never to be displayed again.
|
void |
init(Context context,
IWindowManager windowManager,
WindowManagerPolicy.WindowManagerFuncs windowManagerFuncs)
Perform initialization of the policy.
|
boolean |
inKeyguardRestrictedKeyInputMode()
inKeyguardRestrictedKeyInputMode
if keyguard screen is showing or in restricted key input mode (i.e. in
keyguard password emergency screen).
|
long |
interceptKeyBeforeDispatching(WindowManagerPolicy.WindowState win,
KeyEvent event,
int policyFlags)
Called from the input dispatcher thread before a key is dispatched to a window.
|
int |
interceptKeyBeforeQueueing(KeyEvent event,
int policyFlags)
Called from the input reader thread before a key is enqueued.
|
int |
interceptMotionBeforeQueueingNonInteractive(long whenNanos,
int policyFlags)
Called from the input reader thread before a motion is enqueued when the device is in a
non-interactive state.
|
boolean |
isDefaultOrientationForced() |
boolean |
isDockSideAllowed(int dockSide) |
boolean |
isForceHiding(WindowManager.LayoutParams attrs)
Return whether the given window is forcibly hiding all windows except windows with
FLAG_SHOW_WHEN_LOCKED set.
|
boolean |
isKeyguardDrawnLw()
Ask the policy whether the Keyguard has drawn.
|
boolean |
isKeyguardHostWindow(WindowManager.LayoutParams attrs)
Return whether the given window can become one that passes isForceHiding() test.
|
boolean |
isKeyguardLocked()
isKeyguardLocked
Return whether the keyguard is currently locked.
|
boolean |
isKeyguardSecure(int userId)
isKeyguardSecure
Return whether the keyguard requires a password to unlock.
|
boolean |
isKeyguardShowingOrOccluded()
Return whether the keyguard is on.
|
boolean |
isNavBarForcedShownLw(WindowManagerPolicy.WindowState windowState) |
boolean |
isScreenOn()
Return whether the default display is on and not blocked by a black surface.
|
boolean |
isTopLevelWindow(int windowType)
Returns whether a given window type is considered a top level one.
|
void |
keepScreenOnStartedLw()
Called when we have started keeping the screen on because a window
requesting this has become visible.
|
void |
keepScreenOnStoppedLw()
Called when we have stopped keeping the screen on because the last window
requesting this is no longer visible.
|
void |
layoutWindowLw(WindowManagerPolicy.WindowState win,
WindowManagerPolicy.WindowState attached)
Called for each window attached to the window manager as layout is
proceeding.
|
void |
lockNow(Bundle options)
Lock the device now.
|
void |
notifyActivityDrawnForKeyguardLw()
Notifies the keyguard that the activity has drawn it was waiting for.
|
void |
notifyCameraLensCoverSwitchChanged(long whenNanos,
boolean lensCovered)
Tell the policy that the camera lens has been covered or uncovered.
|
void |
notifyLidSwitchChanged(long whenNanos,
boolean lidOpen)
Tell the policy that the lid switch has changed state.
|
void |
onConfigurationChanged()
Called when the configuration has changed, and it's safe to load new values from resources.
|
boolean |
performHapticFeedbackLw(WindowManagerPolicy.WindowState win,
int effectId,
boolean always)
Call from application to perform haptic feedback on its window.
|
int |
prepareAddWindowLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs)
Preflight adding a window to the system.
|
void |
registerShortcutKey(long shortcutCode,
IShortcutService shortcutService)
Register shortcuts for window manager to dispatch.
|
void |
removeStartingWindow(IBinder appToken,
View window)
Called when the first window of an application has been displayed, while
WindowManagerPolicy.addStartingWindow(android.os.IBinder, java.lang.String, int, android.content.res.CompatibilityInfo, java.lang.CharSequence, int, int, int, int, android.content.res.Configuration) has created a temporary initial window for
that application. |
void |
removeWindowLw(WindowManagerPolicy.WindowState win)
Called when a window is being removed from a window manager.
|
int |
rotationForOrientationLw(int orientation,
int lastRotation)
Given an orientation constant, returns the appropriate surface rotation,
taking into account sensors, docking mode, rotation lock, and other factors.
|
boolean |
rotationHasCompatibleMetricsLw(int orientation,
int rotation)
Given an orientation constant and a rotation, returns true if the rotation
has compatible metrics to the requested orientation.
|
void |
screenTurnedOff()
Called when the device has turned the screen off.
|
void |
screenTurnedOn()
Called when the device has actually turned on the screen, i.e. the display power state has
been set to ON and the screen is unblocked.
|
void |
screenTurningOn(WindowManagerPolicy.ScreenOnListener screenOnListener)
Called when the device is about to turn on the screen to show content.
|
int |
selectAnimationLw(WindowManagerPolicy.WindowState win,
int transit)
Control the animation to run when a window's state changes.
|
void |
selectRotationAnimationLw(int[] anim)
Determine the animation to run for a rotation transition based on the
top fullscreen windows
WindowManager.LayoutParams.rotationAnimation
and whether it is currently fullscreen and frontmost. |
void |
setCurrentOrientationLw(int newOrientation) |
void |
setCurrentUserLw(int newUserId)
Called when the current user changes.
|
void |
setDisplayOverscan(Display display,
int left,
int top,
int right,
int bottom)
Called by window manager to set the overscan region that should be used for the
given display.
|
void |
setInitialDisplaySize(Display display,
int width,
int height,
int density)
Called by window manager once it has the initial, default native
display dimensions.
|
void |
setLastInputMethodWindowLw(WindowManagerPolicy.WindowState ime,
WindowManagerPolicy.WindowState target)
Set the last used input method window state.
|
void |
setRecentsVisibilityLw(boolean visible)
Called by System UI to notify of changes to the visibility of Recents.
|
void |
setRotationLw(int rotation)
Called by the window manager when the rotation changes.
|
void |
setSafeMode(boolean safeMode)
Called when the system is mostly done booting to set whether
the system should go into safe mode.
|
void |
setTvPipVisibilityLw(boolean visible)
Called by System UI to notify of changes to the visibility of PIP.
|
void |
setUserRotationMode(int mode,
int rot)
Inform the policy that the user has chosen a preferred orientation ("rotation lock").
|
boolean |
shouldRotateSeamlessly(int oldRotation,
int newRotation) |
void |
showBootMessage(CharSequence msg,
boolean always)
Show boot time message to the user.
|
void |
showGlobalActions()
Show the global actions dialog.
|
void |
showRecentApps(boolean fromHome)
Show the recents task list app.
|
void |
startedGoingToSleep(int why)
Called when the device has started going to sleep.
|
void |
startedWakingUp()
Called when the device has started waking up.
|
void |
startKeyguardExitAnimation(long startTime,
long fadeoutDuration)
Notifies the keyguard to start fading out.
|
int |
subWindowTypeToLayerLw(int type)
Return how to Z-order sub-windows in relation to the window they are
attached to.
|
void |
systemBooted()
Called when the system is done booting to the point where the
user can start interacting with it.
|
void |
systemReady()
Called when the system is mostly done booting.
|
void |
updateSettings() |
void |
userActivity()
Called when userActivity is signalled in the power manager.
|
boolean |
validateRotationAnimationLw(int exitAnimId,
int enterAnimId,
boolean forceDefault)
Validate whether the current top fullscreen has specified the same
WindowManager.LayoutParams.rotationAnimation value as that
being passed in from the previous top fullscreen window. |
int |
windowTypeToLayerLw(int type)
Assign a window type to a layer.
|
public static final String SYSTEM_DIALOG_REASON_KEY
public static final String SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS
public static final String SYSTEM_DIALOG_REASON_RECENT_APPS
public static final String SYSTEM_DIALOG_REASON_HOME_KEY
public static final String SYSTEM_DIALOG_REASON_ASSIST
public static final int TOAST_WINDOW_TIMEOUT
public void showGlobalActions()
WindowManagerPolicy
showGlobalActions
in interface WindowManagerPolicy
public void init(Context context, IWindowManager windowManager, WindowManagerPolicy.WindowManagerFuncs windowManagerFuncs)
init
in interface WindowManagerPolicy
context
- The system context we are running in.public void setInitialDisplaySize(Display display, int width, int height, int density)
WindowManagerPolicy
setInitialDisplaySize
in interface WindowManagerPolicy
public boolean isDefaultOrientationForced()
isDefaultOrientationForced
in interface WindowManagerPolicy
public void setDisplayOverscan(Display display, int left, int top, int right, int bottom)
WindowManagerPolicy
setDisplayOverscan
in interface WindowManagerPolicy
public void updateSettings()
public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp)
checkAddPermission
in interface WindowManagerPolicy
attrs
- The window's LayoutParams.outAppOp
- First element will be filled with the app op corresponding to
this window, or OP_NONE.WindowManagerGlobal.ADD_OKAY
if the add can proceed;
else an error code, usually
WindowManagerGlobal.ADD_PERMISSION_DENIED
, to abort the add.public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs)
WindowManagerPolicy
checkShowToOwnerOnly
in interface WindowManagerPolicy
attrs
- The window's LayoutParams.public void adjustWindowParamsLw(WindowManager.LayoutParams attrs)
WindowManagerPolicy
adjustWindowParamsLw
in interface WindowManagerPolicy
attrs
- The window layout parameters to be modified. These values
are modified in-place.public void adjustConfigurationLw(Configuration config, int keyboardPresence, int navigationPresence)
This method may be called by any thread in the window manager, but no internal locks in the window manager will be held.
adjustConfigurationLw
in interface WindowManagerPolicy
config
- The Configuration being computed, for you to change as
desired.keyboardPresence
- Flags that indicate whether internal or external
keyboards are present.navigationPresence
- Flags that indicate whether internal or external
navigation devices are present.public void onConfigurationChanged()
WindowManagerPolicy
onConfigurationChanged
in interface WindowManagerPolicy
public int windowTypeToLayerLw(int type)
windowTypeToLayerLw
in interface WindowManagerPolicy
type
- The type of window being assigned.public int subWindowTypeToLayerLw(int type)
subWindowTypeToLayerLw
in interface WindowManagerPolicy
type
- The sub-window type code.public int getMaxWallpaperLayer()
WindowManagerPolicy
getMaxWallpaperLayer
in interface WindowManagerPolicy
public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation, int uiMode)
WindowManagerPolicy
getNonDecorDisplayWidth
in interface WindowManagerPolicy
public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation, int uiMode)
WindowManagerPolicy
getNonDecorDisplayHeight
in interface WindowManagerPolicy
public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation, int uiMode)
WindowManagerPolicy
#getNonDecorDisplayWidth(int, int, int)
; it may be smaller than
that to account for more transient decoration like a status bar.getConfigDisplayWidth
in interface WindowManagerPolicy
public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation, int uiMode)
WindowManagerPolicy
#getNonDecorDisplayHeight(int, int, int)
; it may be smaller than
that to account for more transient decoration like a status bar.getConfigDisplayHeight
in interface WindowManagerPolicy
public boolean isForceHiding(WindowManager.LayoutParams attrs)
WindowManagerPolicy
isForceHiding
in interface WindowManagerPolicy
public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs)
WindowManagerPolicy
isKeyguardHostWindow
in interface WindowManagerPolicy
public boolean canBeForceHidden(WindowManagerPolicy.WindowState win, WindowManager.LayoutParams attrs)
WindowManagerPolicy
WindowManagerPolicy.isForceHiding(android.view.WindowManager.LayoutParams)
) should actually be hidden.
For example, typically returns false for the status bar. Be careful
to return false for any window that you may hide yourself, since this
will conflict with what you set.canBeForceHidden
in interface WindowManagerPolicy
public WindowManagerPolicy.WindowState getWinShowWhenLockedLw()
WindowManagerPolicy
getWinShowWhenLockedLw
in interface WindowManagerPolicy
public View addStartingWindow(IBinder appToken, String packageName, int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags, Configuration overrideConfig)
addStartingWindow
in interface WindowManagerPolicy
appToken
- Token of the application being started.packageName
- The name of the application package being started.theme
- Resource defining the application's overall visual theme.nonLocalizedLabel
- The default title label of the application if
no data is found in the resource.labelRes
- The resource ID the application would like to use as its name.icon
- The resource ID the application would like to use as its icon.windowFlags
- Window layout flags.overrideConfig
- override configuration to consider when generating
context to for resources.WindowManagerPolicy.removeStartingWindow(android.os.IBinder, android.view.View)
public void removeStartingWindow(IBinder appToken, View window)
WindowManagerPolicy.addStartingWindow(android.os.IBinder, java.lang.String, int, android.content.res.CompatibilityInfo, java.lang.CharSequence, int, int, int, int, android.content.res.Configuration)
has created a temporary initial window for
that application. You should at this point remove the window from the
window manager. This is called without the window manager locked so
that you can call back into it.
Note: due to the nature of these functions not being called with the window manager locked, you must be prepared for this function to be called multiple times and/or an initial time with a null View window even if you previously returned one.
removeStartingWindow
in interface WindowManagerPolicy
appToken
- Token of the application that has started.window
- Window View that was returned by createStartingWindow.WindowManagerPolicy.addStartingWindow(android.os.IBinder, java.lang.String, int, android.content.res.CompatibilityInfo, java.lang.CharSequence, int, int, int, int, android.content.res.Configuration)
public int prepareAddWindowLw(WindowManagerPolicy.WindowState win, WindowManager.LayoutParams attrs)
prepareAddWindowLw
in interface WindowManagerPolicy
win
- The window to be addedattrs
- Information about the window to be addedpublic void removeWindowLw(WindowManagerPolicy.WindowState win)
removeWindowLw
in interface WindowManagerPolicy
win
- The window being removed.public int selectAnimationLw(WindowManagerPolicy.WindowState win, int transit)
selectAnimationLw
in interface WindowManagerPolicy
win
- The window that is changing.transit
- What is happening to the window: WindowManagerPolicy.TRANSIT_ENTER
,
WindowManagerPolicy.TRANSIT_EXIT
, WindowManagerPolicy.TRANSIT_SHOW
, or
WindowManagerPolicy.TRANSIT_HIDE
.public void selectRotationAnimationLw(int[] anim)
WindowManagerPolicy
WindowManager.LayoutParams.rotationAnimation
and whether it is currently fullscreen and frontmost.selectRotationAnimationLw
in interface WindowManagerPolicy
anim
- The exiting animation resource id is stored in anim[0], the
entering animation resource id is stored in anim[1].public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId, boolean forceDefault)
WindowManagerPolicy
WindowManager.LayoutParams.rotationAnimation
value as that
being passed in from the previous top fullscreen window.validateRotationAnimationLw
in interface WindowManagerPolicy
exitAnimId
- exiting resource id from the previous window.enterAnimId
- entering resource id from the previous window.forceDefault
- For rotation animations only, if true ignore the
animation values and just return false.public Animation createForceHideEnterAnimation(boolean onWallpaper, boolean goingToNotificationShade)
WindowManagerPolicy
createForceHideEnterAnimation
in interface WindowManagerPolicy
public Animation createForceHideWallpaperExitAnimation(boolean goingToNotificationShade)
WindowManagerPolicy
createForceHideWallpaperExitAnimation
in interface WindowManagerPolicy
public long interceptKeyBeforeDispatching(WindowManagerPolicy.WindowState win, KeyEvent event, int policyFlags)
Allows you to define behavior for keys that can not be overridden by applications. This method is called from the input thread, with no locks held.
interceptKeyBeforeDispatching
in interface WindowManagerPolicy
win
- The window that currently has focus. This is where the key
event will normally go.event
- The key event.policyFlags
- The policy flags associated with the key.public KeyEvent dispatchUnhandledKey(WindowManagerPolicy.WindowState win, KeyEvent event, int policyFlags)
Allows you to define default global behavior for keys that were not handled by applications. This method is called from the input thread, with no locks held.
dispatchUnhandledKey
in interface WindowManagerPolicy
win
- The window that currently has focus. This is where the key
event will normally go.event
- The key event.policyFlags
- The policy flags associated with the key.public void registerShortcutKey(long shortcutCode, IShortcutService shortcutService) throws RemoteException
WindowManagerPolicy
registerShortcutKey
in interface WindowManagerPolicy
RemoteException
public boolean canShowDismissingWindowWhileLockedLw()
canShowDismissingWindowWhileLockedLw
in interface WindowManagerPolicy
public void showRecentApps(boolean fromHome)
WindowManagerPolicy
showRecentApps
in interface WindowManagerPolicy
public void setRecentsVisibilityLw(boolean visible)
WindowManagerPolicy
setRecentsVisibilityLw
in interface WindowManagerPolicy
public void setTvPipVisibilityLw(boolean visible)
WindowManagerPolicy
setTvPipVisibilityLw
in interface WindowManagerPolicy
public int adjustSystemUiVisibilityLw(int visibility)
WindowManagerPolicy
adjustSystemUiVisibilityLw
in interface WindowManagerPolicy
visibility
- The raw visibility reported by the status bar.public boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds, int displayRotation, int displayWidth, int displayHeight, Rect outContentInsets, Rect outStableInsets, Rect outOutsets)
WindowManagerPolicy
getInsetHintLw
in interface WindowManagerPolicy
attrs
- The LayoutParams of the window.taskBounds
- The bounds of the task this window is on or null
if no task is
associated with the window.displayRotation
- Rotation of the display.displayWidth
- The width of the display.displayHeight
- The height of the display.outContentInsets
- The areas covered by system windows, expressed as positive insets.outStableInsets
- The areas covered by stable system windows irrespective of their
current visibility. Expressed as positive insets.outOutsets
- The areas that are not real display, but we would like to treat as such.WindowManagerPolicy.isNavBarForcedShownLw(WindowState)
.public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight, int displayRotation, int uiMode)
beginLayoutLw
in interface WindowManagerPolicy
isDefaultDisplay
- true if window is on Display.DEFAULT_DISPLAY
.displayWidth
- The current full width of the screen.displayHeight
- The current full height of the screen.displayRotation
- The current rotation being applied to the base window.uiMode
- The current uiMode in configuration.public int getSystemDecorLayerLw()
getSystemDecorLayerLw
in interface WindowManagerPolicy
public void getContentRectLw(Rect r)
WindowManagerPolicy
WindowManagerPolicy.beginLayoutLw(boolean, int, int, int, int)
.getContentRectLw
in interface WindowManagerPolicy
r
- The rectangle to be filled with the boundaries available to applications.public void layoutWindowLw(WindowManagerPolicy.WindowState win, WindowManagerPolicy.WindowState attached)
layoutWindowLw
in interface WindowManagerPolicy
win
- The window being positioned.attached
- For sub-windows, the window it is attached to; this
window will already have had layoutWindow() called on it
so you can use its Rect. Otherwise null.public void finishLayoutLw()
finishLayoutLw
in interface WindowManagerPolicy
public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight)
beginPostLayoutPolicyLw
in interface WindowManagerPolicy
displayWidth
- The current full width of the screen.displayHeight
- The current full height of the screen.public void applyPostLayoutPolicyLw(WindowManagerPolicy.WindowState win, WindowManager.LayoutParams attrs, WindowManagerPolicy.WindowState attached)
applyPostLayoutPolicyLw
in interface WindowManagerPolicy
win
- The window being positioned.attrs
- The LayoutParams of the window.attached
- For sub-windows, the window it is attached to. Otherwise null.public int finishPostLayoutPolicyLw()
finishPostLayoutPolicyLw
in interface WindowManagerPolicy
WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT
,
WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG
, WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER
,
or WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM
.public boolean allowAppAnimationsLw()
WindowManagerPolicy
allowAppAnimationsLw
in interface WindowManagerPolicy
public int focusChangedLw(WindowManagerPolicy.WindowState lastFocus, WindowManagerPolicy.WindowState newFocus)
WindowManagerPolicy
focusChangedLw
in interface WindowManagerPolicy
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen)
notifyLidSwitchChanged
in interface WindowManagerPolicy
whenNanos
- The time when the change occurred in uptime nanoseconds.lidOpen
- True if the lid is now open.public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered)
WindowManagerPolicy
notifyCameraLensCoverSwitchChanged
in interface WindowManagerPolicy
whenNanos
- The time when the change occurred in uptime nanoseconds.lensCovered
- True if the lens is covered.public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags)
There are some actions that need to be handled here because they affect the power state of the device, for example, the power keys. Generally, it's best to keep as little as possible in the queue thread because it's the most fragile.
interceptKeyBeforeQueueing
in interface WindowManagerPolicy
event
- The key event.policyFlags
- The policy flags associated with the key.WindowManagerPolicy.ACTION_PASS_TO_USER
.public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags)
There are some actions that need to be handled here because they affect the power state of the device, for example, waking on motions. Generally, it's best to keep as little as possible in the queue thread because it's the most fragile.
interceptMotionBeforeQueueingNonInteractive
in interface WindowManagerPolicy
policyFlags
- The policy flags associated with the motion.WindowManagerPolicy.ACTION_PASS_TO_USER
.public void startedGoingToSleep(int why)
WindowManagerPolicy
startedGoingToSleep
in interface WindowManagerPolicy
why
- WindowManagerPolicy.OFF_BECAUSE_OF_USER
, WindowManagerPolicy.OFF_BECAUSE_OF_ADMIN
,
or WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT
.public void finishedGoingToSleep(int why)
WindowManagerPolicy
finishedGoingToSleep
in interface WindowManagerPolicy
why
- WindowManagerPolicy.OFF_BECAUSE_OF_USER
, WindowManagerPolicy.OFF_BECAUSE_OF_ADMIN
,
or WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT
.public void startedWakingUp()
WindowManagerPolicy
startedWakingUp
in interface WindowManagerPolicy
public void finishedWakingUp()
WindowManagerPolicy
finishedWakingUp
in interface WindowManagerPolicy
public void screenTurnedOff()
WindowManagerPolicy
screenTurnedOff
in interface WindowManagerPolicy
public void screenTurningOn(WindowManagerPolicy.ScreenOnListener screenOnListener)
WindowManagerPolicy
screenTurningOn
in interface WindowManagerPolicy
public void screenTurnedOn()
WindowManagerPolicy
screenTurnedOn
in interface WindowManagerPolicy
public boolean isScreenOn()
WindowManagerPolicy
isScreenOn
in interface WindowManagerPolicy
public void enableKeyguard(boolean enabled)
enableKeyguard
in interface WindowManagerPolicy
enabled
- Whether keyguard can be on or not. does not actually
turn it on, unless it was previously disabled with this function.KeyguardManager.KeyguardLock.disableKeyguard()
,
KeyguardManager.KeyguardLock.reenableKeyguard()
public void exitKeyguardSecurely(WindowManagerPolicy.OnKeyguardExitResult callback)
exitKeyguardSecurely
in interface WindowManagerPolicy
callback
- Callback to send the result back.KeyguardManager.exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)
public boolean isKeyguardLocked()
isKeyguardLocked
in interface WindowManagerPolicy
public boolean isKeyguardSecure(int userId)
isKeyguardSecure
in interface WindowManagerPolicy
public boolean isKeyguardShowingOrOccluded()
isKeyguardShowingOrOccluded
in interface WindowManagerPolicy
public boolean inKeyguardRestrictedKeyInputMode()
inKeyguardRestrictedKeyInputMode
in interface WindowManagerPolicy
public void dismissKeyguardLw()
WindowManagerPolicy
dismissKeyguardLw
in interface WindowManagerPolicy
public void notifyActivityDrawnForKeyguardLw()
WindowManagerPolicy
notifyActivityDrawnForKeyguardLw
in interface WindowManagerPolicy
public boolean isKeyguardDrawnLw()
WindowManagerPolicy
isKeyguardDrawnLw
in interface WindowManagerPolicy
public void startKeyguardExitAnimation(long startTime, long fadeoutDuration)
WindowManagerPolicy
startKeyguardExitAnimation
in interface WindowManagerPolicy
startTime
- the start time of the animation in uptime millisecondsfadeoutDuration
- the duration of the exit animation, in millisecondspublic void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight, Rect outInsets)
WindowManagerPolicy
getStableInsetsLw
in interface WindowManagerPolicy
displayRotation
- the current display rotationdisplayWidth
- the current display widthdisplayHeight
- the current display heightoutInsets
- the insets to returnpublic void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, Rect outInsets)
WindowManagerPolicy
WindowManagerPolicy.getNonDecorDisplayWidth(int, int, int, int)
.getNonDecorInsetsLw
in interface WindowManagerPolicy
displayRotation
- the current display rotationdisplayWidth
- the current display widthdisplayHeight
- the current display heightoutInsets
- the insets to returnpublic boolean isNavBarForcedShownLw(WindowManagerPolicy.WindowState windowState)
isNavBarForcedShownLw
in interface WindowManagerPolicy
public boolean isDockSideAllowed(int dockSide)
isDockSideAllowed
in interface WindowManagerPolicy
public int rotationForOrientationLw(int orientation, int lastRotation)
WindowManagerPolicy
rotationForOrientationLw
in interface WindowManagerPolicy
orientation
- An orientation constant, such as
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
.lastRotation
- The most recently used rotation.public boolean rotationHasCompatibleMetricsLw(int orientation, int rotation)
WindowManagerPolicy
rotationHasCompatibleMetricsLw
in interface WindowManagerPolicy
orientation
- An orientation constant, such as
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
.rotation
- The rotation to check.public void setRotationLw(int rotation)
WindowManagerPolicy
setRotationLw
in interface WindowManagerPolicy
rotation
- The new rotation.public int getUserRotationMode()
WindowManagerPolicy
getUserRotationMode
in interface WindowManagerPolicy
WindowManagerPolicy.USER_ROTATION_LOCKED
,
WindowManagerPolicy.USER_ROTATION_FREE
public void setUserRotationMode(int mode, int rot)
WindowManagerPolicy
setUserRotationMode
in interface WindowManagerPolicy
mode
- One of WindowManagerPolicy.USER_ROTATION_LOCKED
or
WindowManagerPolicy.USER_ROTATION_FREE
.rot
- One of Surface.ROTATION_0
, Surface.ROTATION_90
,
Surface.ROTATION_180
, Surface.ROTATION_270
.public void setSafeMode(boolean safeMode)
WindowManagerPolicy
setSafeMode
in interface WindowManagerPolicy
public void systemReady()
systemReady
in interface WindowManagerPolicy
public void systemBooted()
systemBooted
in interface WindowManagerPolicy
public void showBootMessage(CharSequence msg, boolean always)
showBootMessage
in interface WindowManagerPolicy
public void hideBootMessages()
hideBootMessages
in interface WindowManagerPolicy
public void userActivity()
userActivity
in interface WindowManagerPolicy
public void lockNow(Bundle options)
WindowManagerPolicy
lockNow
in interface WindowManagerPolicy
public void enableScreenAfterBoot()
enableScreenAfterBoot
in interface WindowManagerPolicy
public void setCurrentOrientationLw(int newOrientation)
setCurrentOrientationLw
in interface WindowManagerPolicy
public boolean performHapticFeedbackLw(WindowManagerPolicy.WindowState win, int effectId, boolean always)
WindowManagerPolicy
performHapticFeedbackLw
in interface WindowManagerPolicy
public void keepScreenOnStartedLw()
WindowManagerPolicy
keepScreenOnStartedLw
in interface WindowManagerPolicy
public void keepScreenOnStoppedLw()
WindowManagerPolicy
keepScreenOnStoppedLw
in interface WindowManagerPolicy
public boolean hasNavigationBar()
WindowManagerPolicy
hasNavigationBar
in interface WindowManagerPolicy
public void setLastInputMethodWindowLw(WindowManagerPolicy.WindowState ime, WindowManagerPolicy.WindowState target)
WindowManagerPolicy
setLastInputMethodWindowLw
in interface WindowManagerPolicy
public int getInputMethodWindowVisibleHeightLw()
getInputMethodWindowVisibleHeightLw
in interface WindowManagerPolicy
public void setCurrentUserLw(int newUserId)
WindowManagerPolicy
setCurrentUserLw
in interface WindowManagerPolicy
newUserId
- The id of the incoming user.public boolean canMagnifyWindow(int windowType)
WindowManagerPolicy
canMagnifyWindow
in interface WindowManagerPolicy
windowType
- The window type.public boolean isTopLevelWindow(int windowType)
WindowManagerPolicy
isTopLevelWindow
in interface WindowManagerPolicy
windowType
- The window type.public boolean shouldRotateSeamlessly(int oldRotation, int newRotation)
shouldRotateSeamlessly
in interface WindowManagerPolicy
public void dump(String prefix, PrintWriter pw, String[] args)
WindowManagerPolicy
dump
in interface WindowManagerPolicy
prefix
- Text to print at the front of each line.pw
- The PrintWriter to which you should dump your state. This will be
closed for you after you return.args
- additional arguments to the dump request.