Search in sources :

Example 6 with InputWindowHandle

use of com.android.server.input.InputWindowHandle in project android_frameworks_base by DirtyUnicorns.

the class DragState method register.

/**
     * @param display The Display that the window being dragged is on.
     */
void register(Display display) {
    if (DEBUG_DRAG)
        Slog.d(TAG_WM, "registering drag input channel");
    if (mClientChannel != null) {
        Slog.e(TAG_WM, "Duplicate register of drag input channel");
    } else {
        mDisplayContent = mService.getDisplayContentLocked(display.getDisplayId());
        InputChannel[] channels = InputChannel.openInputChannelPair("drag");
        mServerChannel = channels[0];
        mClientChannel = channels[1];
        mService.mInputManager.registerInputChannel(mServerChannel, null);
        mInputEventReceiver = mService.new DragInputEventReceiver(mClientChannel, mService.mH.getLooper());
        mDragApplicationHandle = new InputApplicationHandle(null);
        mDragApplicationHandle.name = "drag";
        mDragApplicationHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null, display.getDisplayId());
        mDragWindowHandle.name = "drag";
        mDragWindowHandle.inputChannel = mServerChannel;
        mDragWindowHandle.layer = getDragLayerLw();
        mDragWindowHandle.layoutParamsFlags = 0;
        mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
        mDragWindowHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        mDragWindowHandle.visible = true;
        mDragWindowHandle.canReceiveKeys = false;
        mDragWindowHandle.hasFocus = true;
        mDragWindowHandle.hasWallpaper = false;
        mDragWindowHandle.paused = false;
        mDragWindowHandle.ownerPid = Process.myPid();
        mDragWindowHandle.ownerUid = Process.myUid();
        mDragWindowHandle.inputFeatures = 0;
        mDragWindowHandle.scaleFactor = 1.0f;
        // The drag window cannot receive new touches.
        mDragWindowHandle.touchableRegion.setEmpty();
        // The drag window covers the entire display
        mDragWindowHandle.frameLeft = 0;
        mDragWindowHandle.frameTop = 0;
        Point p = new Point();
        display.getRealSize(p);
        mDragWindowHandle.frameRight = p.x;
        mDragWindowHandle.frameBottom = p.y;
        // Pause rotations before a drag.
        if (DEBUG_ORIENTATION) {
            Slog.d(TAG_WM, "Pausing rotation during drag");
        }
        mService.pauseRotationLocked();
    }
}
Also used : InputApplicationHandle(com.android.server.input.InputApplicationHandle) DragInputEventReceiver(com.android.server.wm.WindowManagerService.DragInputEventReceiver) InputChannel(android.view.InputChannel) Point(android.graphics.Point) InputWindowHandle(com.android.server.input.InputWindowHandle)

Example 7 with InputWindowHandle

use of com.android.server.input.InputWindowHandle in project android_frameworks_base by ResurrectionRemix.

the class DragState method register.

/**
     * @param display The Display that the window being dragged is on.
     */
