FileDocCategorySizeDatePackage
FakeWindowImpl.javaAPI DocAndroid 5.1 API4194Thu Mar 12 22:22:42 GMT 2015com.android.server.wm

FakeWindowImpl

public final class FakeWindowImpl extends Object implements WindowManagerPolicy.FakeWindow

Fields Summary
final WindowManagerService
mService
final android.view.InputChannel
mServerChannel
final android.view.InputChannel
mClientChannel
final com.android.server.input.InputApplicationHandle
mApplicationHandle
final com.android.server.input.InputWindowHandle
mWindowHandle
final android.view.InputEventReceiver
mInputEventReceiver
final int
mWindowLayer
boolean
mTouchFullscreen
Constructors Summary
public FakeWindowImpl(WindowManagerService service, android.os.Looper looper, InputEventReceiver.Factory inputEventReceiverFactory, String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen)

        mService = service;

        InputChannel[] channels = InputChannel.openInputChannelPair(name);
        mServerChannel = channels[0];
        mClientChannel = channels[1];
        mService.mInputManager.registerInputChannel(mServerChannel, null);

        mInputEventReceiver = inputEventReceiverFactory.createInputEventReceiver(
                mClientChannel, looper);

        mApplicationHandle = new InputApplicationHandle(null);
        mApplicationHandle.name = name;
        mApplicationHandle.dispatchingTimeoutNanos =
                WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;

        mWindowHandle = new InputWindowHandle(mApplicationHandle, null, Display.DEFAULT_DISPLAY);
        mWindowHandle.name = name;
        mWindowHandle.inputChannel = mServerChannel;
        mWindowLayer = getLayerLw(windowType);
        mWindowHandle.layer = mWindowLayer;
        mWindowHandle.layoutParamsFlags = layoutParamsFlags;
        mWindowHandle.layoutParamsType = windowType;
        mWindowHandle.dispatchingTimeoutNanos =
                WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        mWindowHandle.visible = true;
        mWindowHandle.canReceiveKeys = canReceiveKeys;
        mWindowHandle.hasFocus = hasFocus;
        mWindowHandle.hasWallpaper = false;
        mWindowHandle.paused = false;
        mWindowHandle.ownerPid = Process.myPid();
        mWindowHandle.ownerUid = Process.myUid();
        mWindowHandle.inputFeatures = 0;
        mWindowHandle.scaleFactor = 1.0f;

        mTouchFullscreen = touchFullscreen;
    
Methods Summary
public voiddismiss()

        synchronized (mService.mWindowMap) {
            if (mService.removeFakeWindowLocked(this)) {
                mInputEventReceiver.dispose();
                mService.mInputManager.unregisterInputChannel(mServerChannel);
                mClientChannel.dispose();
                mServerChannel.dispose();
            }
        }
    
private intgetLayerLw(int windowType)

        return mService.mPolicy.windowTypeToLayerLw(windowType)
                * WindowManagerService.TYPE_LAYER_MULTIPLIER
                + WindowManagerService.TYPE_LAYER_OFFSET;
    
voidlayout(int dw, int dh)

        if (mTouchFullscreen) {
            mWindowHandle.touchableRegion.set(0, 0, dw, dh);
        } else {
            mWindowHandle.touchableRegion.setEmpty();
        }
        mWindowHandle.frameLeft = 0;
        mWindowHandle.frameTop = 0;
        mWindowHandle.frameRight = dw;
        mWindowHandle.frameBottom = dh;