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

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

Do not store inputchannel in DragResizeInputListener

The channel is already stored inside the InputEventReceiver, and we can
get the channel token from there.

Bug: 323450804
Test: none
Flag: EXEMPT refactor
Change-Id: I87c1b09aae78a6a7233a188fe449c93731414772
parent a262e833
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ class DragResizeInputListener implements AutoCloseable {
    final IBinder mClientToken;

    private final SurfaceControl mDecorationSurface;
    private InputChannel mInputChannel;
    private TaskResizeInputEventReceiver mInputEventReceiver;

    private final Context mContext;
@@ -170,13 +169,12 @@ class DragResizeInputListener implements AutoCloseable {
                    return;
                }
                mInputSinkSurface = result.mInputSinkSurface;
                mInputChannel = result.mInputChannel;
                mSinkInputChannel = result.mSinkInputChannel;
                Trace.beginSection("DragResizeInputListener#ctor-initReceiver");
                mInputEventReceiver = mEventReceiverFactory.create(
                        mContext,
                        mTaskInfo,
                        mInputChannel,
                        result.mInputChannel,
                        mDragPositioningCallback,
                        mHandler,
                        mChoreographer,
@@ -341,7 +339,7 @@ class DragResizeInputListener implements AutoCloseable {

        try {
            mWindowSession.updateInputChannel(
                    mInputChannel.getToken(),
                    mInputEventReceiver.getToken(),
                    null /* hostInputToken */,
                    mDisplayId,
                    mDecorationSurface,
@@ -413,9 +411,6 @@ class DragResizeInputListener implements AutoCloseable {
        if (mInputEventReceiver != null) {
            mInputEventReceiver.dispose();
        }
        if (mInputChannel != null) {
            mInputChannel.dispose();
        }
        if (mSinkInputChannel != null) {
            mSinkInputChannel.dispose();
        }
@@ -501,7 +496,6 @@ class DragResizeInputListener implements AutoCloseable {
        @NonNull private final Context mContext;
        @NonNull private final RunningTaskInfo mTaskInfo;
        private final InputManager mInputManager;
        @NonNull private final InputChannel mInputChannel;
        @NonNull private final DragPositioningCallback mCallback;
        @NonNull private final Choreographer mChoreographer;
        @NonNull private final Runnable mConsumeBatchEventRunnable;
@@ -539,7 +533,6 @@ class DragResizeInputListener implements AutoCloseable {
            mContext = context;
            mTaskInfo = taskInfo;
            mInputManager = context.getSystemService(InputManager.class);
            mInputChannel = inputChannel;
            mCallback = callback;
            mChoreographer = choreographer;

@@ -677,7 +670,7 @@ class DragResizeInputListener implements AutoCloseable {
                    if (!mShouldHandleEvents) {
                        break;
                    }
                    mInputManager.pilferPointers(mInputChannel.getToken());
                    mInputManager.pilferPointers(getToken());
                    final int dragPointerIndex = e.findPointerIndex(mDragPointerId);
                    if (dragPointerIndex < 0) {
                        ProtoLog.d(WM_SHELL_DESKTOP_MODE,
@@ -791,7 +784,7 @@ class DragResizeInputListener implements AutoCloseable {
                ProtoLog.d(WM_SHELL_DESKTOP_MODE, "%s: update pointer icon from %d to %d",
                        TAG, mLastCursorType, cursorType);
                mInputManager.setPointerIcon(PointerIcon.getSystemIcon(mContext, cursorType),
                        displayId, deviceId, pointerId, mInputChannel.getToken());
                        displayId, deviceId, pointerId, getToken());
                mLastCursorType = cursorType;
            }
        }