Camera2: Synchronize mode changes and triggers
Make sure that changes to various parameters have reached the HAL
before triggering asynchronous events like autofocus or precapture
metering.
Bug: 7107220
Change-Id: I3c50038de1671968eb32004ce538435121934e7e
diff --git a/services/camera/libcameraservice/Camera2Device.h b/services/camera/libcameraservice/Camera2Device.h
index 38662e3..29830bd 100644
--- a/services/camera/libcameraservice/Camera2Device.h
+++ b/services/camera/libcameraservice/Camera2Device.h
@@ -67,6 +67,13 @@
status_t clearStreamingRequest();
/**
+ * Wait until a request with the given ID has been dequeued by the
+ * HAL. Returns TIMED_OUT if the timeout duration is reached. Returns
+ * immediately if the latest request received by the HAL has this id.
+ */
+ status_t waitUntilRequestReceived(int32_t requestId, nsecs_t timeout);
+
+ /**
* Create an output stream of the requested size and format.
*
* If format is CAMERA2_HAL_PIXEL_FORMAT_OPAQUE, then the HAL device selects
@@ -226,6 +233,9 @@
status_t dequeue(camera_metadata_t **buf, bool incrementCount = true);
int getBufferCount();
status_t waitForBuffer(nsecs_t timeout);
+ // Wait until a buffer with the given ID is dequeued. Will return
+ // immediately if the latest buffer dequeued has that ID.
+ status_t waitForDequeue(int32_t id, nsecs_t timeout);
// Set repeating buffer(s); if the queue is empty on a dequeue call, the
// queue copies the contents of the stream slot into the queue, and then
@@ -247,6 +257,8 @@
Condition notEmpty;
int mFrameCount;
+ int32_t mLatestRequestId;
+ Condition mNewRequestId;
int mCount;
List<camera_metadata_t*> mEntries;