summaryrefslogtreecommitdiff
path: root/src/android/camera_capabilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/camera_capabilities.cpp')
-rw-r--r--src/android/camera_capabilities.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
index 1583a0a0..a98e6099 100644
--- a/src/android/camera_capabilities.cpp
+++ b/src/android/camera_capabilities.cpp
@@ -394,11 +394,14 @@ int CameraCapabilities::initialize(std::shared_ptr<Camera> camera,
}
ret = initializeStreamConfigurations();
- camera_->release();
- if (ret)
+ if (ret) {
+ camera_->release();
return ret;
+ }
- return initializeStaticMetadata();
+ ret = initializeStaticMetadata();
+ camera_->release();
+ return ret;
}
std::vector<Size>
@@ -696,6 +699,25 @@ int CameraCapabilities::initializeStaticMetadata()
return -EINVAL;
}
+ /*
+ * Generate and apply a new configuration for the Viewfinder role to
+ * collect control limits and properties from a known state.
+ */
+ std::unique_ptr<CameraConfiguration> cameraConfig =
+ camera_->generateConfiguration({ StreamRole::Viewfinder });
+ if (!cameraConfig) {
+ LOG(HAL, Error) << "Failed to generate camera configuration";
+ staticMetadata_.reset();
+ return -ENODEV;
+ }
+
+ int ret = camera_->configure(cameraConfig.get());
+ if (ret) {
+ LOG(HAL, Error) << "Failed to initialize the camera state";
+ staticMetadata_.reset();
+ return ret;
+ }
+
const ControlInfoMap &controlsInfo = camera_->controls();
const ControlList &properties = camera_->properties();