Loading core/java/android/view/SurfaceControl.java +8 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ public class SurfaceControl { private static final String TAG = "SurfaceControl"; private static native long nativeCreate(SurfaceSession session, String name, int w, int h, int format, int flags) int w, int h, int format, int flags, long parentObject) throws OutOfResourcesException; private static native void nativeRelease(long nativeObject); private static native void nativeDestroy(long nativeObject); Loading Loading @@ -287,6 +287,12 @@ public class SurfaceControl { public SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags) throws OutOfResourcesException { this(session, name, w, h, format, flags, null); } public SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags, SurfaceControl parent) throws OutOfResourcesException { if (session == null) { throw new IllegalArgumentException("session must not be null"); } Loading @@ -304,7 +310,7 @@ public class SurfaceControl { } mName = name; mNativeObject = nativeCreate(session, name, w, h, format, flags); mNativeObject = nativeCreate(session, name, w, h, format, flags, parent != null ? parent.mNativeObject : 0); if (mNativeObject == 0) { throw new OutOfResourcesException( "Couldn't allocate SurfaceControl native object"); Loading core/jni/android_view_SurfaceControl.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -98,11 +98,12 @@ static struct { // ---------------------------------------------------------------------------- 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; Loading Loading @@ -741,7 +742,7 @@ static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject token // ---------------------------------------------------------------------------- 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 }, Loading Loading
core/java/android/view/SurfaceControl.java +8 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ public class SurfaceControl { private static final String TAG = "SurfaceControl"; private static native long nativeCreate(SurfaceSession session, String name, int w, int h, int format, int flags) int w, int h, int format, int flags, long parentObject) throws OutOfResourcesException; private static native void nativeRelease(long nativeObject); private static native void nativeDestroy(long nativeObject); Loading Loading @@ -287,6 +287,12 @@ public class SurfaceControl { public SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags) throws OutOfResourcesException { this(session, name, w, h, format, flags, null); } public SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags, SurfaceControl parent) throws OutOfResourcesException { if (session == null) { throw new IllegalArgumentException("session must not be null"); } Loading @@ -304,7 +310,7 @@ public class SurfaceControl { } mName = name; mNativeObject = nativeCreate(session, name, w, h, format, flags); mNativeObject = nativeCreate(session, name, w, h, format, flags, parent != null ? parent.mNativeObject : 0); if (mNativeObject == 0) { throw new OutOfResourcesException( "Couldn't allocate SurfaceControl native object"); Loading
core/jni/android_view_SurfaceControl.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -98,11 +98,12 @@ static struct { // ---------------------------------------------------------------------------- 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; Loading Loading @@ -741,7 +742,7 @@ static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject token // ---------------------------------------------------------------------------- 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 }, Loading