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

Commit 1908ec79 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Allow EmbeddedWindowController to transfer entire gesture

This is needed to maintain some of the previous behaviour that was
removed when splitting code was cleaned up.

Since this is part of the current API, we should maintain the behaviour
advertised by WindowManager::transferTouchGesture, until it's
deprecated.

Bug: 397979572
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Flag: com.android.input.flags.allow_transfer_of_entire_gesture
Change-Id: Ifb9335041b7881d72f4b57a59b9aea281e28370f
parent 85b44c1b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -104,11 +104,16 @@ public abstract class InputManagerInternal {
     * @param fromChannelToken The channel token of a window that has an active touch gesture.
     * @param toChannelToken The channel token of the window that should receive the gesture in
     *   place of the first.
     * @param transferEntireGesture Whether the entire gesture (including subsequent POINTER_DOWN
     *                              events) should be transferred. This should always be set to
     *                              'false' unless you have the permission from the input team to
     *                              set it to true. This behaviour will be removed in future
     *                              versions.
     * @return True if the transfer was successful. False if the specified windows don't exist, or
     *   if the source window is not actively receiving a touch gesture at the time of the request.
     */
    public abstract boolean transferTouchGesture(@NonNull IBinder fromChannelToken,
            @NonNull IBinder toChannelToken);
            @NonNull IBinder toChannelToken, boolean transferEntireGesture);

    /**
     * Gets the current position of the mouse cursor.
+6 −5
Original line number Diff line number Diff line
@@ -1370,7 +1370,7 @@ public class InputManagerService extends IInputManager.Stub
    public boolean startDragAndDrop(@NonNull IBinder fromChannelToken,
            @NonNull IBinder dragAndDropChannelToken) {
        return mNative.transferTouchGesture(fromChannelToken, dragAndDropChannelToken,
                true /* isDragDrop */);
                true /* isDragDrop */, false /* transferEntireGesture */);
    }

    /**
@@ -1394,11 +1394,11 @@ public class InputManagerService extends IInputManager.Stub
     *   if the source window is not actively receiving a touch gesture at the time of the request.
     */
    public boolean transferTouchGesture(@NonNull IBinder fromChannelToken,
            @NonNull IBinder toChannelToken) {
            @NonNull IBinder toChannelToken, boolean transferEntireGesture) {
        Objects.requireNonNull(fromChannelToken);
        Objects.requireNonNull(toChannelToken);
        return mNative.transferTouchGesture(fromChannelToken, toChannelToken,
                false /* isDragDrop */);
                false /* isDragDrop */, transferEntireGesture);
    }

    @Override // Binder call
@@ -3703,8 +3703,9 @@ public class InputManagerService extends IInputManager.Stub

        @Override
        public boolean transferTouchGesture(@NonNull IBinder fromChannelToken,
                @NonNull IBinder toChannelToken) {
            return InputManagerService.this.transferTouchGesture(fromChannelToken, toChannelToken);
                @NonNull IBinder toChannelToken, boolean transferEntireGesture) {
            return InputManagerService.this.transferTouchGesture(
                    fromChannelToken, toChannelToken, transferEntireGesture);
        }

        @Override
+2 −2
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ interface NativeInputManagerService {
    void setMinTimeBetweenUserActivityPokes(long millis);

    boolean transferTouchGesture(IBinder fromChannelToken, IBinder toChannelToken,
            boolean isDragDrop);
            boolean isDragDrop, boolean transferEntireGesture);

    /**
     * Transfer the current touch gesture to the window identified by 'destChannelToken' positioned
@@ -420,7 +420,7 @@ interface NativeInputManagerService {

        @Override
        public native boolean transferTouchGesture(IBinder fromChannelToken, IBinder toChannelToken,
                boolean isDragDrop);
                boolean isDragDrop, boolean transferEntireGesture);

        @Override
        @Deprecated
+2 −1
Original line number Diff line number Diff line
@@ -5800,7 +5800,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                    return false;
                }
            }
            return mInputManagerInternal.transferTouchGesture(sourceInputToken, curHostInputToken);
            return mInputManagerInternal.transferTouchGesture(
                    sourceInputToken, curHostInputToken, /* transferEntireGesture */ false);
        }

        @Override
+3 −2
Original line number Diff line number Diff line
@@ -209,7 +209,8 @@ class EmbeddedWindowController {
                    "Transfer request must originate from owner of transferFromToken");
        }
        final boolean didTransfer = mInputManagerService.transferTouchGesture(
                ew.getInputChannelToken(), transferToHostWindowState.mInputChannelToken);
                ew.getInputChannelToken(), transferToHostWindowState.mInputChannelToken,
                /* transferEntireGesture */ true);
        if (didTransfer) {
            ew.mGestureToEmbedded = false;
        }
@@ -228,7 +229,7 @@ class EmbeddedWindowController {
        }
        final boolean didTransfer = mInputManagerService.transferTouchGesture(
                hostWindowState.mInputChannelToken,
                ew.getInputChannelToken());
                ew.getInputChannelToken(), /* transferEntireGesture */ true);
        if (didTransfer) {
            ew.mGestureToEmbedded = true;
            mAtmService.mBackNavigationController.onEmbeddedWindowGestureTransferred(
Loading