Merge "Expose Java side for parenting SurfaceControl"

This commit is contained in:
TreeHugger Robot
2017-01-27 02:43:47 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 5 deletions

View File

@@ -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);
@@ -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");
}
@@ -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");