diff options
| author | 2023-04-12 21:42:16 +0000 | |
|---|---|---|
| committer | 2023-04-12 23:51:36 +0000 | |
| commit | d29ecd2ff6d9a5b63c069bcfa782ed9e2ad5902b (patch) | |
| tree | 6d3cc98cc8d85db80355b4fb5837773c6c3a78e5 /graphics/java/android | |
| parent | b2be29bc4311584aeda23fcf205cdc764a86123c (diff) | |
Add explicit clearSyncTransaction instead of passing null
It's unclear what passing null to syncNextTransaction means so instead
add an explicit clearSyncTransaction that is meant to remove a
syncTransaction that was added via syncNextTransaction.
Test: presubmit
Bug: 272189296
Change-Id: Id315e1e9c679837af5ea9eaf2f619856b718d7c8
Diffstat (limited to 'graphics/java/android')
| -rw-r--r-- | graphics/java/android/graphics/BLASTBufferQueue.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/graphics/java/android/graphics/BLASTBufferQueue.java b/graphics/java/android/graphics/BLASTBufferQueue.java index 9940ca3933c8..c52f700ef4f6 100644 --- a/graphics/java/android/graphics/BLASTBufferQueue.java +++ b/graphics/java/android/graphics/BLASTBufferQueue.java @@ -16,6 +16,7 @@ package android.graphics; +import android.annotation.NonNull; import android.view.Surface; import android.view.SurfaceControl; @@ -31,9 +32,10 @@ public final class BLASTBufferQueue { private static native long nativeCreate(String name, boolean updateDestinationFrame); private static native void nativeDestroy(long ptr); private static native Surface nativeGetSurface(long ptr, boolean includeSurfaceControlHandle); - private static native void nativeSyncNextTransaction(long ptr, + private static native boolean nativeSyncNextTransaction(long ptr, Consumer<SurfaceControl.Transaction> callback, boolean acquireSingleBuffer); private static native void nativeStopContinuousSyncTransaction(long ptr); + private static native void nativeClearSyncTransaction(long ptr); private static native void nativeUpdate(long ptr, long surfaceControl, long width, long height, int format); private static native void nativeMergeWithNextTransaction(long ptr, long transactionPtr, @@ -92,9 +94,9 @@ public final class BLASTBufferQueue { * acquired. If false, continue to acquire all buffers into the * transaction until stopContinuousSyncTransaction is called. */ - public void syncNextTransaction(boolean acquireSingleBuffer, - Consumer<SurfaceControl.Transaction> callback) { - nativeSyncNextTransaction(mNativeObject, callback, acquireSingleBuffer); + public boolean syncNextTransaction(boolean acquireSingleBuffer, + @NonNull Consumer<SurfaceControl.Transaction> callback) { + return nativeSyncNextTransaction(mNativeObject, callback, acquireSingleBuffer); } /** @@ -104,8 +106,8 @@ public final class BLASTBufferQueue { * @param callback The callback invoked when the buffer has been added to the transaction. The * callback will contain the transaction with the buffer. */ - public void syncNextTransaction(Consumer<SurfaceControl.Transaction> callback) { - syncNextTransaction(true /* acquireSingleBuffer */, callback); + public boolean syncNextTransaction(@NonNull Consumer<SurfaceControl.Transaction> callback) { + return syncNextTransaction(true /* acquireSingleBuffer */, callback); } /** @@ -118,6 +120,14 @@ public final class BLASTBufferQueue { } /** + * Tell BBQ to clear the sync transaction that was previously set. The callback will not be + * invoked when the next frame is acquired. + */ + public void clearSyncTransaction() { + nativeClearSyncTransaction(mNativeObject); + } + + /** * Updates {@link SurfaceControl}, size, and format for a particular BLASTBufferQueue * @param sc The new SurfaceControl that this BLASTBufferQueue will update * @param width The new width for the buffer. |