diff options
author | Peter Kalauskas <peskal@google.com> | 2019-01-11 15:46:06 -0800 |
---|---|---|
committer | Sreelakshmi D <sreed@codeaurora.org> | 2019-11-01 09:27:11 +0000 |
commit | 669be8f0d018f0eb16ee13e6406c98e8aa4ce9c7 (patch) | |
tree | ff5185c9c12548a1ef854411ae060b591e5f2d60 /camera/common/1.0/default/CameraModule.cpp | |
parent | 9b6208744f4dd6e5c1d7bc2d37c9cb9513ea4b51 (diff) |
Add call to get camera device version
Bug: 79374634
Test: Start camera
CRs-Fixed: 2545487
Change-Id: Iaf0300d0116d5da0694105c82d1e4282f626cb86
Diffstat (limited to 'camera/common/1.0/default/CameraModule.cpp')
-rw-r--r-- | camera/common/1.0/default/CameraModule.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp index 467c121a94..d1372975b0 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/1.0/default/CameraModule.cpp @@ -277,6 +277,22 @@ int CameraModule::init() { return res; } +int CameraModule::getCameraDeviceVersion(int cameraId, uint32_t* version) { + ATRACE_CALL(); + int ret; + if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_5 && + mModule->get_camera_device_version != NULL) { + ret = mModule->get_camera_device_version(cameraId, version); + } else { + struct camera_info info; + ret = getCameraInfo(cameraId, &info); + if (ret == OK) { + *version = info.device_version; + } + } + return ret; +} + int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) { ATRACE_CALL(); Mutex::Autolock lock(mCameraInfoLock); @@ -377,11 +393,9 @@ int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t int CameraModule::getDeviceVersion(int cameraId) { ssize_t index = mDeviceVersionMap.indexOfKey(cameraId); if (index == NAME_NOT_FOUND) { - int deviceVersion; + uint32_t deviceVersion; if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_0) { - struct camera_info info; - getCameraInfo(cameraId, &info); - deviceVersion = info.device_version; + getCameraDeviceVersion(cameraId, &deviceVersion); } else { deviceVersion = CAMERA_DEVICE_API_VERSION_1_0; } |