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

Commit 27442089 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "SurfaceControlViewHost: Respond to API feedback" into rvc-dev am: 1660402a am: 9dd2d033

Change-Id: If1ed53a1898ebb00866fc274b71f3356365f8968
parents 0e80dd0f 9dd2d033
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -53610,10 +53610,11 @@ package android.view {
  public class SurfaceControlViewHost {
    ctor public SurfaceControlViewHost(@NonNull android.content.Context, @NonNull android.view.Display, @Nullable android.os.IBinder);
    method public void addView(@NonNull android.view.View, int, int);
    method @Nullable public android.view.SurfaceControlViewHost.SurfacePackage getSurfacePackage();
    method @Nullable public android.view.View getView();
    method public void relayout(int, int);
    method public void release();
    method public void setView(@NonNull android.view.View, int, int);
  }
  public static final class SurfaceControlViewHost.SurfacePackage implements android.os.Parcelable {
+1 −1
Original line number Diff line number Diff line
@@ -4957,8 +4957,8 @@ package android.view {
  }

  public class SurfaceControlViewHost {
    method public void addView(@NonNull android.view.View, android.view.WindowManager.LayoutParams);
    method public void relayout(android.view.WindowManager.LayoutParams);
    method public void setView(@NonNull android.view.View, @NonNull android.view.WindowManager.LayoutParams);
  }

  @UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ public abstract class InlineSuggestionRenderService extends Service {

            final SurfaceControlViewHost host = new SurfaceControlViewHost(this, getDisplay(),
                    hostInputToken);
            host.addView(suggestionRoot, lp);
            host.setView(suggestionRoot, lp);
            suggestionRoot.setOnClickListener((v) -> {
                try {
                    callback.onClick();
+13 −3
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.view.accessibility.IAccessibilityEmbeddedConnection;

import java.util.Objects;

/**
 * Utility class for adding a View hierarchy to a {@link SurfaceControl}. The View hierarchy
 * will render in to a root SurfaceControl, and receive input based on the SurfaceControl's
@@ -159,7 +161,8 @@ public class SurfaceControlViewHost {
     * @hide
     */
    @TestApi
    public void addView(@NonNull View view, WindowManager.LayoutParams attrs) {
    public void setView(@NonNull View view, @NonNull WindowManager.LayoutParams attrs) {
        Objects.requireNonNull(view);
        mViewRoot.setView(view, attrs, null);
    }

@@ -172,11 +175,18 @@ public class SurfaceControlViewHost {
     * @param width The width to layout the View within, in pixels.
     * @param height The height to layout the View within, in pixels.
     */
    public void addView(@NonNull View view, int width, int height) {
    public void setView(@NonNull View view, int width, int height) {
        final WindowManager.LayoutParams lp =
                new WindowManager.LayoutParams(width, height,
                        WindowManager.LayoutParams.TYPE_APPLICATION, 0, PixelFormat.TRANSPARENT);
        addView(view, lp);
        setView(view, lp);
    }

    /**
     * @return The view passed to setView, or null if none has been passed.
     */
    public @Nullable View getView() {
        return mViewRoot.getView();
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ public class SurfaceViewRequestReceiver {
            view.setTranslationX((surfaceControl.getWidth() - scale * viewSize.getWidth()) / 2);
            view.setTranslationY((surfaceControl.getHeight() - scale * viewSize.getHeight()) / 2);

            mSurfaceControlViewHost.addView(view, layoutParams);
            mSurfaceControlViewHost.setView(view, layoutParams);
        }
    }
}
Loading