summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2015-02-18 14:42:16 -0800
committerZhijun He <zhijunhe@google.com>2015-03-17 19:24:35 -0700
commitc30e34c11e987c8661d7f0da4c98873a257d9df4 (patch)
treee80fc6f2a8efc8ee760eedb0b4a38abd51529d17 /services
parent4f2a5eb6a861f09a458ab2530e7a64b1b9411bb1 (diff)
downloadframeworks_av-c30e34c11e987c8661d7f0da4c98873a257d9df4.zip
frameworks_av-c30e34c11e987c8661d7f0da4c98873a257d9df4.tar.gz
frameworks_av-c30e34c11e987c8661d7f0da4c98873a257d9df4.tar.bz2
CameraService: fix invalid access of camera metadata
static_camera_characteristics is not defined in API1. Change-Id: I422953081b0a5581e12fc4b16052b67ca8062186
Diffstat (limited to 'services')
-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;