summaryrefslogtreecommitdiff
path: root/camera/common/1.0/default/CameraModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'camera/common/1.0/default/CameraModule.cpp')
-rw-r--r--camera/common/1.0/default/CameraModule.cpp22
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 86f26e480c..50583e35cf 100644
--- a/camera/common/1.0/default/CameraModule.cpp
+++ b/camera/common/1.0/default/CameraModule.cpp
@@ -267,6 +267,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);
@@ -367,11 +383,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;
}