diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2021-08-26 23:36:30 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2021-08-31 12:09:35 +0200 |
commit | 88009711be33903672e45b89cf5c9d3fc5761724 (patch) | |
tree | f5d12535ae819512280afdf5f187e0b987679973 /src/android/camera_capabilities.cpp | |
parent | 5fc426fbfe58a82e30021d7a9ca12a4daeaec0f3 (diff) |
android: Refuse Manual template if not supported
If the camera devices does not support the MANUAL_SENSOR capabilities
there is no point in generating a request template for the Manual
capture use case.
This change fixes CTS tests
android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceManualTemplate
android.hardware.camera2.cts.NativeCameraDeviceTest#testCameraDeviceCreateCaptureRequest
For devices that do not support MANUAL_SENSOR capabilities.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/android/camera_capabilities.cpp')
-rw-r--r-- | src/android/camera_capabilities.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index bd661675..c16e755f 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1271,13 +1271,12 @@ int CameraCapabilities::initializeStaticMetadata() numOutStreams); /* Check capabilities */ - std::set<camera_metadata_enum_android_request_available_capabilities> - capabilities = computeCapabilities(); + capabilities_ = computeCapabilities(); std::vector<camera_metadata_enum_android_request_available_capabilities> - capsVec(capabilities.begin(), capabilities.end()); + capsVec(capabilities_.begin(), capabilities_.end()); staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, capsVec); - computeHwLevel(capabilities); + computeHwLevel(capabilities_); staticMetadata_->addEntry(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL, hwLevel_); LOG(HAL, Info) @@ -1326,6 +1325,11 @@ PixelFormat CameraCapabilities::toPixelFormat(int format) const std::unique_ptr<CameraMetadata> CameraCapabilities::requestTemplateManual() const { + if (!capabilities_.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR)) { + LOG(HAL, Error) << "Manual template not supported"; + return nullptr; + } + std::unique_ptr<CameraMetadata> manualTemplate = requestTemplatePreview(); if (!manualTemplate) return nullptr; |