diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2014-09-13 13:34:55 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2014-09-13 15:24:41 -0700 |
commit | 176e4c253a63d581af6b21f3182d71b3026ef516 (patch) | |
tree | a3799cfdedb5162ecb108169cd24ffff2e038862 /services/camera | |
parent | a4c95a6bc3b801bf41ca841440e9124f947e53fe (diff) | |
download | frameworks_av-176e4c253a63d581af6b21f3182d71b3026ef516.zip frameworks_av-176e4c253a63d581af6b21f3182d71b3026ef516.tar.gz frameworks_av-176e4c253a63d581af6b21f3182d71b3026ef516.tar.bz2 |
Camera1: Validate scene mode override AF mode
Don't allow uncalibrated cameras to list a fixed focus mode for
variable-focus cameras, since uncalibrated cameras cannot do INFINITY
focus.
Bug: 17492043
Change-Id: I5835efd6f21be0ebb74a9b7ea3ef5b2e7cf63e7a
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/api1/client2/Parameters.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp index ed9137f..aa9d746 100644 --- a/services/camera/libcameraservice/api1/client2/Parameters.cpp +++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp @@ -983,6 +983,13 @@ status_t Parameters::buildFastInfo() { bool fixedLens = minFocusDistance.count == 0 || minFocusDistance.data.f[0] == 0; + camera_metadata_ro_entry_t focusDistanceCalibration = + staticInfo(ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION, 0, 0, + false); + bool canFocusInfinity = (focusDistanceCalibration.count && + focusDistanceCalibration.data.u8[0] != + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED); + camera_metadata_ro_entry_t availableFocalLengths = staticInfo(ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS); if (!availableFocalLengths.count) return NO_INIT; @@ -1033,6 +1040,13 @@ status_t Parameters::buildFastInfo() { sceneModeOverrides.data.u8[i * kModesPerSceneMode + 2]; switch(afMode) { case ANDROID_CONTROL_AF_MODE_OFF: + if (!fixedLens && !canFocusInfinity) { + ALOGE("%s: Camera %d: Scene mode override lists asks for" + " fixed focus on a device with focuser but not" + " calibrated for infinity focus", __FUNCTION__, + cameraId); + return NO_INIT; + } modes.focusMode = fixedLens ? FOCUS_MODE_FIXED : FOCUS_MODE_INFINITY; break; |