void register(Display display) {
    if (DEBUG_DRAG)
        Slog.d(TAG_WM, "registering drag input channel");
    if (mClientChannel != null) {
        Slog.e(TAG_WM, "Duplicate register of drag input channel");
    } else {
        mDisplayContent = mService.getDisplayContentLocked(display.getDisplayId());
        InputChannel[] channels = InputChannel.openInputChannelPair("drag");
        mServerChannel = channels[0];
        mClientChannel = channels[1];
        mService.mInputManager.registerInputChannel(mServerChannel, null);
        mInputEventReceiver = mService.new DragInputEventReceiver(mClientChannel, mService.mH.getLooper());
        mDragApplicationHandle = new InputApplicationHandle(null);
        mDragApplicationHandle.name = "drag";
        mDragApplicationHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null, display.getDisplayId());
        mDragWindowHandle.name = "drag";
        mDragWindowHandle.inputChannel = mServerChannel;
        mDragWindowHandle.layer = getDragLayerLw();
        mDragWindowHandle.layoutParamsFlags = 0;
        mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
        mDragWindowHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        mDragWindowHandle.visible = true;
        mDragWindowHandle.canReceiveKeys = false;
        mDragWindowHandle.hasFocus = true;
        mDragWindowHandle.hasWallpaper = false;
        mDragWindowHandle.paused = false;
        mDragWindowHandle.ownerPid = Process.myPid();
        mDragWindowHandle.ownerUid = Process.myUid();
        mDragWindowHandle.inputFeatures = 0;
        mDragWindowHandle.scaleFactor = 1.0f;
        // The drag window cannot receive new touches.
        mDragWindowHandle.touchableRegion.setEmpty();
        // The drag window covers the entire display
        mDragWindowHandle.frameLeft = 0;
        mDragWindowHandle.frameTop = 0;
        Point p = new Point();
        display.getRealSize(p);
        mDragWindowHandle.frameRight = p.x;
        mDragWindowHandle.frameBottom = p.y;
        // Pause rotations before a drag.
        if (DEBUG_ORIENTATION) {
            Slog.d(TAG_WM, "Pausing rotation during drag");
        }
        mService.pauseRotationLocked();
    }
}
Also used : InputApplicationHandle(com.android.server.input.InputApplicationHandle) DragInputEventReceiver(com.android.server.wm.WindowManagerService.DragInputEventReceiver) InputChannel(android.view.InputChannel) Point(android.graphics.Point) InputWindowHandle(com.android.server.input.InputWindowHandle)

Example 8 with InputWindowHandle

use of com.android.server.input.InputWindowHandle in project platform_frameworks_base by android.

the class DragState method register.

/**
     * @param display The Display that the window being dragged is on.
     */
void register(Display display) {
    if (DEBUG_DRAG)
        Slog.d(TAG_WM, "registering drag input channel");
    if (mClientChannel != null) {
        Slog.e(TAG_WM, "Duplicate register of drag input channel");
    } else {
        mDisplayContent = mService.getDisplayContentLocked(display.getDisplayId());
        InputChannel[] channels = InputChannel.openInputChannelPair("drag");
        mServerChannel = channels[0];
        mClientChannel = channels[1];
        mService.mInputManager.registerInputChannel(mServerChannel, null);
        mInputEventReceiver = mService.new DragInputEventReceiver(mClientChannel, mService.mH.getLooper());
        mDragApplicationHandle = new InputApplicationHandle(null);
        mDragApplicationHandle.name = "drag";
        mDragApplicationHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null, display.getDisplayId());
        mDragWindowHandle.name = "drag";
        mDragWindowHandle.inputChannel = mServerChannel;
        mDragWindowHandle.layer = getDragLayerLw();
        mDragWindowHandle.layoutParamsFlags = 0;
        mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
        mDragWindowHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
        mDragWindowHandle.visible = true;
        mDragWindowHandle.canReceiveKeys = false;
        mDragWindowHandle.hasFocus = true;
        mDragWindowHandle.hasWallpaper = false;
        mDragWindowHandle.paused = false;
        mDragWindowHandle.ownerPid = Process.myPid();
        mDragWindowHandle.ownerUid = Process.myUid();
        mDragWindowHandle.inputFeatures = 0;
        mDragWindowHandle.scaleFactor = 1.0f;
        // The drag window cannot receive new touches.
        mDragWindowHandle.touchableRegion.setEmpty();
        // The drag window covers the entire display
        mDragWindowHandle.frameLeft = 0;
        mDragWindowHandle.frameTop = 0;
        Point p = new Point();
        display.getRealSize(p);
        mDragWindowHandle.frameRight = p.x;
        mDragWindowHandle.frameBottom = p.y;
        // Pause rotations before a drag.
        if (DEBUG_ORIENTATION) {
            Slog.d(TAG_WM, "Pausing rotation during drag");
        }
        mService.pauseRotationLocked();
    }
}
Also used : InputApplicationHandle(com.android.server.input.InputApplicationHandle) DragInputEventReceiver(com.android.server.wm.WindowManagerService.DragInputEventReceiver) InputChannel(android.view.InputChannel) Point(android.graphics.Point) InputWindowHandle(com.android.server.input.InputWindowHandle)

Example 9 with InputWindowHandle

