diff options
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 25 | ||||
| -rw-r--r-- | core/jni/android_view_SurfaceControl.cpp | 7 |
2 files changed, 25 insertions, 7 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index be6fb313b230..139c0bebedec 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -123,7 +123,8 @@ public final class SurfaceControl implements Parcelable { private static native long nativeMirrorSurface(long mirrorOfObject); private static native long nativeCreateTransaction(); private static native long nativeGetNativeTransactionFinalizer(); - private static native void nativeApplyTransaction(long transactionObj, boolean sync); + private static native void nativeApplyTransaction(long transactionObj, boolean sync, + boolean oneWay); private static native void nativeMergeTransaction(long transactionObj, long otherTransactionObj); private static native void nativeClearTransaction(long transactionObj); @@ -2785,10 +2786,22 @@ public final class SurfaceControl implements Parcelable { * as a new transaction. */ public void apply() { - apply(false); + apply(/*sync*/ false); } /** + * Applies the transaction as a one way binder call. This transaction will be applied out + * of order with other transactions that are applied synchronously. This method is not + * safe. It should only be used when the order does not matter. + * + * @hide + */ + public void applyAsyncUnsafe() { + apply(/*sync*/ false, /*oneWay*/ true); + } + + + /** * Clear the transaction object, without applying it. * * @hide @@ -2817,9 +2830,13 @@ public final class SurfaceControl implements Parcelable { * @hide */ public void apply(boolean sync) { + apply(sync, /*oneWay*/ false); + } + + private void apply(boolean sync, boolean oneWay) { applyResizedSurfaces(); notifyReparentedSurfaces(); - nativeApplyTransaction(mNativeObject, sync); + nativeApplyTransaction(mNativeObject, sync, oneWay); } /** @@ -4373,7 +4390,7 @@ public final class SurfaceControl implements Parcelable { void applyGlobalTransaction(boolean sync) { applyResizedSurfaces(); notifyReparentedSurfaces(); - nativeApplyTransaction(mNativeObject, sync); + nativeApplyTransaction(mNativeObject, sync, /*oneWay*/ false); } @Override diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 9384f41e26f5..f79dbe761e07 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -469,9 +469,10 @@ static void nativeSetDefaultBufferSize(JNIEnv* env, jclass clazz, jlong nativeOb } } -static void nativeApplyTransaction(JNIEnv* env, jclass clazz, jlong transactionObj, jboolean sync) { +static void nativeApplyTransaction(JNIEnv* env, jclass clazz, jlong transactionObj, jboolean sync, + jboolean oneWay) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); - transaction->apply(sync); + transaction->apply(sync, oneWay); } static void nativeMergeTransaction(JNIEnv* env, jclass clazz, @@ -2119,7 +2120,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetDefaultBufferSize}, {"nativeCreateTransaction", "()J", (void*)nativeCreateTransaction }, - {"nativeApplyTransaction", "(JZ)V", + {"nativeApplyTransaction", "(JZZ)V", (void*)nativeApplyTransaction }, {"nativeGetNativeTransactionFinalizer", "()J", (void*)nativeGetNativeTransactionFinalizer }, |