summaryrefslogtreecommitdiffstats
path: root/services/camera
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2012-10-05 17:09:09 -0700
committerIgor Murashkin <iam@google.com>2012-10-05 17:09:09 -0700
commit7d2a4aaaf5691ee523fc0d03c286620f392ed16f (patch)
tree16bccba273eed47c50221f6d3269fe46e789fb53 /services/camera
parent7373cbe85e617345f7002256a4be389fe62af913 (diff)
downloadframeworks_av-7d2a4aaaf5691ee523fc0d03c286620f392ed16f.zip
frameworks_av-7d2a4aaaf5691ee523fc0d03c286620f392ed16f.tar.gz
frameworks_av-7d2a4aaaf5691ee523fc0d03c286620f392ed16f.tar.bz2
Camera2: Report getMaxNumFocusAreas 0 for fixed focus cameras
Bug: 7298805 Change-Id: I7499b80a9416bf454c8ea80c31ea4fdd3c4ee2d7
Diffstat (limited to 'services/camera')
-rw-r--r--services/camera/libcameraservice/camera2/Parameters.cpp21
-rw-r--r--services/camera/libcameraservice/camera2/Parameters.h11
2 files changed, 25 insertions, 7 deletions
diff --git a/services/camera/libcameraservice/camera2/Parameters.cpp b/services/camera/libcameraservice/camera2/Parameters.cpp
index 1b15a1c..809768c 100644
--- a/services/camera/libcameraservice/camera2/Parameters.cpp
+++ b/services/camera/libcameraservice/camera2/Parameters.cpp
@@ -635,8 +635,11 @@ status_t Parameters::initialize(const CameraMetadata *info) {
staticInfo(ANDROID_CONTROL_MAX_REGIONS, 1, 1);
if (!max3aRegions.count) return NO_INIT;
- params.set(CameraParameters::KEY_MAX_NUM_FOCUS_AREAS,
- max3aRegions.data.i32[0]);
+ int32_t maxNumFocusAreas = 0;
+ if (focusMode != Parameters::FOCUS_MODE_FIXED) {
+ maxNumFocusAreas = max3aRegions.data.i32[0];
+ }
+ params.set(CameraParameters::KEY_MAX_NUM_FOCUS_AREAS, maxNumFocusAreas);
params.set(CameraParameters::KEY_FOCUS_AREAS,
"(0,0,0,0,0)");
focusingAreas.clear();
@@ -1466,7 +1469,7 @@ status_t Parameters::set(const String8& paramString) {
size_t max3aRegions =
(size_t)staticInfo(ANDROID_CONTROL_MAX_REGIONS, 1, 1).data.i32[0];
if (res == OK) res = validateAreas(validatedParams.focusingAreas,
- max3aRegions);
+ max3aRegions, AREA_KIND_FOCUS);
if (res != OK) {
ALOGE("%s: Requested focus areas are malformed: %s",
__FUNCTION__, newParams.get(CameraParameters::KEY_FOCUS_AREAS));
@@ -1499,7 +1502,8 @@ status_t Parameters::set(const String8& paramString) {
res = parseAreas(newParams.get(CameraParameters::KEY_METERING_AREAS),
&validatedParams.meteringAreas);
if (res == OK) {
- res = validateAreas(validatedParams.meteringAreas, max3aRegions);
+ res = validateAreas(validatedParams.meteringAreas, max3aRegions,
+ AREA_KIND_METERING);
}
if (res != OK) {
ALOGE("%s: Requested metering areas are malformed: %s",
@@ -2111,7 +2115,8 @@ status_t Parameters::parseAreas(const char *areasCStr,
}
status_t Parameters::validateAreas(const Vector<Parameters::Area> &areas,
- size_t maxRegions) {
+ size_t maxRegions,
+ AreaKind areaKind) const {
// Definition of valid area can be found in
// include/camera/CameraParameters.h
if (areas.size() == 0) return BAD_VALUE;
@@ -2125,6 +2130,12 @@ status_t Parameters::validateAreas(const Vector<Parameters::Area> &areas,
return OK;
}
}
+
+ // fixed focus can only set (0,0,0,0,0) focus area
+ if (areaKind == AREA_KIND_FOCUS && focusMode == FOCUS_MODE_FIXED) {
+ return BAD_VALUE;
+ }
+
if (areas.size() > maxRegions) {
ALOGE("%s: Too many areas requested: %d",
__FUNCTION__, areas.size());
diff --git a/services/camera/libcameraservice/camera2/Parameters.h b/services/camera/libcameraservice/camera2/Parameters.h
index daae7c4..fd02744 100644
--- a/services/camera/libcameraservice/camera2/Parameters.h
+++ b/services/camera/libcameraservice/camera2/Parameters.h
@@ -258,8 +258,15 @@ struct Parameters {
static const char* focusModeEnumToString(focusMode_t focusMode);
static status_t parseAreas(const char *areasCStr,
Vector<Area> *areas);
- static status_t validateAreas(const Vector<Area> &areas,
- size_t maxRegions);
+
+ enum AreaKind
+ {
+ AREA_KIND_FOCUS,
+ AREA_KIND_METERING
+ };
+ status_t validateAreas(const Vector<Area> &areas,
+ size_t maxRegions,
+ AreaKind areaKind) const;
static bool boolFromString(const char *boolStr);
// Map from camera orientation + facing to gralloc transform enum