diff options
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; } |