Rename WindowlessViewRoot to SurfaceControlViewHost and rework API
Should be a little more clear. The internal IWindowSession implementation
keeps the WindowlessWindowManager name, but the API section definitely
needs a more usable name. Instead of passing in a root Surface we want it
to be owned by the SurfaceControlViewHost itself. This way we can ensure
we only return a SurfacePackage. In follow up CLs we will add an
accessibility ID to the SurfacePackage so we can ensure the Control
is passed around with the accessibility ID.
Test: Builds
Bug: 134365580
Change-Id: I30520e8b169d3744a66ccedf61cc4515cfef4dee
diff --git a/tests/WindowlessWmTest/Android.bp b/tests/SurfaceControlViewHostTest/Android.bp
similarity index 94%
rename from tests/WindowlessWmTest/Android.bp
rename to tests/SurfaceControlViewHostTest/Android.bp
index 2ace3f3..e4e0600 100644
--- a/tests/WindowlessWmTest/Android.bp
+++ b/tests/SurfaceControlViewHostTest/Android.bp
@@ -15,7 +15,7 @@
//
android_test {
- name: "WindowlessWmTest",
+ name: "SurfaceControlViewHostTest",
srcs: ["**/*.java"],
platform_apis: true,
certificate: "platform",
diff --git a/tests/WindowlessWmTest/AndroidManifest.xml b/tests/SurfaceControlViewHostTest/AndroidManifest.xml
similarity index 91%
rename from tests/WindowlessWmTest/AndroidManifest.xml
rename to tests/SurfaceControlViewHostTest/AndroidManifest.xml
index babfd76..ee95763 100644
--- a/tests/WindowlessWmTest/AndroidManifest.xml
+++ b/tests/SurfaceControlViewHostTest/AndroidManifest.xml
@@ -16,7 +16,7 @@
package="com.android.test.viewembed">
<application>
- <activity android:name="WindowlessWmTest" android:label="View Embedding Test">
+ <activity android:name="SurfaceControlViewHostTest" android:label="View Embedding Test">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
diff --git a/tests/WindowlessWmTest/src/com/android/test/viewembed/WindowlessWmTest.java b/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java
similarity index 83%
rename from tests/WindowlessWmTest/src/com/android/test/viewembed/WindowlessWmTest.java
rename to tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java
index 5c1e830..6687f83 100644
--- a/tests/WindowlessWmTest/src/com/android/test/viewembed/WindowlessWmTest.java
+++ b/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java
@@ -22,18 +22,19 @@
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.Gravity;
+import android.view.SurfaceControl;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.WindowManager;
-import android.view.WindowlessViewRoot;
+import android.view.SurfaceControlViewHost;
import android.widget.Button;
import android.widget.FrameLayout;
-public class WindowlessWmTest extends Activity implements SurfaceHolder.Callback{
+public class SurfaceControlViewHostTest extends Activity implements SurfaceHolder.Callback{
SurfaceView mView;
- WindowlessViewRoot mVr;
+ SurfaceControlViewHost mVr;
protected void onCreate(Bundle savedInstanceState) {
FrameLayout content = new FrameLayout(this);
@@ -49,8 +50,12 @@
@Override
public void surfaceCreated(SurfaceHolder holder) {
- mVr = new WindowlessViewRoot(this, this.getDisplay(), mView.getSurfaceControl(),
+ mVr = new SurfaceControlViewHost(this, this.getDisplay(),
mView.getInputToken());
+
+ final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
+ t.reparent(mVr.getSurfacePackage().getSurfaceControl(), mView.getSurfaceControl()).apply();
+
Button v = new Button(this);
v.setBackgroundColor(Color.BLUE);
v.setOnClickListener(new View.OnClickListener() {