Expose Java side for parenting SurfaceControl
Proposed by itself so others can experiment.
Test: Native side covered by SF Transaction test. Java side tested manually for now.
Change-Id: I44cf3acd65480bfe14e26db83e905f3ade73f7e0
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index a3fef27..46da83f 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -98,11 +98,12 @@
// ----------------------------------------------------------------------------
static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
- jstring nameStr, jint w, jint h, jint format, jint flags) {
+ jstring nameStr, jint w, jint h, jint format, jint flags, jlong parentObject) {
ScopedUtfChars name(env, nameStr);
sp<SurfaceComposerClient> client(android_view_SurfaceSession_getClient(env, sessionObj));
+ SurfaceControl *parent = reinterpret_cast<SurfaceControl*>(parentObject);
sp<SurfaceControl> surface = client->createSurface(
- String8(name.c_str()), w, h, format, flags);
+ String8(name.c_str()), w, h, format, flags, parent);
if (surface == NULL) {
jniThrowException(env, OutOfResourcesException, NULL);
return 0;
@@ -741,7 +742,7 @@
// ----------------------------------------------------------------------------
static const JNINativeMethod sSurfaceControlMethods[] = {
- {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIII)J",
+ {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIIIJ)J",
(void*)nativeCreate },
{"nativeRelease", "(J)V",
(void*)nativeRelease },