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

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

Merge "Add transferHostTouchGestureToEmbedded API" into main

parents 3c144386 d791cf31
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -49829,6 +49829,7 @@ package android.view {
    method public default void removeOnBufferTransformHintChangedListener(@NonNull android.view.AttachedSurfaceControl.OnBufferTransformHintChangedListener);
    method public default void removeOnBufferTransformHintChangedListener(@NonNull android.view.AttachedSurfaceControl.OnBufferTransformHintChangedListener);
    method public default void setChildBoundingInsets(@NonNull android.graphics.Rect);
    method public default void setChildBoundingInsets(@NonNull android.graphics.Rect);
    method public default void setTouchableRegion(@Nullable android.graphics.Region);
    method public default void setTouchableRegion(@Nullable android.graphics.Region);
    method @FlaggedApi("com.android.window.flags.transfer_gesture_to_embedded") public default boolean transferHostTouchGestureToEmbedded(@NonNull android.view.SurfaceControlViewHost.SurfacePackage);
  }
  }
  @UiThread public static interface AttachedSurfaceControl.OnBufferTransformHintChangedListener {
  @UiThread public static interface AttachedSurfaceControl.OnBufferTransformHintChangedListener {
+15 −0
Original line number Original line Diff line number Diff line
@@ -231,4 +231,19 @@ public interface AttachedSurfaceControl {
    default void removeTrustedPresentationCallback(@NonNull SurfaceControl.Transaction t,
    default void removeTrustedPresentationCallback(@NonNull SurfaceControl.Transaction t,
            @NonNull Consumer<Boolean> listener) {
            @NonNull Consumer<Boolean> listener) {
    }
    }

    /**
     * Transfer the currently in progress touch gesture from the host to the requested
     * {@link SurfaceControlViewHost.SurfacePackage}. This requires that the
     * SurfaceControlViewHost was created with the current host's inputToken.
     *
     * @param surfacePackage The SurfacePackage to transfer the gesture to.
     * @return Whether the touch stream was transferred.
     */
    @FlaggedApi(Flags.FLAG_TRANSFER_GESTURE_TO_EMBEDDED)
    default boolean transferHostTouchGestureToEmbedded(
            @NonNull SurfaceControlViewHost.SurfacePackage surfacePackage) {
        throw new UnsupportedOperationException(
                "transferHostTouchGestureToEmbedded is unimplemented");
    }
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -357,4 +357,6 @@ interface IWindowSession {
    boolean cancelDraw(IWindow window);
    boolean cancelDraw(IWindow window);


    boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow);
    boolean transferEmbeddedTouchFocusToHost(IWindow embeddedWindow);

    boolean transferHostTouchGestureToEmbedded(IWindow hostWindow, IBinder transferTouchToken);
}
}
+4 −2
Original line number Original line Diff line number Diff line
@@ -287,7 +287,8 @@ public class SurfaceControlViewHost {
        }
        }


        /**
        /**
         * Returns an input token used which can be used to request focus on the embedded surface.
         * Returns an input token used which can be used to request focus on the embedded surface
         * or to transfer touch gesture to the embedded surface.
         *
         *
         * @hide
         * @hide
         */
         */
@@ -526,7 +527,8 @@ public class SurfaceControlViewHost {
    }
    }


    /**
    /**
     * Returns an input token used which can be used to request focus on the embedded surface.
     * Returns an input token used which can be used to request focus on the embedded surface
     * or to transfer touch gesture to the embedded surface.
     *
     *
     * @hide
     * @hide
     */
     */
+13 −0
Original line number Original line Diff line number Diff line
@@ -11893,4 +11893,17 @@ public final class ViewRootImpl implements ViewParent,
        }
        }
        Log.d(mTag, msg);
        Log.d(mTag, msg);
    }
    }

    @Override
    public boolean transferHostTouchGestureToEmbedded(
            @NonNull SurfaceControlViewHost.SurfacePackage surfacePackage) {
        final IWindowSession realWm = WindowManagerGlobal.getWindowSession();
        try {
            return realWm.transferHostTouchGestureToEmbedded(mWindow,
                    surfacePackage.getInputToken());
        } catch (RemoteException e) {
            e.rethrowAsRuntimeException();
        }
        return false;
    }
}
}
Loading