diff options
author | Yin-Chia Yeh <yinchiayeh@google.com> | 2016-12-14 19:13:15 -0800 |
---|---|---|
committer | Yin-Chia Yeh <yinchiayeh@google.com> | 2017-01-05 14:48:27 -0800 |
commit | f906b3bbbb9b0251e563e3de20d124c41ad238bb (patch) | |
tree | cc076c510e2372013aea29b6a7e02861e80a5645 /camera/common/1.0/default/CameraModule.cpp | |
parent | faef8f92c95a1e0868c1ec8fd220b9d957831022 (diff) |
Camera: Add default camera provider 2.4
Supports legacy camera HAL modules; also exports ICameraDevice
instances.
Test: compile
Bug: 30985004
Change-Id: I2b9624a412de95dd43979a5e6650b170010c577a
Diffstat (limited to 'camera/common/1.0/default/CameraModule.cpp')
-rw-r--r-- | camera/common/1.0/default/CameraModule.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp index d8a424ec17..5d9ae4d31a 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/1.0/default/CameraModule.cpp @@ -344,7 +344,7 @@ int CameraModule::open(const char* id, struct hw_device_t** device) { return res; } -bool CameraModule::isOpenLegacyDefined() { +bool CameraModule::isOpenLegacyDefined() const { if (getModuleApiVersion() < CAMERA_MODULE_API_VERSION_2_3) { return false; } @@ -376,7 +376,7 @@ int CameraModule::setCallbacks(const camera_module_callbacks_t *callbacks) { return res; } -bool CameraModule::isVendorTagDefined() { +bool CameraModule::isVendorTagDefined() const { return mModule->get_vendor_tag_ops != NULL; } @@ -388,11 +388,25 @@ void CameraModule::getVendorTagOps(vendor_tag_ops_t* ops) { } } +bool CameraModule::isSetTorchModeSupported() const { + if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4) { + if (mModule->set_torch_mode == NULL) { + ALOGE("%s: Module 2.4 device must support set torch API!", + __FUNCTION__); + return false; + } + return true; + } + return false; +} + int CameraModule::setTorchMode(const char* camera_id, bool enable) { - int res; - ATRACE_BEGIN("camera_module->set_torch_mode"); - res = mModule->set_torch_mode(camera_id, enable); - ATRACE_END(); + int res = INVALID_OPERATION; + if (mModule->set_torch_mode != NULL) { + ATRACE_BEGIN("camera_module->set_torch_mode"); + res = mModule->set_torch_mode(camera_id, enable); + ATRACE_END(); + } return res; } @@ -409,19 +423,19 @@ status_t CameraModule::filterOpenErrorCode(status_t err) { return -ENODEV; } -uint16_t CameraModule::getModuleApiVersion() { +uint16_t CameraModule::getModuleApiVersion() const { return mModule->common.module_api_version; } -const char* CameraModule::getModuleName() { +const char* CameraModule::getModuleName() const { return mModule->common.name; } -uint16_t CameraModule::getHalApiVersion() { +uint16_t CameraModule::getHalApiVersion() const { return mModule->common.hal_api_version; } -const char* CameraModule::getModuleAuthor() { +const char* CameraModule::getModuleAuthor() const { return mModule->common.author; } |