|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface WindowManagerPolicy
This interface supplies all UI-specific behavior of the window manager. An instance of it is created by the window manager when it starts up, and allows customization of window layering, special window types, key dispatching, and layout.
Because this provides deep interaction with the system window manager, specific methods on this interface can be called from a variety of contexts with various restrictions on what they can do. These are encoded through a suffixes at the end of a method encoding the thread the method is called from and any locks that are held when it is being called; if no suffix is attached to a method, then it is not called with any locks and may be called from the main window manager thread or another thread calling into the window manager.
The current suffixes are:
Context.checkPermission(String, int, int) and
variations require calling into the activity manager.
| Nested Class Summary | |
|---|---|
static interface |
WindowManagerPolicy.OnKeyguardExitResult
Callback used by exitKeyguardSecurely(android.view.WindowManagerPolicy.OnKeyguardExitResult) |
static interface |
WindowManagerPolicy.WindowState
Interface to the Window Manager state associated with a particular window. |
| Field Summary | |
|---|---|
static int |
ACTION_GO_TO_SLEEP
This key event should put the device to sleep (and engage keyguard if necessary) To be returned from interceptKeyTq(android.view.RawInputEvent, boolean). |
static int |
ACTION_PASS_TO_USER
Pass this event to the user / app. |
static int |
ACTION_POKE_USER_ACTIVITY
This key event should extend the user activity timeout and turn the lights on. |
static int |
FLAG_ALT
|
static int |
FLAG_ALT_GR
|
static int |
FLAG_BRIGHT_HERE
|
static int |
FLAG_CAPS_LOCK
|
static int |
FLAG_LAUNCHER
|
static int |
FLAG_MENU
|
static int |
FLAG_SHIFT
|
static int |
FLAG_WAKE
|
static int |
FLAG_WAKE_DROPPED
|
static int |
FLAG_WOKE_HERE
|
static int |
OFF_BECAUSE_OF_TIMEOUT
Screen turned off because of timeout |
static int |
OFF_BECAUSE_OF_USER
Screen turned off because of power button |
static int |
TRANSIT_ACTIVITY_CLOSE
The window in the top-most activity is being closed to reveal the previous activity in the same task. |
static int |
TRANSIT_ACTIVITY_OPEN
A window in a new activity is being opened on top of an existing one in the same task. |
static int |
TRANSIT_ENTER
Window has been added to the screen. |
static int |
TRANSIT_EXIT
Window has been removed from the screen. |
static int |
TRANSIT_HIDE
Window has been made invisible. |
static int |
TRANSIT_NONE
No transition happening. |
static int |
TRANSIT_PREVIEW_DONE
The "application starting" preview window is no longer needed, and will animate away to show the real window. |
static int |
TRANSIT_SHOW
Window has been made visible. |
static int |
TRANSIT_TASK_CLOSE
A window in the top-most activity is being closed to reveal the previous activity in a different task. |
static int |
TRANSIT_TASK_OPEN
A window in a new task is being opened on top of an existing one in another activity's task. |
static int |
TRANSIT_TASK_TO_BACK
A window in an existing task is being put below all other tasks. |
static int |
TRANSIT_TASK_TO_FRONT
A window in an existing task is being displayed on top of an existing one in another activity's task. |
static int |
USE_LAST_ROTATION
Magic constant to IWindowManager.setRotation(int, boolean) to not actually
modify the rotation. |
static boolean |
WATCH_POINTER
|
| Method Summary | |
|---|---|
View |
addStartingWindow(IBinder appToken,
String packageName,
int theme,
CharSequence nonLocalizedLabel,
int labelRes,
int icon)
Called when the system would like to show a UI to indicate that an application is starting. |
void |
adjustConfigurationLw(Configuration config)
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. |
void |
adjustWindowParamsLw(WindowManager.LayoutParams attrs)
Sanitize the layout parameters coming from a client. |
void |
animatingWindowLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs)
Called each time a window is animating. |
void |
beginAnimationLw(int displayWidth,
int displayHeight)
Called when animation of the windows is about to start. |
void |
beginLayoutLw(int displayWidth,
int displayHeight)
Called when layout of the windows is about to start. |
int |
checkAddPermission(WindowManager.LayoutParams attrs)
Check permissions when adding a window. |
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) |
boolean |
finishAnimationLw()
Called when animation of the windows is finished. |
void |
finishLayoutLw()
Called when layout of the windows is finished. |
void |
getCoveredInsetHintLw(WindowManager.LayoutParams attrs,
Rect coveredInset)
Return the insets for the areas covered by system windows. |
void |
init(Context context,
IWindowManager windowManager,
LocalPowerManager powerManager)
Perform initialization of the policy. |
boolean |
inKeyguardRestrictedKeyInputMode()
inKeyguardRestrictedKeyInputMode if keyguard screen is showing or in restricted key input mode (i.e. |
boolean |
interceptKeyTi(WindowManagerPolicy.WindowState win,
int code,
int metaKeys,
boolean down,
int repeatCount)
Called from the input thread before a key is dispatched to a window. |
int |
interceptKeyTq(RawInputEvent event,
boolean screenIsOn)
Called from the key queue thread before a key is dispatched to the input thread. |
boolean |
isAppSwitchKeyTqTiLwLi(int keycode)
Determine whether a given key code is used to cause an app switch to occur (most often the HOME key, also often ENDCALL). |
boolean |
isCheekPressedAgainstScreen(MotionEvent ev)
Returns true if the user's cheek has been pressed against the phone. |
boolean |
isMovementKeyTi(int keycode)
Determine whether a given key code is used for movement within a UI, and does not generally cause actions to be performed (normally the DPAD movement keys, NOT the DPAD center press key). |
boolean |
isWakeAbsMovementTq(int device,
int classes,
RawInputEvent event)
Given the current state of the world, should this absolute movement wake up the device? |
boolean |
isWakeRelMovementTq(int device,
int classes,
RawInputEvent event)
Given the current state of the world, should this relative movement wake up the device? |
boolean |
keyguardIsShowingTq()
Return if keyguard is currently showing. |
void |
layoutWindowLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs,
WindowManagerPolicy.WindowState attached)
Called for each window attached to the window manager as layout is proceeding. |
int |
prepareAddWindowLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs)
Prepare for a window being added to the window manager. |
boolean |
preprocessInputEventTq(RawInputEvent event)
Perform any initial processing of a low-level input event before the window manager handles special keys and generates a high-level event that is dispatched to the application. |
void |
removeStartingWindow(IBinder appToken,
View window)
Called when the first window of an application has been displayed, while addStartingWindow(android.os.IBinder, java.lang.String, int, java.lang.CharSequence, int, int) 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 |
rotationForOrientation(int orientation)
Given an orientation constant ( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE or
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT), return a surface
rotation. |
void |
screenTurnedOff(int why)
Called after the screen turns off. |
void |
screenTurnedOn()
Called after the screen turns on. |
int |
selectAnimationLw(WindowManagerPolicy.WindowState win,
int transit)
Control the animation to run when a window's state changes. |
void |
setCurrentOrientation(int newOrientation)
|
int |
subWindowTypeToLayerLw(int type)
Return how to Z-order sub-windows in relation to the window they are attached to. |
void |
systemReady()
Called when the system is mostly done booting |
int |
windowTypeToLayerLw(int type)
Assign a window type to a layer. |
| Field Detail |
|---|
static final int FLAG_WAKE
static final int FLAG_WAKE_DROPPED
static final int FLAG_SHIFT
static final int FLAG_CAPS_LOCK
static final int FLAG_ALT
static final int FLAG_ALT_GR
static final int FLAG_MENU
static final int FLAG_LAUNCHER
static final int FLAG_WOKE_HERE
static final int FLAG_BRIGHT_HERE
static final boolean WATCH_POINTER
static final int ACTION_PASS_TO_USER
interceptKeyTq(android.view.RawInputEvent, boolean).
static final int ACTION_POKE_USER_ACTIVITY
interceptKeyTq(android.view.RawInputEvent, boolean). Do not return this and
ACTION_GO_TO_SLEEP or ACTION_PASS_TO_USER.
static final int ACTION_GO_TO_SLEEP
interceptKeyTq(android.view.RawInputEvent, boolean). Do not return this and
ACTION_POKE_USER_ACTIVITY or ACTION_PASS_TO_USER.
static final int TRANSIT_NONE
static final int TRANSIT_ENTER
static final int TRANSIT_EXIT
static final int TRANSIT_SHOW
static final int TRANSIT_HIDE
static final int TRANSIT_PREVIEW_DONE
static final int TRANSIT_ACTIVITY_OPEN
static final int TRANSIT_ACTIVITY_CLOSE
static final int TRANSIT_TASK_OPEN
static final int TRANSIT_TASK_CLOSE
static final int TRANSIT_TASK_TO_FRONT
static final int TRANSIT_TASK_TO_BACK
static final int OFF_BECAUSE_OF_USER
static final int OFF_BECAUSE_OF_TIMEOUT
static final int USE_LAST_ROTATION
IWindowManager.setRotation(int, boolean) to not actually
modify the rotation.
| Method Detail |
|---|
void init(Context context,
IWindowManager windowManager,
LocalPowerManager powerManager)
context - The system context we are running in.powerManager - int checkAddPermission(WindowManager.LayoutParams attrs)
attrs - The window's LayoutParams.
WindowManagerImpl.ADD_OKAY if the add can proceed;
else an error code, usually
WindowManagerImpl.ADD_PERMISSION_DENIED, to abort the add.void adjustWindowParamsLw(WindowManager.LayoutParams attrs)
attrs - The window layout parameters to be modified. These values
are modified in-place.void adjustConfigurationLw(Configuration config)
This method may be called by any thread in the window manager, but no internal locks in the window manager will be held.
config - The Configuration being computed, for you to change as
desired.int windowTypeToLayerLw(int type)
type - The type of window being assigned.
int subWindowTypeToLayerLw(int type)
type - The sub-window type code.
View addStartingWindow(IBinder appToken,
String packageName,
int theme,
CharSequence nonLocalizedLabel,
int labelRes,
int icon)
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.
removeStartingWindow(android.os.IBinder, android.view.View)
void removeStartingWindow(IBinder appToken,
View window)
addStartingWindow(android.os.IBinder, java.lang.String, int, java.lang.CharSequence, int, int) 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.
appToken - Token of the application that has started.window - Window View that was returned by createStartingWindow.addStartingWindow(android.os.IBinder, java.lang.String, int, java.lang.CharSequence, int, int)
int prepareAddWindowLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs)
win - The window being added.attrs - The window's LayoutParams.
WindowManagerImpl.ADD_OKAY if the add can proceed, else an
error code to abort the add.void removeWindowLw(WindowManagerPolicy.WindowState win)
win - The window being removed.
int selectAnimationLw(WindowManagerPolicy.WindowState win,
int transit)
win - The window that is changing.transit - What is happening to the window: TRANSIT_ENTER,
TRANSIT_EXIT, TRANSIT_SHOW, or
TRANSIT_HIDE.
int interceptKeyTq(RawInputEvent event,
boolean screenIsOn)
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.
event - the raw input event as read from the driverscreenIsOn - true if the screen is already on
ACTION_PASS_TO_USER,
ACTION_POKE_USER_ACTIVITY and ACTION_GO_TO_SLEEP flags.
boolean interceptKeyTi(WindowManagerPolicy.WindowState win,
int code,
int metaKeys,
boolean down,
int repeatCount)
Allows you to define behavior for keys that can not be overridden by applications or redirect key events to a different window. This method is called from the input thread, with no locks held.
Note that if you change the window a key is dispatched to, the new target window will receive the key event without having input focus.
win - The window that currently has focus. This is where the key
event will normally go.code - Key code.metaKeys - TODOdown - Is this a key press (true) or release (false)?repeatCount - Number of times a key down has repeated.
void beginLayoutLw(int displayWidth,
int displayHeight)
displayWidth - The current full width of the screen.displayHeight - The current full height of the screen.
void layoutWindowLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs,
WindowManagerPolicy.WindowState attached)
win - The window being positioned.attrs - The LayoutParams of the window.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.
void getCoveredInsetHintLw(WindowManager.LayoutParams attrs,
Rect coveredInset)
attrs - The LayoutParams of the window.coveredInset - The areas covered by system windows, expressed as positive insetsvoid finishLayoutLw()
void beginAnimationLw(int displayWidth,
int displayHeight)
displayWidth - The current full width of the screen.displayHeight - The current full height of the screen.
void animatingWindowLw(WindowManagerPolicy.WindowState win,
WindowManager.LayoutParams attrs)
win - The window being positioned.attrs - The LayoutParams of the window.boolean finishAnimationLw()
void screenTurnedOff(int why)
why - OFF_BECAUSE_OF_USER or
OFF_BECAUSE_OF_TIMEOUT.void screenTurnedOn()
boolean preprocessInputEventTq(RawInputEvent event)
event - The input event that has occurred.
boolean isAppSwitchKeyTqTiLwLi(int keycode)
Note that this function is called from the low-level input queue thread, with either/or the window or input lock held; be very careful about what you do here. You absolutely should never acquire a lock that you would ever hold elsewhere while calling out into the window manager or view hierarchy.
keycode - The key that should be checked for performing an
app switch before delivering to the application.
boolean isMovementKeyTi(int keycode)
#isAppSwitchKeyTiLi returns true to remove any pending events
in the key queue that are not needed to switch applications.
Note that this function is called from the low-level input queue thread; be very careful about what you do here.
keycode - The key that is waiting to be delivered to the
application.
boolean isWakeRelMovementTq(int device,
int classes,
RawInputEvent event)
device - The device the movement came from.classes - The input classes associated with the device.event - The input event that occurred.
boolean isWakeAbsMovementTq(int device,
int classes,
RawInputEvent event)
device - The device the movement came from.classes - The input classes associated with the device.event - The input event that occurred.
void enableKeyguard(boolean enabled)
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()void exitKeyguardSecurely(WindowManagerPolicy.OnKeyguardExitResult callback)
callback - Callback to send the result back.KeyguardManager.exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)boolean keyguardIsShowingTq()
boolean inKeyguardRestrictedKeyInputMode()
int rotationForOrientation(int orientation)
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE or
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT), return a surface
rotation.
void systemReady()
void enableScreenAfterBoot()
boolean isCheekPressedAgainstScreen(MotionEvent ev)
ev - the motion event generated when the cheek is pressed
against the phone
void setCurrentOrientation(int newOrientation)
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||