summaryrefslogtreecommitdiff
path: root/android/view/SurfaceControl.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/view/SurfaceControl.java')
-rw-r--r--android/view/SurfaceControl.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/android/view/SurfaceControl.java b/android/view/SurfaceControl.java
index bd7f8e54..d4610a56 100644
--- a/android/view/SurfaceControl.java
+++ b/android/view/SurfaceControl.java
@@ -152,6 +152,7 @@ public class SurfaceControl implements Parcelable {
private static native void nativeSeverChildren(long transactionObj, long nativeObject);
private static native void nativeSetOverrideScalingMode(long transactionObj, long nativeObject,
int scalingMode);
+ private static native void nativeDestroy(long transactionObj, long nativeObject);
private static native IBinder nativeGetHandle(long nativeObject);
private static native boolean nativeGetTransformToDisplayInverse(long nativeObject);
@@ -352,8 +353,8 @@ public class SurfaceControl implements Parcelable {
private int mFormat = PixelFormat.OPAQUE;
private String mName;
private SurfaceControl mParent;
- private int mWindowType;
- private int mOwnerUid;
+ private int mWindowType = -1;
+ private int mOwnerUid = -1;
/**
* Begin building a SurfaceControl with a given {@link SurfaceSession}.
@@ -565,7 +566,7 @@ public class SurfaceControl implements Parcelable {
*/
private SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags,
SurfaceControl parent, int windowType, int ownerUid)
- throws OutOfResourcesException {
+ throws OutOfResourcesException, IllegalArgumentException {
if (session == null) {
throw new IllegalArgumentException("session must not be null");
}
@@ -763,18 +764,14 @@ public class SurfaceControl implements Parcelable {
}
public void deferTransactionUntil(IBinder handle, long frame) {
- if (frame > 0) {
- synchronized(SurfaceControl.class) {
- sGlobalTransaction.deferTransactionUntil(this, handle, frame);
- }
+ synchronized(SurfaceControl.class) {
+ sGlobalTransaction.deferTransactionUntil(this, handle, frame);
}
}
public void deferTransactionUntil(Surface barrier, long frame) {
- if (frame > 0) {
- synchronized(SurfaceControl.class) {
- sGlobalTransaction.deferTransactionUntilSurface(this, barrier, frame);
- }
+ synchronized(SurfaceControl.class) {
+ sGlobalTransaction.deferTransactionUntilSurface(this, barrier, frame);
}
}
@@ -1479,6 +1476,9 @@ public class SurfaceControl implements Parcelable {
public Transaction deferTransactionUntil(SurfaceControl sc, IBinder handle,
long frameNumber) {
+ if (frameNumber < 0) {
+ return this;
+ }
sc.checkNotReleased();
nativeDeferTransactionUntil(mNativeObject, sc.mNativeObject, handle, frameNumber);
return this;
@@ -1486,6 +1486,9 @@ public class SurfaceControl implements Parcelable {
public Transaction deferTransactionUntilSurface(SurfaceControl sc, Surface barrierSurface,
long frameNumber) {
+ if (frameNumber < 0) {
+ return this;
+ }
sc.checkNotReleased();
nativeDeferTransactionUntilSurface(mNativeObject, sc.mNativeObject,
barrierSurface.mNativeObject, frameNumber);
@@ -1570,6 +1573,16 @@ public class SurfaceControl implements Parcelable {
return this;
}
+ /**
+ * Same as {@link #destroy()} except this is invoked in a transaction instead of
+ * immediately.
+ */
+ public Transaction destroy(SurfaceControl sc) {
+ sc.checkNotReleased();
+ nativeDestroy(mNativeObject, sc.mNativeObject);
+ return this;
+ }
+
public Transaction setDisplaySurface(IBinder displayToken, Surface surface) {
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");