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

Commit 8e8e9049 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Clean up APIs for transferTouchGesture" into main

parents 32d5fdd7 32e59451
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ public interface AttachedSurfaceControl {
     * {@link WindowManager#registerUnbatchedSurfaceControlInputReceiver(int, InputTransferToken,
     * SurfaceControl, Looper, SurfaceControlInputReceiver)}
     *
     * @return The SurfaceControlViewHost link token.
     * @return The {@link InputTransferToken} for the {@link AttachedSurfaceControl}
     * @throws IllegalStateException if the {@link AttachedSurfaceControl} was created with no
     * registered input
     */
+1 −0
Original line number Diff line number Diff line
@@ -293,6 +293,7 @@ public class SurfaceControlViewHost {
        /**
         * Gets an {@link InputTransferToken} which can be used to request focus on the embedded
         * surface or to transfer touch gesture to the embedded surface.
         *
         * @return the InputTransferToken associated with {@link SurfacePackage} or {@code null} if
         * the embedded hasn't set up its view or doesn't have input.
         * @see WindowManager#transferTouchGesture(InputTransferToken, InputTransferToken)
+10 −11
Original line number Diff line number Diff line
@@ -6184,7 +6184,7 @@ public interface WindowManager extends ViewManager {
     * receive batched input event. For those events that are batched, the invocation will happen
     * once per {@link Choreographer} frame, and other input events will be delivered immediately.
     * This is different from
     * { #registerUnbatchedSurfaceControlInputReceiver(int, InputTransferToken, SurfaceControl,
     * {@link #registerUnbatchedSurfaceControlInputReceiver(int, InputTransferToken, SurfaceControl,
     * Looper, SurfaceControlInputReceiver)} in that the input events are received batched. The
     * caller must invoke {@link #unregisterSurfaceControlInputReceiver(SurfaceControl)} to clean up
     * the resources when no longer needing to use the {@link SurfaceControlInputReceiver}
@@ -6253,10 +6253,9 @@ public interface WindowManager extends ViewManager {
     * <p>
     * Must be called on the same {@link Looper} thread to which was passed to the
     * {@link #registerBatchedSurfaceControlInputReceiver(int, InputTransferToken, SurfaceControl,
     * Choreographer,
     * SurfaceControlInputReceiver)} or
     * {@link #registerUnbatchedSurfaceControlInputReceiver(int, InputTransferToken, SurfaceControl, Looper,
     * SurfaceControlInputReceiver)}
     * Choreographer, SurfaceControlInputReceiver)} or
     * {@link #registerUnbatchedSurfaceControlInputReceiver(int, InputTransferToken, SurfaceControl,
     * Looper, SurfaceControlInputReceiver)}
     *
     * @param surfaceControl The SurfaceControl to remove and unregister the input channel for.
     */
@@ -6267,12 +6266,12 @@ public interface WindowManager extends ViewManager {
    }

    /**
     * Returns the input client token for the {@link SurfaceControl}. This will only return non null
     * if the SurfaceControl was registered for input via
     * { #registerBatchedSurfaceControlInputReceiver(int, IBinder, SurfaceControl, Choreographer,
     * SurfaceControlInputReceiver)} or
     * {@link #registerUnbatchedSurfaceControlInputReceiver(int, InputTransferToken, SurfaceControl, Looper,
     * SurfaceControlInputReceiver)}.
     * Returns the input client token for the {@link SurfaceControl}. This will only return non
     * null if the SurfaceControl was registered for input via
     * {@link #registerBatchedSurfaceControlInputReceiver(int, InputTransferToken, SurfaceControl,
     * Choreographer, SurfaceControlInputReceiver)} or
     * {@link #registerUnbatchedSurfaceControlInputReceiver(int, InputTransferToken,
     * SurfaceControl, Looper, SurfaceControlInputReceiver)}.
     * <p>
     * This is helpful for testing to ensure the test waits for the layer to be registered with
     * SurfaceFlinger and Input before proceeding with the test.
+4 −4
Original line number Diff line number Diff line
@@ -898,7 +898,7 @@ public final class WindowManagerGlobal {
        return inputTransferToken;
    }

    void unregisterSurfaceControlInputReceiver(SurfaceControl surfaceControl) {
    void unregisterSurfaceControlInputReceiver(@NonNull SurfaceControl surfaceControl) {
        SurfaceControlInputReceiverInfo surfaceControlInputReceiverInfo;
        synchronized (mSurfaceControlInputReceivers) {
            surfaceControlInputReceiverInfo = mSurfaceControlInputReceivers.removeReturnOld(
@@ -920,7 +920,7 @@ public final class WindowManagerGlobal {
        surfaceControlInputReceiverInfo.mInputEventReceiver.dispose();
    }

    IBinder getSurfaceControlInputClientToken(SurfaceControl surfaceControl) {
    IBinder getSurfaceControlInputClientToken(@NonNull SurfaceControl surfaceControl) {
        SurfaceControlInputReceiverInfo surfaceControlInputReceiverInfo;
        synchronized (mSurfaceControlInputReceivers) {
            surfaceControlInputReceiverInfo = mSurfaceControlInputReceivers.get(
@@ -934,8 +934,8 @@ public final class WindowManagerGlobal {
        return surfaceControlInputReceiverInfo.mClientToken;
    }

    boolean transferTouchGesture(InputTransferToken transferFromToken,
            InputTransferToken transferToToken) {
    boolean transferTouchGesture(@NonNull InputTransferToken transferFromToken,
            @NonNull InputTransferToken transferToToken) {
        try {
            return getWindowManagerService().transferTouchGesture(transferFromToken,
                    transferToToken);
+10 −0
Original line number Diff line number Diff line
@@ -539,6 +539,10 @@ public final class WindowManagerImpl implements WindowManager {
            @NonNull InputTransferToken hostInputTransferToken,
            @NonNull SurfaceControl surfaceControl, @NonNull Choreographer choreographer,
            @NonNull SurfaceControlInputReceiver receiver) {
        Objects.requireNonNull(hostInputTransferToken);
        Objects.requireNonNull(surfaceControl);
        Objects.requireNonNull(choreographer);
        Objects.requireNonNull(receiver);
        return mGlobal.registerBatchedSurfaceControlInputReceiver(displayId, hostInputTransferToken,
                surfaceControl, choreographer, receiver);
    }
@@ -549,18 +553,24 @@ public final class WindowManagerImpl implements WindowManager {
            @NonNull InputTransferToken hostInputTransferToken,
            @NonNull SurfaceControl surfaceControl, @NonNull Looper looper,
            @NonNull SurfaceControlInputReceiver receiver) {
        Objects.requireNonNull(hostInputTransferToken);
        Objects.requireNonNull(surfaceControl);
        Objects.requireNonNull(looper);
        Objects.requireNonNull(receiver);
        return mGlobal.registerUnbatchedSurfaceControlInputReceiver(displayId,
                hostInputTransferToken, surfaceControl, looper, receiver);
    }

    @Override
    public void unregisterSurfaceControlInputReceiver(@NonNull SurfaceControl surfaceControl) {
        Objects.requireNonNull(surfaceControl);
        mGlobal.unregisterSurfaceControlInputReceiver(surfaceControl);
    }

    @Override
    @Nullable
    public IBinder getSurfaceControlInputClientToken(@NonNull SurfaceControl surfaceControl) {
        Objects.requireNonNull(surfaceControl);
        return mGlobal.getSurfaceControlInputClientToken(surfaceControl);
    }

Loading