From 30ad618cfef9dd7fad12b14d7e0bdadb5d68cb82 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 18 Dec 2019 01:46:04 -0800 Subject: SurfaceView: Add reparentSurfacePackage method For use with SurfaceControlViewHost. Currently this just performs a reparent but it's future use is to also automatically link the accessibility IDs of the embedded content and the SurfaceView. Test: No test, to unblock accessibility team. Builds. Bug: 134365580 Change-Id: I990c0f29b439ed6e6f18bdfa4be2c1d46f502503 --- .../android/test/viewembed/SurfaceControlViewHostTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/SurfaceControlViewHostTest/src') diff --git a/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java b/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java index 6687f83ad0db..4c8221c813b4 100644 --- a/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java +++ b/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java @@ -46,15 +46,15 @@ public class SurfaceControlViewHostTest extends Activity implements SurfaceHolde mView.setZOrderOnTop(true); mView.getHolder().addCallback(this); + + addEmbeddedView(); } - @Override - public void surfaceCreated(SurfaceHolder holder) { + void addEmbeddedView() { mVr = new SurfaceControlViewHost(this, this.getDisplay(), mView.getInputToken()); - final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); - t.reparent(mVr.getSurfacePackage().getSurfaceControl(), mView.getSurfaceControl()).apply(); + mView.setChildSurfacePackage(mVr.getSurfacePackage()); Button v = new Button(this); v.setBackgroundColor(Color.BLUE); @@ -69,6 +69,10 @@ public class SurfaceControlViewHostTest extends Activity implements SurfaceHolde mVr.addView(v, lp); } + @Override + public void surfaceCreated(SurfaceHolder holder) { + } + @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Canvas canvas = holder.lockCanvas(); -- cgit v1.2.3-59-g8ed1b