use of com.android.server.input.InputWindowHandle in project cornerstone by Onskreen.

the class InputMonitor method updateInputWindowsLw.

/* Updates the cached window information provided to the input dispatcher. */
public void updateInputWindowsLw(boolean force) {
    if (!force && !mUpdateInputWindowsNeeded) {
        return;
    }
    mUpdateInputWindowsNeeded = false;
    if (false)
        Slog.d(WindowManagerService.TAG, ">>>>>> ENTERED updateInputWindowsLw");
    // Populate the input window list with information about all of the windows that
    // could potentially receive input.
    // As an optimization, we could try to prune the list of windows but this turns
    // out to be difficult because only the native code knows for sure which window
    // currently has touch focus.
    final ArrayList<WindowState> windows = mService.mWindows;
    // If there's a drag in flight, provide a pseudowindow to catch drag input
    final boolean inDrag = (mService.mDragState != null);
    if (inDrag) {
        if (WindowManagerService.DEBUG_DRAG) {
            Log.d(WindowManagerService.TAG, "Inserting drag window");
        }
        final InputWindowHandle dragWindowHandle = mService.mDragState.mDragWindowHandle;
        if (dragWindowHandle != null) {
            addInputWindowHandleLw(dragWindowHandle);
        } else {
            Slog.w(WindowManagerService.TAG, "Drag is in progress but there is no " + "drag window handle.");
        }
    }
    final int NFW = mService.mFakeWindows.size();
    for (int i = 0; i < NFW; i++) {
        addInputWindowHandleLw(mService.mFakeWindows.get(i).mWindowHandle);
    }
    final int N = windows.size();
    for (int i = N - 1; i >= 0; i--) {
        final WindowState child = windows.get(i);
        final InputChannel inputChannel = child.mInputChannel;
        final InputWindowHandle inputWindowHandle = child.mInputWindowHandle;
        if (inputChannel == null || inputWindowHandle == null || child.mRemoved) {
            // Skip this window because it cannot possibly receive input.
            continue;
        }
        final int flags = child.mAttrs.flags;
        final int type = child.mAttrs.type;
        final boolean hasFocus = (child == mInputFocus);
        final boolean isVisible = child.isVisibleLw();
        final boolean hasWallpaper = (child == mService.mWallpaperTarget) && (type != WindowManager.LayoutParams.TYPE_KEYGUARD);
        // make sure it's been told about the drag
        if (inDrag && isVisible) {
            mService.mDragState.sendDragStartedIfNeededLw(child);
        }
        // Add a window to our list of input windows.
        inputWindowHandle.name = child.toString();
        inputWindowHandle.layoutParamsFlags = flags;
        inputWindowHandle.layoutParamsType = type;
        inputWindowHandle.dispatchingTimeoutNanos = child.getInputDispatchingTimeoutNanos();
        inputWindowHandle.visible = isVisible;
        inputWindowHandle.canReceiveKeys = child.canReceiveKeys();
        inputWindowHandle.hasFocus = hasFocus;
        inputWindowHandle.hasWallpaper = hasWallpaper;
        inputWindowHandle.paused = child.mAppToken != null ? child.mAppToken.paused : false;
        inputWindowHandle.layer = child.mLayer;
        inputWindowHandle.ownerPid = child.mSession.mPid;
        inputWindowHandle.ownerUid = child.mSession.mUid;
        inputWindowHandle.inputFeatures = child.mAttrs.inputFeatures;
        final Rect frame = child.mFrame;
        inputWindowHandle.frameLeft = frame.left;
        inputWindowHandle.frameTop = frame.top;
        inputWindowHandle.frameRight = frame.right;
        inputWindowHandle.frameBottom = frame.bottom;
        if (child.mGlobalScale != 1) {
            // If we are scaling the window, input coordinates need
            // to be inversely scaled to map from what is on screen
            // to what is actually being touched in the UI.
            inputWindowHandle.scaleFactor = 1.0f / child.mGlobalScale;
        } else {
            inputWindowHandle.scaleFactor = 1;
        }
        child.getTouchableRegion(inputWindowHandle.touchableRegion);
        addInputWindowHandleLw(inputWindowHandle);
    }
    // Send windows to native code.
    mService.mInputManager.setInputWindows(mInputWindowHandles);
    // Clear the list in preparation for the next round.
    clearInputWindowHandlesLw();
    if (false)
        Slog.d(WindowManagerService.TAG, "<<<<<<< EXITED updateInputWindowsLw");
}
Also used : Rect(android.graphics.Rect) InputChannel(android.view.InputChannel) InputWindowHandle(com.android.server.input.InputWindowHandle)

