Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a79a54d8 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

DragState: do not store InputChannel explicitly

The receiver should be managing the input channel instead.

Bug: 323450804
Test: none
Flag: EXEMPT refactor
Change-Id: I2ae2bc4e55c96aa9cc935e5de2b179e10f4d8dc5
parent bd028a1b
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -415,14 +415,13 @@ class DragState {
    }

    class InputInterceptor {
        InputChannel mClientChannel;
        DragInputEventReceiver mInputEventReceiver;
        InputApplicationHandle mDragApplicationHandle;
        InputWindowHandle mDragWindowHandle;

        InputInterceptor(Display display) {
            mClientChannel = mService.mInputManager.createInputChannel("drag");
            mInputEventReceiver = new DragInputEventReceiver(mClientChannel,
            InputChannel clientChannel = mService.mInputManager.createInputChannel("drag");
            mInputEventReceiver = new DragInputEventReceiver(clientChannel,
                    mService.mH.getLooper(), mDragDropController);

            mDragApplicationHandle = new InputApplicationHandle(new Binder(), "drag",
@@ -431,7 +430,7 @@ class DragState {
            mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle,
                    display.getDisplayId());
            mDragWindowHandle.name = "drag";
            mDragWindowHandle.token = mClientChannel.getToken();
            mDragWindowHandle.token = mInputEventReceiver.getToken();
            mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
            mDragWindowHandle.dispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
            mDragWindowHandle.ownerPid = MY_PID;
@@ -450,11 +449,9 @@ class DragState {
        }

        void tearDown() {
            mService.mInputManager.removeInputChannel(mClientChannel.getToken());
            mService.mInputManager.removeInputChannel(mInputEventReceiver.getToken());
            mInputEventReceiver.dispose();
            mInputEventReceiver = null;
            mClientChannel.dispose();
            mClientChannel = null;

            mDragWindowHandle = null;
            mDragApplicationHandle = null;
@@ -472,10 +469,10 @@ class DragState {
    }

    IBinder getInputToken() {
        if (mInputInterceptor == null || mInputInterceptor.mClientChannel == null) {
        if (mInputInterceptor == null || mInputInterceptor.mInputEventReceiver == null) {
            return null;
        }
        return mInputInterceptor.mClientChannel.getToken();
        return mInputInterceptor.mInputEventReceiver.getToken();
    }

    /**