summaryrefslogtreecommitdiffstats
path: root/services/camera
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2015-02-20 17:41:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-02-20 17:41:54 +0000
commitd031aaae9e93ef2860070eee2c191b1cf428cf46 (patch)
tree0103eb3faa51eda1a446c936439aaa235c356ef2 /services/camera
parent07aed75a681793474487e7e5e100d21c2f31de9c (diff)
parentb6dc0bf1ce7d54995943c3cd6885f35db77728fc (diff)
downloadframeworks_av-d031aaae9e93ef2860070eee2c191b1cf428cf46.zip
frameworks_av-d031aaae9e93ef2860070eee2c191b1cf428cf46.tar.gz
frameworks_av-d031aaae9e93ef2860070eee2c191b1cf428cf46.tar.bz2
Merge "CameraService: fix invalid access of camera metadata"
Diffstat (limited to 'services/camera')
-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;