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

Commit 816c1b3c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Initiate drag and drop using channel tokens" into main

parents 325cdf65 7aef3e50
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1259,9 +1259,9 @@ public class InputManagerService extends IInputManager.Stub
     * @param dragAndDropChannel The input channel associated with the system drag window.
     * @return true if drag and drop was successfully started, false otherwise.
     */
    public boolean startDragAndDrop(@NonNull InputChannel fromChannel,
    public boolean startDragAndDrop(@NonNull IBinder fromChannelToken,
            @NonNull InputChannel dragAndDropChannel) {
        return mNative.transferTouchGesture(fromChannel.getToken(), dragAndDropChannel.getToken(),
        return mNative.transferTouchGesture(fromChannelToken, dragAndDropChannel.getToken(),
                true /* isDragDrop */);
    }

+1 −1
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ public abstract class WindowManagerInternal {
                InputChannel source) {
            return state.register(display)
                .thenApply(unused ->
                    service.startDragAndDrop(source, state.getInputChannel()));
                    service.startDragAndDrop(source.getToken(), state.getInputChannel()));
        }

        /**
+4 −5
Original line number Diff line number Diff line
@@ -152,8 +152,8 @@ public class DragDropControllerTests extends WindowTestsBase {
        // Use a new TestIWindow so we don't collect events for other windows
        final WindowState window = createWindow(
                null, TYPE_BASE_APPLICATION, activity, name, ownerId, false, new TestIWindow());
        window.mInputChannel = new InputChannel();
        window.mInputChannelToken = window.mInputChannel.getToken();
        InputChannel channel = new InputChannel();
        window.openInputChannel(channel);
        window.mHasSurface = true;
        mWm.mWindowMap.put(window.mClient.asBinder(), window);
        mWm.mInputToWindowMap.put(window.mInputChannelToken, window);
@@ -178,7 +178,7 @@ public class DragDropControllerTests extends WindowTestsBase {
                TEST_PID, TEST_UID);
        mWindow = createDropTargetWindow("Drag test window", 0);
        doReturn(mWindow).when(mDisplayContent).getTouchableWinAtPointLocked(0, 0);
        when(mWm.mInputManager.startDragAndDrop(any(InputChannel.class),
        when(mWm.mInputManager.startDragAndDrop(any(IBinder.class),
                any(InputChannel.class))).thenReturn(true);

        mWm.mWindowMap.put(mWindow.mClient.asBinder(), mWindow);
@@ -707,8 +707,7 @@ public class DragDropControllerTests extends WindowTestsBase {
                    .setFormat(PixelFormat.TRANSLUCENT)
                    .build();

            assertTrue(mWm.mInputManager.startDragAndDrop(new InputChannel(),
                    new InputChannel()));
            assertTrue(mWm.mInputManager.startDragAndDrop(new Binder(), new InputChannel()));
            mToken = mTarget.performDrag(TEST_PID, 0, mWindow.mClient,
                    flag, surface, 0, 0, 0, 0, 0, 0, 0, data);
            assertNotNull(mToken);