summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/common
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2015-02-18 14:42:16 -0800
committerYin-Chia Yeh <yinchiayeh@google.com>2015-02-18 14:42:16 -0800
commitb6dc0bf1ce7d54995943c3cd6885f35db77728fc (patch)
tree8b48b08c3e2b766b86d5ac0c3131e0c96d6a3881 /services/camera/libcameraservice/common
parent9f1f00cee228eb1c6cf4a7e2b9dc4c92d6754a39 (diff)
downloadframeworks_av-b6dc0bf1ce7d54995943c3cd6885f35db77728fc.zip
frameworks_av-b6dc0bf1ce7d54995943c3cd6885f35db77728fc.tar.gz
frameworks_av-b6dc0bf1ce7d54995943c3cd6885f35db77728fc.tar.bz2
CameraService: fix invalid access of camera metadata
static_camera_characteristics is not defined in API1. Change-Id: I422953081b0a5581e12fc4b16052b67ca8062186
Diffstat (limited to 'services/camera/libcameraservice/common')
-rw-r--r--services/camera/libcameraservice/common/CameraModule.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/services/camera/libcameraservice/common/CameraModule.cpp b/services/camera/libcameraservice/common/CameraModule.cpp
index bbf47e8..85a4df9 100644
--- a/services/camera/libcameraservice/common/CameraModule.cpp
+++ b/services/camera/libcameraservice/common/CameraModule.cpp
@@ -66,6 +66,12 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) {
return -EINVAL;
}
+ // Only override static_camera_characteristics for API2 devices
+ int apiVersion = mModule->common.module_api_version;
+ if (apiVersion < CAMERA_MODULE_API_VERSION_2_0) {
+ return mModule->get_camera_info(cameraId, info);
+ }
+
camera_info &wrappedInfo = mCameraInfo[cameraId];
if (!mCameraInfoCached[cameraId]) {
camera_info rawInfo;
@@ -75,14 +81,7 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) {
}
CameraMetadata &m = mCameraCharacteristics[cameraId];
m = rawInfo.static_camera_characteristics;
- int deviceVersion;
- int apiVersion = mModule->common.module_api_version;
- if (apiVersion >= CAMERA_MODULE_API_VERSION_2_0) {
- deviceVersion = rawInfo.device_version;
- } else {
- deviceVersion = CAMERA_DEVICE_API_VERSION_1_0;
- }
- deriveCameraCharacteristicsKeys(deviceVersion, m);
+ deriveCameraCharacteristicsKeys(rawInfo.device_version, m);
wrappedInfo = rawInfo;
wrappedInfo.static_camera_characteristics = m.getAndLock();
mCameraInfoCached[cameraId] = true;