Search in sources :

Example 31 with InputChannel

use of android.view.InputChannel in project android_frameworks_base by crdroidandroid.

the class TvInputManagerService method createSessionInternalLocked.

private void createSessionInternalLocked(ITvInputService service, IBinder sessionToken, int userId) {
    UserState userState = getOrCreateUserStateLocked(userId);
    SessionState sessionState = userState.sessionStateMap.get(sessionToken);
    if (DEBUG) {
        Slog.d(TAG, "createSessionInternalLocked(inputId=" + sessionState.inputId + ")");
    }
    InputChannel[] channels = InputChannel.openInputChannelPair(sessionToken.toString());
    // Set up a callback to send the session token.
    ITvInputSessionCallback callback = new SessionCallback(sessionState, channels);
    // Create a session. When failed, send a null token immediately.
    try {
        if (sessionState.isRecordingSession) {
            service.createRecordingSession(callback, sessionState.inputId);
        } else {
            service.createSession(channels[1], callback, sessionState.inputId);
        }
    } catch (RemoteException e) {
        Slog.e(TAG, "error in createSession", e);
        removeSessionStateLocked(sessionToken, userId);
        sendSessionTokenToClientLocked(sessionState.client, sessionState.inputId, null, null, sessionState.seq);
    }
    channels[1].dispose();
}
Also used : InputChannel(android.view.InputChannel) ITvInputSessionCallback(android.media.tv.ITvInputSessionCallback) RemoteException(android.os.RemoteException) ITvInputSessionCallback(android.media.tv.ITvInputSessionCallback)

Example 32 with InputChannel

use of android.view.InputChannel in project android_frameworks_base by crdroidandroid.

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)32 InputWindowHandle (com.android.server.input.InputWindowHandle)15 Point (android.graphics.Point)11 SomeArgs (com.android.internal.os.SomeArgs)11 RemoteException (android.os.RemoteException)10 InputApplicationHandle (com.android.server.input.InputApplicationHandle)9 IInputMethod (com.android.internal.view.IInputMethod)6 IInputMethodClient (com.android.internal.view.IInputMethodClient)6 IInputSessionCallback (com.android.internal.view.IInputSessionCallback)6 InputBindResult (com.android.internal.view.InputBindResult)6 HdmiDeviceInfo (android.hardware.hdmi.HdmiDeviceInfo)5 EditorInfo (android.view.inputmethod.EditorInfo)5 IInputContext (com.android.internal.view.IInputContext)5 DragInputEventReceiver (com.android.server.wm.WindowManagerService.DragInputEventReceiver)5 ITvInputSessionCallback (android.media.tv.ITvInputSessionCallback)4 Rect (android.graphics.Rect)1