WindowManagerImplpublic final class WindowManagerImpl extends Object implements WindowManagerProvides low-level communication with the system window manager for
operations that are bound to a particular context, display or parent window.
Instances of this object are sensitive to the compatibility info associated
with the running application.
This object implements the {@link ViewManager} interface,
allowing you to add any View subclass as a top-level window on the screen.
Additional window manager specific layout parameters are defined for
control over how windows are displayed. It also implements the {@link WindowManager}
interface, allowing you to control the displays attached to the device.
Applications will not normally use WindowManager directly, instead relying
on the higher-level facilities in {@link android.app.Activity} and
{@link android.app.Dialog}.
Even for low-level window manager access, it is almost never correct to use
this class. For example, {@link android.app.Activity#getWindowManager}
provides a window manager for adding windows that are associated with that
activity -- the window manager will not normally allow you to add arbitrary
windows that are not associated with an activity. |
Fields Summary |
---|
private final WindowManagerGlobal | mGlobal | private final Display | mDisplay | private final Window | mParentWindow | private android.os.IBinder | mDefaultToken |
Constructors Summary |
---|
public WindowManagerImpl(Display display)
this(display, null);
| private WindowManagerImpl(Display display, Window parentWindow)
mDisplay = display;
mParentWindow = parentWindow;
|
Methods Summary |
---|
public void | addView(View view, ViewGroup.LayoutParams params)
applyDefaultToken(params);
mGlobal.addView(view, params, mDisplay, mParentWindow);
| private void | applyDefaultToken(ViewGroup.LayoutParams params)
// Only use the default token if we don't have a parent window.
if (mDefaultToken != null && mParentWindow == null) {
if (!(params instanceof WindowManager.LayoutParams)) {
throw new IllegalArgumentException("Params must be WindowManager.LayoutParams");
}
// Only use the default token if we don't already have a token.
final WindowManager.LayoutParams wparams = (WindowManager.LayoutParams) params;
if (wparams.token == null) {
wparams.token = mDefaultToken;
}
}
| public android.view.WindowManagerImpl | createLocalWindowManager(Window parentWindow)
return new WindowManagerImpl(mDisplay, parentWindow);
| public android.view.WindowManagerImpl | createPresentationWindowManager(Display display)
return new WindowManagerImpl(display, mParentWindow);
| public Display | getDefaultDisplay()
return mDisplay;
| public void | removeView(View view)
mGlobal.removeView(view, false);
| public void | removeViewImmediate(View view)
mGlobal.removeView(view, true);
| public void | setDefaultToken(android.os.IBinder token)Sets the window token to assign when none is specified by the client or
available from the parent window.
mDefaultToken = token;
| public void | updateViewLayout(View view, ViewGroup.LayoutParams params)
applyDefaultToken(params);
mGlobal.updateViewLayout(view, params);
|
|