Merge "SurfaceControlViewHost: Respond to API feedback" into rvc-dev am: 1660402a5c am: 9dd2d03308
Change-Id: If8c7b3bfbf3413e22eee28986055f4a8c2ecb4e0
This commit is contained in:
@@ -53609,10 +53609,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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class SystemWindows {
|
||||
final Display display = mDisplayController.getDisplay(mDisplayId);
|
||||
SurfaceControlViewHost viewRoot = new SurfaceControlViewHost(mContext, display, wwm);
|
||||
attrs.flags |= FLAG_HARDWARE_ACCELERATED;
|
||||
viewRoot.addView(view, attrs);
|
||||
viewRoot.setView(view, attrs);
|
||||
mViewRoots.put(view, viewRoot);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SurfaceControlViewHostTest extends Activity implements SurfaceHolde
|
||||
WindowManager.LayoutParams lp =
|
||||
new WindowManager.LayoutParams(500, 500, WindowManager.LayoutParams.TYPE_APPLICATION,
|
||||
0, PixelFormat.OPAQUE);
|
||||
mVr.addView(v, lp);
|
||||
mVr.setView(v, lp);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user