FileDocCategorySizeDatePackage
WindowManagerImpl.javaAPI DocAndroid 5.1 API4418Thu Mar 12 22:22:10 GMT 2015android.view

WindowManagerImpl

public final class WindowManagerImpl extends Object implements WindowManager
Provides 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.

see
WindowManager
see
WindowManagerGlobal
hide

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 voidaddView(View view, ViewGroup.LayoutParams params)

        applyDefaultToken(params);
        mGlobal.addView(view, params, mDisplay, mParentWindow);
    
private voidapplyDefaultToken(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.WindowManagerImplcreateLocalWindowManager(Window parentWindow)

        return new WindowManagerImpl(mDisplay, parentWindow);
    
public android.view.WindowManagerImplcreatePresentationWindowManager(Display display)

        return new WindowManagerImpl(display, mParentWindow);
    
public DisplaygetDefaultDisplay()

        return mDisplay;
    
public voidremoveView(View view)

        mGlobal.removeView(view, false);
    
public voidremoveViewImmediate(View view)

        mGlobal.removeView(view, true);
    
public voidsetDefaultToken(android.os.IBinder token)
Sets the window token to assign when none is specified by the client or available from the parent window.

param
token The default token to assign.

        mDefaultToken = token;
    
public voidupdateViewLayout(View view, ViewGroup.LayoutParams params)

        applyDefaultToken(params);
        mGlobal.updateViewLayout(view, params);