Camera: Add support for empty physical settings optimization
Empty individual physical settings should be allowed after
one initial successful request.
Bug: 72524845
Test: run vts --skip-all-system-status-check --skip-preconditions
--primary-abi-only --module VtsHalCameraProviderV2_4Target -l INFO
Change-Id: I18d22a56f5f0e6e1d81a6e8c844697c02bc343a1
diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp
index f6c6b2b..423748a 100644
--- a/camera/device/3.4/default/CameraDeviceSession.cpp
+++ b/camera/device/3.4/default/CameraDeviceSession.cpp
@@ -378,7 +378,7 @@
for (size_t i = 0; i < settingsCount; i++) {
uint64_t settingsSize = request.physicalCameraSettings[i].fmqSettingsSize;
- const camera_metadata_t *settings;
+ const camera_metadata_t *settings = nullptr;
if (settingsSize > 0) {
physicalFmq.push_back(V3_2::CameraMetadata(settingsSize));
bool read = mRequestMetadataQueue->read(physicalFmq[i].data(), settingsSize);
@@ -400,6 +400,13 @@
ALOGE("%s: physical camera settings metadata is corrupt!", __FUNCTION__);
return Status::ILLEGAL_ARGUMENT;
}
+
+ if (mFirstRequest && settings == nullptr) {
+ ALOGE("%s: Individual request settings must not be null for first request!",
+ __FUNCTION__);
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
physicalCameraIds.push_back(request.physicalCameraSettings[i].physicalCameraId.c_str());
}
}
diff --git a/camera/device/3.4/types.hal b/camera/device/3.4/types.hal
index c8ebb17..f00b876 100644
--- a/camera/device/3.4/types.hal
+++ b/camera/device/3.4/types.hal
@@ -207,9 +207,14 @@
/**
* If fmqSettingsSize is zero, the settings buffer contains the capture and
- * processing parameters for the physical device with id 'phyCamId'.
- * In case the individual settings are empty or missing, Hal should fail the
- * request and return Status::ILLEGAL_ARGUMENT.
+ * processing parameters for the physical device with id 'physicalCameraId'.
+ * As a special case, an empty settings buffer indicates that the
+ * settings are identical to the most-recently submitted capture request.
+ * An empty buffer cannot be used as the first submitted request after
+ * a configureStreams() call.
+ *
+ * This field must be used if fmqSettingsSize is zero. It must not be used
+ * if fmqSettingsSize is non-zero.
*/
CameraMetadata settings;
};