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

Commit 8e1d2d36 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Input: Rename transferTouch APIs

Rename the old 'transferTouchFocus' API to 'transferTouch' to avoid
confusion with window focus. The old 'transferTouch' method is
deprecated.

Bug: 324265767
Test: build
Change-Id: I115ebdfcb095a8e680b15b9a797ee58f2e6313da
parent f170535f
Loading
Loading
Loading
Loading
+18 −12
Original line number Original line Diff line number Diff line
@@ -61,20 +61,26 @@ public abstract class InputManagerInternal {
    public abstract void setPulseGestureEnabled(boolean enabled);
    public abstract void setPulseGestureEnabled(boolean enabled);


    /**
    /**
     * Atomically transfers touch focus from one window to another as identified by
     * Atomically transfers an active touch gesture from one window to another, as identified by
     * their input channels.  It is possible for multiple windows to have
     * their input channels.
     * touch focus if they support split touch dispatch
     *
     * {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} but this
     * <p>Only the touch gesture that is currently being dispatched to a window associated with
     * method only transfers touch focus of the specified window without affecting
     * {@code fromChannelToken} will be effected. That window will no longer receive
     * other windows that may also have touch focus at the same time.
     * the touch gesture (i.e. it will receive {@link android.view.MotionEvent#ACTION_CANCEL}).
     *
     * A window associated with the {@code toChannelToken} will receive the rest of the gesture
     * @param fromChannelToken The channel token of a window that currently has touch focus.
     * (i.e. beginning with {@link android.view.MotionEvent#ACTION_DOWN} or
     * @param toChannelToken The channel token of the window that should receive touch focus in
     * {@link android.view.MotionEvent#ACTION_POINTER_DOWN}).
     *
     * <p>Transferring touch gestures will have no impact on focused windows. If the {@code
     * toChannelToken} window is focusable, this will not bring focus to that window.
     *
     * @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.
     *   place of the first.
     * @return {@code true} if the transfer was successful. {@code false} if the window with the
     * @return True if the transfer was successful. False if the specified windows don't exist, or
     * specified channel did not actually have touch focus at the time of the request.
     *   if the source window is not actively receiving a touch gesture at the time of the request.
     */
     */
    public abstract boolean transferTouchFocus(@NonNull IBinder fromChannelToken,
    public abstract boolean transferTouchGesture(@NonNull IBinder fromChannelToken,
            @NonNull IBinder toChannelToken);
            @NonNull IBinder toChannelToken);


    /**
    /**
+34 −31
Original line number Original line Diff line number Diff line
@@ -737,7 +737,9 @@ public class InputManagerService extends IInputManager.Stub
     * @param destChannelToken The token of the window or input channel that should receive the
     * @param destChannelToken The token of the window or input channel that should receive the
     * gesture
     * gesture
     * @return True if the transfer succeeded, false if there was no active touch gesture happening
     * @return True if the transfer succeeded, false if there was no active touch gesture happening
     * @deprecated Use {@link #transferTouchGesture(IBinder, IBinder)}
     */
     */
    @Deprecated
    public boolean transferTouch(IBinder destChannelToken, int displayId) {
    public boolean transferTouch(IBinder destChannelToken, int displayId) {
        // TODO(b/162194035): Replace this with a SPY window
        // TODO(b/162194035): Replace this with a SPY window
        Objects.requireNonNull(destChannelToken, "destChannelToken must not be null");
        Objects.requireNonNull(destChannelToken, "destChannelToken must not be null");
@@ -1343,43 +1345,44 @@ public class InputManagerService extends IInputManager.Stub
    }
    }


    /**
    /**
     * Atomically transfers touch focus from one window to another as identified by
     * Start drag and drop.
     * their input channels.  It is possible for multiple windows to have
     *
     * touch focus if they support split touch dispatch
     * @param fromChannel The input channel that is currently receiving a touch gesture that should
     * {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} but this
     *                    be turned into the drag pointer.
     * method only transfers touch focus of the specified window without affecting
     * @param dragAndDropChannel The input channel associated with the system drag window.
     * other windows that may also have touch focus at the same time.
     * @return true if drag and drop was successfully started, false otherwise.
     * @param fromChannel The channel of a window that currently has touch focus.
     * @param toChannel The channel of the window that should receive touch focus in
     * place of the first.
     * @param isDragDrop True if transfer touch focus for drag and drop.
     * @return True if the transfer was successful.  False if the window with the
     * specified channel did not actually have touch focus at the time of the request.
     */
     */
    public boolean transferTouchFocus(@NonNull InputChannel fromChannel,
    public boolean startDragAndDrop(@NonNull InputChannel fromChannel,
            @NonNull InputChannel toChannel, boolean isDragDrop) {
            @NonNull InputChannel dragAndDropChannel) {
        return mNative.transferTouchFocus(fromChannel.getToken(), toChannel.getToken(),
        return mNative.transferTouchGesture(fromChannel.getToken(), dragAndDropChannel.getToken(),
                isDragDrop);
                true /* isDragDrop */);
    }
    }


    /**
    /**
     * Atomically transfers touch focus from one window to another as identified by
     * Atomically transfers an active touch gesture from one window to another, as identified by
     * their input channels.  It is possible for multiple windows to have
     * their input channels.
     * touch focus if they support split touch dispatch
     *
     * {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} but this
     * <p>Only the touch gesture that is currently being dispatched to a window associated with
     * method only transfers touch focus of the specified window without affecting
     * {@code fromChannelToken} will be effected. That window will no longer receive
     * other windows that may also have touch focus at the same time.
     * the touch gesture (i.e. it will receive {@link android.view.MotionEvent#ACTION_CANCEL}).
     * @param fromChannelToken The channel token of a window that currently has touch focus.
     * A window associated with the {@code toChannelToken} will receive the rest of the gesture
     * @param toChannelToken The channel token of the window that should receive touch focus in
     * (i.e. beginning with {@link android.view.MotionEvent#ACTION_DOWN} or
     * {@link android.view.MotionEvent#ACTION_POINTER_DOWN}).
     *
     * <p>Transferring touch gestures will have no impact on focused windows. If the {@code
     * toChannelToken} window is focusable, this will not bring focus to that window.
     *
     * @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.
     *   place of the first.
     * @return True if the transfer was successful.  False if the window with the
     * @return True if the transfer was successful. False if the specified windows don't exist, or
     * specified channel did not actually have touch focus at the time of the request.
     *   if the source window is not actively receiving a touch gesture at the time of the request.
     */
     */
    public boolean transferTouchFocus(@NonNull IBinder fromChannelToken,
    public boolean transferTouchGesture(@NonNull IBinder fromChannelToken,
            @NonNull IBinder toChannelToken) {
            @NonNull IBinder toChannelToken) {
        Objects.requireNonNull(fromChannelToken);
        Objects.requireNonNull(fromChannelToken);
        Objects.requireNonNull(toChannelToken);
        Objects.requireNonNull(toChannelToken);
        return mNative.transferTouchFocus(fromChannelToken, toChannelToken,
        return mNative.transferTouchGesture(fromChannelToken, toChannelToken,
                false /* isDragDrop */);
                false /* isDragDrop */);
    }
    }


@@ -3312,9 +3315,9 @@ public class InputManagerService extends IInputManager.Stub
        }
        }


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


        @Override
        @Override