Example 10 with InputWindowHandle

use of com.android.server.input.InputWindowHandle in project android_frameworks_base by DirtyUnicorns.

the class TaskPositioner method register.

/**
     * @param display The Display that the window being dragged is on.
     */
void register(Display display) {
    if (DEBUG_TASK_POSITIONING) {
        Slog.d(TAG, "Registering task positioner");
    }
    if (mClientChannel != null) {
        Slog.e(TAG, "Task positioner already registered");
        return;
    }
    mDisplay = display;
    mDisplay.getMetrics(mDisplayMetrics);
    final InputChannel[] channels = InputChannel.openInputChannelPair(TAG);
    mServerChannel = channels[0];
    mClientChannel = channels[1];
    mService.mInputManager.registerInputChannel(mServerChannel, null);
    mInputEventReceiver = new WindowPositionerEventReceiver(mClientChannel, mService.mH.getLooper(), mService.mChoreographer);
    mDragApplicationHandle = new InputApplicationHandle(null);
    mDragApplicationHandle.name = TAG;
    mDragApplicationHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
    mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null, mDisplay.getDisplayId());
    mDragWindowHandle.name = TAG;
    mDragWindowHandle.inputChannel = mServerChannel;
    mDragWindowHandle.layer = mService.getDragLayerLocked();
    mDragWindowHandle.layoutParamsFlags = 0;
    mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
    mDragWindowHandle.dispatchingTimeoutNanos = WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
    mDragWindowHandle.visible = true;
    mDragWindowHandle.canReceiveKeys = false;
    mDragWindowHandle.hasFocus = true;
    mDragWindowHandle.hasWallpaper = false;
    mDragWindowHandle.paused = false;
    mDragWindowHandle.ownerPid = Process.myPid();
    mDragWindowHandle.ownerUid = Process.myUid();
    mDragWindowHandle.inputFeatures = 0;
    mDragWindowHandle.scaleFactor = 1.0f;
    // The drag window cannot receive new touches.
    mDragWindowHandle.touchableRegion.setEmpty();
    // The drag window covers the entire display
    mDragWindowHandle.frameLeft = 0;
    mDragWindowHandle.frameTop = 0;
    final Point p = new Point();
    mDisplay.getRealSize(p);
    mDragWindowHandle.frameRight = p.x;
    mDragWindowHandle.frameBottom = p.y;
    // Pause rotations before a drag.
    if (DEBUG_ORIENTATION) {
        Slog.d(TAG, "Pausing rotation during re-position");
    }
    mService.pauseRotationLocked();
    mDimLayer = new DimLayer(mService, this, mDisplay.getDisplayId(), TAG_LOCAL);
    mSideMargin = dipToPixel(SIDE_MARGIN_DIP, mDisplayMetrics);
    mMinVisibleWidth = dipToPixel(MINIMUM_VISIBLE_WIDTH_IN_DP, mDisplayMetrics);
    mMinVisibleHeight = dipToPixel(MINIMUM_VISIBLE_HEIGHT_IN_DP, mDisplayMetrics);
    mDragEnded = false;
}
Also used : InputApplicationHandle(com.android.server.input.InputApplicationHandle) InputChannel(android.view.InputChannel) Point(android.graphics.Point) InputWindowHandle(com.android.server.input.InputWindowHandle)

Aggregations

InputChannel (android.view.InputChannel)15 InputWindowHandle (com.android.server.input.InputWindowHandle)15 Point (android.graphics.Point)9 InputApplicationHandle (com.android.server.input.InputApplicationHandle)9 DragInputEventReceiver (com.android.server.wm.WindowManagerService.DragInputEventReceiver)5 Rect (android.graphics.Rect)1