FileDocCategorySizeDatePackage
WindowManagerPolicy.javaAPI DocAndroid 5.1 API49666Thu Mar 12 22:22:10 GMT 2015android.view

WindowManagerPolicy

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:

Ti
Called from the input thread. This is the thread that collects pending input events and dispatches them to the appropriate window. It may block waiting for events to be processed, so that the input stream is properly serialized.
Tq
Called from the low-level input queue thread. This is the thread that reads events out of the raw input devices and places them into the global input queue that is read by the Ti thread. This thread should not block for a long period of time on anything but the key driver.
Lw
Called with the main window manager lock held. Because the window manager is a very low-level system service, there are few other system services you can call with this lock held. It is explicitly okay to make calls into the package manager and power manager; it is explicitly not okay to make calls into the activity manager or most other services. Note that {@link android.content.Context#checkPermission(String, int, int)} and variations require calling into the activity manager.
Li
Called with the input thread lock held. This lock can be acquired by the window manager while it holds the window lock, so this is even more restrictive than Lw.
hide

Fields Summary
public static final int
FLAG_WAKE
public static final int
FLAG_VIRTUAL
public static final int
FLAG_INJECTED
public static final int
FLAG_TRUSTED
public static final int
FLAG_FILTERED
public static final int
FLAG_DISABLE_KEY_REPEAT
public static final int
FLAG_INTERACTIVE
public static final int
FLAG_PASS_TO_USER
public static final int
PRESENCE_INTERNAL
public static final int
PRESENCE_EXTERNAL
public static final boolean
WATCH_POINTER
public static final String
ACTION_HDMI_PLUGGED
Sticky broadcast of the current HDMI plugged state.
public static final String
EXTRA_HDMI_PLUGGED_STATE
Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if plugged in to HDMI, false if not.
public static final int
ACTION_PASS_TO_USER
Pass this event to the user / app. To be returned from {@link #interceptKeyBeforeQueueing}.
public static final int
TRANSIT_ENTER
Window has been added to the screen.
public static final int
TRANSIT_EXIT
Window has been removed from the screen.
public static final int
TRANSIT_SHOW
Window has been made visible.
public static final int
TRANSIT_HIDE
Window has been made invisible. TODO: Consider removal as this is unused.
public static final int
TRANSIT_PREVIEW_DONE
The "application starting" preview window is no longer needed, and will animate away to show the real window.
public final int
OFF_BECAUSE_OF_ADMIN
Screen turned off because of a device admin
public final int
OFF_BECAUSE_OF_USER
Screen turned off because of power button
public final int
OFF_BECAUSE_OF_TIMEOUT
Screen turned off because of timeout
public final int
USER_ROTATION_FREE
When not otherwise specified by the activity's screenOrientation, rotation should be determined by the system (that is, using sensors).
public final int
USER_ROTATION_LOCKED
When not otherwise specified by the activity's screenOrientation, rotation is set by the user.
static final int
FINISH_LAYOUT_REDO_LAYOUT
Layout state may have changed (so another layout will be performed)
static final int
FINISH_LAYOUT_REDO_CONFIG
Configuration state may have changed
static final int
FINISH_LAYOUT_REDO_WALLPAPER
Wallpaper may need to move
static final int
FINISH_LAYOUT_REDO_ANIM
Need to recompute animations
Constructors Summary
Methods Summary
public ViewaddStartingWindow(android.os.IBinder appToken, java.lang.String packageName, int theme, android.content.res.CompatibilityInfo compatInfo, java.lang.CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags)
Called when the system would like to show a UI to indicate that an application is starting. You can use this to add a APPLICATION_STARTING_TYPE window with the given appToken to the window manager (using the normal window manager APIs) that will be shown until the application displays its own window. This is called without the window manager locked so that you can call back into it.

param
appToken Token of the application being started.
param
packageName The name of the application package being started.
param
theme Resource defining the application's overall visual theme.
param
nonLocalizedLabel The default title label of the application if no data is found in the resource.
param
labelRes The resource ID the application would like to use as its name.
param
icon The resource ID the application would like to use as its icon.
param
windowFlags Window layout flags.
return
Optionally you can return the View that was used to create the window, for easy removal in removeStartingWindow.
see
#removeStartingWindow

public voidadjustConfigurationLw(android.content.res.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. If you want to leave it as-is, simply do nothing.

This method may be called by any thread in the window manager, but no internal locks in the window manager will be held.

param
config The Configuration being computed, for you to change as desired.
param
keyboardPresence Flags that indicate whether internal or external keyboards are present.
param
navigationPresence Flags that indicate whether internal or external navigation devices are present.

public intadjustSystemUiVisibilityLw(int visibility)
Called when a new system UI visibility is being reported, allowing the policy to adjust what is actually reported.

param
visibility The raw visibility reported by the status bar.
return
The new desired visibility.

public voidadjustWindowParamsLw(WindowManager.LayoutParams attrs)
Sanitize the layout parameters coming from a client. Allows the policy to do things like ensure that windows of a specific type can't take input focus.

param
attrs The window layout parameters to be modified. These values are modified in-place.

public booleanallowAppAnimationsLw()
Return true if it is okay to perform animations for an app transition that is about to occur. You may return false for this if, for example, the lock screen is currently displayed so the switch should happen immediately.

public voidapplyPostLayoutPolicyLw(android.view.WindowManagerPolicy$WindowState win, WindowManager.LayoutParams attrs, android.view.WindowManagerPolicy$WindowState attached)
Called following layout of all window to apply policy to each window.

param
win The window being positioned.
param
attrs The LayoutParams of the window.
param
attached For sub-windows, the window it is attached to. Otherwise null.

public voidbeginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight, int displayRotation)
Called when layout of the windows is about to start.

param
isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}.
param
displayWidth The current full width of the screen.
param
displayHeight The current full height of the screen.
param
displayRotation The current rotation being applied to the base window.

public voidbeginPostLayoutPolicyLw(int displayWidth, int displayHeight)
Called following layout of all windows before each window has policy applied.

param
displayWidth The current full width of the screen.
param
displayHeight The current full height of the screen.

public booleancanBeForceHidden(android.view.WindowManagerPolicy$WindowState win, WindowManager.LayoutParams attrs)
Determine if a window that is behind one that is force hiding (as determined by {@link #isForceHiding}) 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.

public booleancanMagnifyWindow(int windowType)
Returns whether a given window type can be magnified.

param
windowType The window type.
return
True if the window can be magnified.

public intcheckAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp)
Check permissions when adding a window.

param
attrs The window's LayoutParams.
param
outAppOp First element will be filled with the app op corresponding to this window, or OP_NONE.
return
{@link WindowManagerGlobal#ADD_OKAY} if the add can proceed; else an error code, usually {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add.

public booleancheckShowToOwnerOnly(WindowManager.LayoutParams attrs)
Check permissions when adding a window.

param
attrs The window's LayoutParams.
return
True if the window may only be shown to the current user, false if the window can be shown on all users' windows.

public android.view.animation.AnimationcreateForceHideEnterAnimation(boolean onWallpaper, boolean goingToNotificationShade)
Create and return an animation to re-display a force hidden window.

public android.view.animation.AnimationcreateForceHideWallpaperExitAnimation(boolean goingToNotificationShade)
Create and return an animation to let the wallpaper disappear after being shown on a force hiding window.

public voiddismissKeyguardLw()
Ask the policy to dismiss the keyguard, if it is currently shown.

public KeyEventdispatchUnhandledKey(android.view.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.

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.

param
win The window that currently has focus. This is where the key event will normally go.
param
event The key event.
param
policyFlags The policy flags associated with the key.
return
Returns an alternate key event to redispatch as a fallback, or null to give up. The caller is responsible for recycling the key event.

public voiddump(java.lang.String prefix, java.io.PrintWriter writer, java.lang.String[] args)
Print the WindowManagerPolicy's state into the given stream.

param
prefix Text to print at the front of each line.
param
writer The PrintWriter to which you should dump your state. This will be closed for you after you return.
param
args additional arguments to the dump request.

public voidenableKeyguard(boolean enabled)
Tell the policy if anyone is requesting that keyguard not come on.

param
enabled Whether keyguard can be on or not. does not actually turn it on, unless it was previously disabled with this function.
see
android.app.KeyguardManager.KeyguardLock#disableKeyguard()
see
android.app.KeyguardManager.KeyguardLock#reenableKeyguard()

public voidenableScreenAfterBoot()
Called when we have finished booting and can now display the home screen to the user. This will happen after systemReady(), and at this point the display is active.

public voidexitKeyguardSecurely(android.view.WindowManagerPolicy$OnKeyguardExitResult callback)
Tell the policy if anyone is requesting the keyguard to exit securely (this would be called after the keyguard was disabled)

param
callback Callback to send the result back.
see
android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)

public voidfinishLayoutLw()
Called when layout of the windows is finished. After this function has returned, all windows given to layoutWindow() must have had a frame assigned.

public intfinishPostLayoutPolicyLw()
Called following layout of all windows and after policy has been applied to each window. If in this function you do something that may have modified the animation state of another window, be sure to return non-zero in order to perform another pass through layout.

return
Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}, {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER}, or {@link #FINISH_LAYOUT_REDO_ANIM}.

public intfocusChangedLw(android.view.WindowManagerPolicy$WindowState lastFocus, android.view.WindowManagerPolicy$WindowState newFocus)
A new window has been focused.

public intgetAboveUniverseLayer()
Return the window layer at which windows appear above the normal universe (that is no longer impacted by the universe background transform).

public intgetConfigDisplayHeight(int fullWidth, int fullHeight, int rotation)
Return the available screen height that we should report for the configuration. This must be no larger than {@link #getNonDecorDisplayHeight(int, int, int)}; it may be smaller than that to account for more transient decoration like a status bar.

public intgetConfigDisplayWidth(int fullWidth, int fullHeight, int rotation)
Return the available screen width that we should report for the configuration. This must be no larger than {@link #getNonDecorDisplayWidth(int, int, int)}; it may be smaller than that to account for more transient decoration like a status bar.

public voidgetContentRectLw(android.graphics.Rect r)
Return the rectangle of the screen that is available for applications to run in. This will be called immediately after {@link #beginLayoutLw}.

param
r The rectangle to be filled with the boundaries available to applications.

public intgetInputMethodWindowVisibleHeightLw()

return
The current height of the input method window.

public voidgetInsetHintLw(WindowManager.LayoutParams attrs, android.graphics.Rect outContentInsets, android.graphics.Rect outStableInsets)
Return the insets for the areas covered by system windows. These values are computed on the most recent layout, so they are not guaranteed to be correct.

param
attrs The LayoutParams of the window.
param
outContentInsets The areas covered by system windows, expressed as positive insets.
param
outStableInsets The areas covered by stable system windows irrespective of their current visibility. Expressed as positive insets.

public intgetMaxWallpaperLayer()
Get the highest layer (actually one more than) that the wallpaper is allowed to be in.

public intgetNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation)
Return the display height available after excluding any screen decorations that can never be removed. That is, system bar or button bar.

public intgetNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation)
Return the display width available after excluding any screen decorations that can never be removed. That is, system bar or button bar.

public intgetSystemDecorLayerLw()
Returns the bottom-most layer of the system decor, above which no policy decor should be applied.

public intgetUserRotationMode()
Gets the current user rotation mode.

return
The rotation mode.
see
WindowManagerPolicy#USER_ROTATION_LOCKED
see
WindowManagerPolicy#USER_ROTATION_FREE

public android.view.WindowManagerPolicy$WindowStategetWinShowWhenLockedLw()
Return the window that is hiding the keyguard, if such a thing exists.

public voidgoingToSleep(int why)
Called when the device is going to sleep.

param
why {@link #OFF_BECAUSE_OF_USER} or {@link #OFF_BECAUSE_OF_TIMEOUT}.

public booleanhasNavigationBar()
Specifies whether there is an on-screen navigation bar separate from the status bar.

public voidhideBootMessages()
Hide the UI for showing boot messages, never to be displayed again.

public booleaninKeyguardRestrictedKeyInputMode()
inKeyguardRestrictedKeyInputMode if keyguard screen is showing or in restricted key input mode (i.e. in keyguard password emergency screen). When in such mode, certain keys, such as the Home key and the right soft keys, don't work.

return
true if in keyguard restricted input mode.

public voidinit(android.content.Context context, IWindowManager windowManager, android.view.WindowManagerPolicy$WindowManagerFuncs windowManagerFuncs)
Perform initialization of the policy.

param
context The system context we are running in.

public longinterceptKeyBeforeDispatching(android.view.WindowManagerPolicy$WindowState win, KeyEvent event, int policyFlags)
Called from the input dispatcher thread before a key is dispatched to a window.

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.

param
win The window that currently has focus. This is where the key event will normally go.
param
event The key event.
param
policyFlags The policy flags associated with the key.
return
0 if the key should be dispatched immediately, -1 if the key should not be dispatched ever, or a positive value indicating the number of milliseconds by which the key dispatch should be delayed before trying again.

public intinterceptKeyBeforeQueueing(KeyEvent event, int policyFlags)
Called from the input reader thread before a key is enqueued.

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.

param
event The key event.
param
policyFlags The policy flags associated with the key.
return
Actions flags: may be {@link #ACTION_PASS_TO_USER}.

public intinterceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags)
Called from the input reader thread before a motion is enqueued when the device is in a non-interactive state.

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.

param
policyFlags The policy flags associated with the motion.
return
Actions flags: may be {@link #ACTION_PASS_TO_USER}.

public booleanisDefaultOrientationForced()

return
true if com.android.internal.R.bool#config_forceDefaultOrientation is true.

public booleanisForceHiding(WindowManager.LayoutParams attrs)
Return whether the given window is forcibly hiding all windows except windows with FLAG_SHOW_WHEN_LOCKED set. Typically returns true for the keyguard.

public booleanisKeyguardDrawnLw()
Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method returns true as soon as we know that Keyguard is disabled.

return
true if the keyguard has drawn.

public booleanisKeyguardHostWindow(WindowManager.LayoutParams attrs)
Return whether the given window can become one that passes isForceHiding() test. Typically returns true for the StatusBar.

public booleanisKeyguardLocked()
isKeyguardLocked Return whether the keyguard is currently locked.

return
true if in keyguard is locked.

public booleanisKeyguardSecure()
isKeyguardSecure Return whether the keyguard requires a password to unlock.

return
true if in keyguard is secure.

public booleanisScreenOn()
Return whether the default display is on and not blocked by a black surface.

public booleanisTopLevelWindow(int windowType)
Returns whether a given window type is considered a top level one. A top level window does not have a container, i.e. attached window, or if it has a container it is laid out as a top-level window, not as a child of its container.

param
windowType The window type.
return
True if the window is a top level one.

public voidkeepScreenOnStartedLw()
Called when we have started keeping the screen on because a window requesting this has become visible.

public voidkeepScreenOnStoppedLw()
Called when we have stopped keeping the screen on because the last window requesting this is no longer visible.

public voidlayoutWindowLw(android.view.WindowManagerPolicy$WindowState win, android.view.WindowManagerPolicy$WindowState attached)
Called for each window attached to the window manager as layout is proceeding. The implementation of this function must take care of setting the window's frame, either here or in finishLayout().

param
win The window being positioned.
param
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 voidlockNow(android.os.Bundle options)
Lock the device now.

public voidnotifyActivityDrawnForKeyguardLw()
Notifies the keyguard that the activity has drawn it was waiting for.

public voidnotifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered)
Tell the policy that the camera lens has been covered or uncovered.

param
whenNanos The time when the change occurred in uptime nanoseconds.
param
lensCovered True if the lens is covered.

public voidnotifyLidSwitchChanged(long whenNanos, boolean lidOpen)
Tell the policy that the lid switch has changed state.

param
whenNanos The time when the change occurred in uptime nanoseconds.
param
lidOpen True if the lid is now open.

public booleanperformHapticFeedbackLw(android.view.WindowManagerPolicy$WindowState win, int effectId, boolean always)
Call from application to perform haptic feedback on its window.

public intprepareAddWindowLw(android.view.WindowManagerPolicy$WindowState win, WindowManager.LayoutParams attrs)
Prepare for a window being added to the window manager. You can throw an exception here to prevent the window being added, or do whatever setup you need to keep track of the window.

param
win The window being added.
param
attrs The window's LayoutParams.
return
{@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an error code to abort the add.

public voidremoveStartingWindow(android.os.IBinder appToken, View window)
Called when the first window of an application has been displayed, while {@link #addStartingWindow} 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.

param
appToken Token of the application that has started.
param
window Window View that was returned by createStartingWindow.
see
#addStartingWindow

public voidremoveWindowLw(android.view.WindowManagerPolicy$WindowState win)
Called when a window is being removed from a window manager. Must not throw an exception -- clean up as much as possible.

param
win The window being removed.

public introtationForOrientationLw(int orientation, int lastRotation)
Given an orientation constant, returns the appropriate surface rotation, taking into account sensors, docking mode, rotation lock, and other factors.

param
orientation An orientation constant, such as {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
param
lastRotation The most recently used rotation.
return
The surface rotation to use.

public booleanrotationHasCompatibleMetricsLw(int orientation, int rotation)
Given an orientation constant and a rotation, returns true if the rotation has compatible metrics to the requested orientation. For example, if the application requested landscape and got seascape, then the rotation has compatible metrics; if the application requested portrait and got landscape, then the rotation has incompatible metrics; if the application did not specify a preference, then anything goes.

param
orientation An orientation constant, such as {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
param
rotation The rotation to check.
return
True if the rotation is compatible with the requested orientation.

public voidscreenTurnedOff()
Called when the device has turned the screen off.

public voidscreenTurningOn(android.view.WindowManagerPolicy$ScreenOnListener screenOnListener)
Called when the device is about to turn on the screen to show content. When waking up, this method will be called once after the call to wakingUp(). When dozing, the method will be called sometime after the call to goingToSleep() and may be called repeatedly in the case where the screen is pulsing on and off. Must call back on the listener to tell it when the higher-level system is ready for the screen to go on (i.e. the lock screen is shown).

public intselectAnimationLw(android.view.WindowManagerPolicy$WindowState win, int transit)
Control the animation to run when a window's state changes. Return a non-0 number to force the animation to a specific resource ID, or 0 to use the default animation.

param
win The window that is changing.
param
transit What is happening to the window: {@link #TRANSIT_ENTER}, {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or {@link #TRANSIT_HIDE}.
return
Resource ID of the actual animation to use, or 0 for none.

public voidselectRotationAnimationLw(int[] anim)
Determine the animation to run for a rotation transition based on the top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation} and whether it is currently fullscreen and frontmost.

param
anim The exiting animation resource id is stored in anim[0], the entering animation resource id is stored in anim[1].

public voidsetCurrentOrientationLw(int newOrientation)

public voidsetCurrentUserLw(int newUserId)
Called when the current user changes. Guaranteed to be called before the broadcast of the new user id is made to all listeners.

param
newUserId The id of the incoming user.

public voidsetDisplayOverscan(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.

public voidsetInitialDisplaySize(Display display, int width, int height, int density)
Called by window manager once it has the initial, default native display dimensions.

public voidsetLastInputMethodWindowLw(android.view.WindowManagerPolicy$WindowState ime, android.view.WindowManagerPolicy$WindowState target)
Set the last used input method window state. This state is used to make IME transition smooth.

hide

public voidsetRotationLw(int rotation)
Called by the window manager when the rotation changes.

param
rotation The new rotation.

public voidsetSafeMode(boolean safeMode)
Called when the system is mostly done booting to set whether the system should go into safe mode.

public voidsetUserRotationMode(int mode, int rotation)
Inform the policy that the user has chosen a preferred orientation ("rotation lock").

param
mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or {@link WindowManagerPolicy#USER_ROTATION_FREE}.
param
rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90}, {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.

public voidshowBootMessage(java.lang.CharSequence msg, boolean always)
Show boot time message to the user.

public voidshowGlobalActions()
Show the global actions dialog.

hide

public voidshowRecentApps()
Show the recents task list app.

hide

public voidstartKeyguardExitAnimation(long startTime, long fadeoutDuration)
Notifies the keyguard to start fading out.

param
startTime the start time of the animation in uptime milliseconds
param
fadeoutDuration the duration of the exit animation, in milliseconds

public intsubWindowTypeToLayerLw(int type)
Return how to Z-order sub-windows in relation to the window they are attached to. Return positive to have them ordered in front, negative for behind.

param
type The sub-window type code.
return
int Layer in relation to the attached window, where positive is above and negative is below.

public voidsystemBooted()
Called when the system is done booting to the point where the user can start interacting with it.

public voidsystemReady()
Called when the system is mostly done booting.

public voiduserActivity()
Called when userActivity is signalled in the power manager. This is safe to call from any thread, with any window manager locks held or not.

public booleanvalidateRotationAnimationLw(int exitAnimId, int enterAnimId, boolean forceDefault)
Validate whether the current top fullscreen has specified the same {@link WindowManager.LayoutParams#rotationAnimation} value as that being passed in from the previous top fullscreen window.

param
exitAnimId exiting resource id from the previous window.
param
enterAnimId entering resource id from the previous window.
param
forceDefault For rotation animations only, if true ignore the animation values and just return false.
return
true if the previous values are still valid, false if they should be replaced with the default.

public voidwakingUp()
Called when the device is waking up.

public intwindowTypeToLayerLw(int type)
Assign a window type to a layer. Allows you to control how different kinds of windows are ordered on-screen.

param
type The type of window being assigned.
return
int An arbitrary integer used to order windows, with lower numbers below higher ones.