+5 −2
Original line number Original line Diff line number Diff line
@@ -110,13 +110,15 @@ interface NativeInputManagerService {


    void setMinTimeBetweenUserActivityPokes(long millis);
    void setMinTimeBetweenUserActivityPokes(long millis);


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


    /**
    /**
     * Transfer the current touch gesture to the window identified by 'destChannelToken' positioned
     * Transfer the current touch gesture to the window identified by 'destChannelToken' positioned
     * on display with id 'displayId'.
     * on display with id 'displayId'.
     * @deprecated Use {@link #transferTouchGesture(IBinder, IBinder, boolean)}
     */
     */
    @Deprecated
    boolean transferTouch(IBinder destChannelToken, int displayId);
    boolean transferTouch(IBinder destChannelToken, int displayId);


    int getMousePointerSpeed();
    int getMousePointerSpeed();
@@ -359,10 +361,11 @@ interface NativeInputManagerService {
        public native void setMinTimeBetweenUserActivityPokes(long millis);
        public native void setMinTimeBetweenUserActivityPokes(long millis);


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


        @Override
        @Override
        @Deprecated
        public native boolean transferTouch(IBinder destChannelToken, int displayId);
        public native boolean transferTouch(IBinder destChannelToken, int displayId);


        @Override
        @Override
+1 −1
Original line number Original line Diff line number Diff line
@@ -5808,7 +5808,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                }
                }
                curHostInputToken = mCurHostInputToken;
                curHostInputToken = mCurHostInputToken;
            }
            }
            return mInputManagerInternal.transferTouchFocus(sourceInputToken, curHostInputToken);
            return mInputManagerInternal.transferTouchGesture(sourceInputToken, curHostInputToken);
        }
        }


        @Override
        @Override
+2 −2
Original line number Original line Diff line number Diff line
@@ -184,7 +184,7 @@ class EmbeddedWindowController {
        if (!isValidTouchGestureParams(transferToHostWindowState, ew)) {
        if (!isValidTouchGestureParams(transferToHostWindowState, ew)) {
            return false;
            return false;
        }
        }
        return mInputManagerService.transferTouchFocus(ew.getInputChannelToken(),
        return mInputManagerService.transferTouchGesture(ew.getInputChannelToken(),
                transferToHostWindowState.mInputChannelToken);
                transferToHostWindowState.mInputChannelToken);
    }
    }


@@ -193,7 +193,7 @@ class EmbeddedWindowController {
        if (!isValidTouchGestureParams(hostWindowState, ew)) {
        if (!isValidTouchGestureParams(hostWindowState, ew)) {
            return false;
            return false;
        }
        }
        return mInputManagerService.transferTouchFocus(hostWindowState.mInputChannelToken,
        return mInputManagerService.transferTouchGesture(hostWindowState.mInputChannelToken,
                ew.getInputChannelToken());
                ew.getInputChannelToken());
    }
    }


Loading