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

Commit 1045208e authored by Pierre Barbier de Reuille's avatar Pierre Barbier de Reuille
Browse files

Create the EventReceiver with the right display Id

The current context will almost always have the default display, we need
to create the EventReceiver with the displayId of the display it is
handling.

For testing, open a freeform window on a secondary display with the dev
option `Force Desktop Mode` (this registers an EventReceiver) and try
drag the app handle.

Bug: 352316177
Flag: EXEMPT bug fix
Test: Manual (see description)
Change-Id: I0f2ac32996bf356c8840d4974b98d70967aa00fb
parent c0ff9ea6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1040,7 +1040,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
    private void createInputChannel(int displayId) {
        final InputManager inputManager = mContext.getSystemService(InputManager.class);
        final InputMonitor inputMonitor =
                mInputMonitorFactory.create(inputManager, mContext);
                mInputMonitorFactory.create(inputManager, displayId);
        final EventReceiver eventReceiver = new EventReceiver(inputMonitor,
                inputMonitor.getInputChannel(), Looper.myLooper());
        mEventReceiversByDisplay.put(displayId, eventReceiver);
@@ -1194,8 +1194,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
    }

    static class InputMonitorFactory {
        InputMonitor create(InputManager inputManager, Context context) {
            return inputManager.monitorGestureInput("caption-touch", context.getDisplayId());
        InputMonitor create(InputManager inputManager, int displayId) {
            return inputManager.monitorGestureInput("caption-touch", displayId);
        }
    }