summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-10-16 12:58:21 -0700
committerEino-Ville Talvala <etalvala@google.com>2012-10-16 13:19:41 -0700
commitac0cd56627b121081308213d5a327cfbae410f4d (patch)
tree76dcc461b44d6964bfb0f819420872925db31a1e
parent547173205b3fd909dd72b597f6372840c38460e4 (diff)
Camera2: Improve quirks focusing behavior.
- When scene mode is set and the AF quirk is in use, don't change AF mode and then cancel when AF cancel is received. Just change mode since that also implies a cancel. - Only trigger quirks switch when a focusing area is set. Bug: 7318812 Change-Id: I28d8755553bd78052e774701210cb94d84ee2046
-rw-r--r--services/camera/libcameraservice/Camera2Client.cpp8
-rw-r--r--services/camera/libcameraservice/camera2/Parameters.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index c5ea3ed4..98332f90 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -1007,7 +1007,8 @@ status_t Camera2Client::autoFocus() {
*/
if (l.mParameters.quirks.triggerAfWithAuto &&
l.mParameters.sceneMode != ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED &&
- l.mParameters.focusMode != Parameters::FOCUS_MODE_AUTO) {
+ l.mParameters.focusMode != Parameters::FOCUS_MODE_AUTO &&
+ !l.mParameters.focusingAreas[0].isEmpty()) {
ALOGV("%s: Quirk: Switching from focusMode %d to AUTO",
__FUNCTION__, l.mParameters.focusMode);
l.mParameters.shadowFocusMode = l.mParameters.focusMode;
@@ -1038,13 +1039,16 @@ status_t Camera2Client::cancelAutoFocus() {
triggerId = ++l.mParameters.afTriggerCounter;
// When using triggerAfWithAuto quirk, may need to reset focus mode to
- // the real state at this point.
+ // the real state at this point. No need to cancel explicitly if
+ // changing the AF mode.
if (l.mParameters.shadowFocusMode != Parameters::FOCUS_MODE_INVALID) {
ALOGV("%s: Quirk: Restoring focus mode to %d", __FUNCTION__,
l.mParameters.shadowFocusMode);
l.mParameters.focusMode = l.mParameters.shadowFocusMode;
l.mParameters.shadowFocusMode = Parameters::FOCUS_MODE_INVALID;
updateRequests(l.mParameters);
+
+ return OK;
}
}
syncWithDevice();
diff --git a/services/camera/libcameraservice/camera2/Parameters.h b/services/camera/libcameraservice/camera2/Parameters.h
index 8a8645ee..54b1e8cb 100644
--- a/services/camera/libcameraservice/camera2/Parameters.h
+++ b/services/camera/libcameraservice/camera2/Parameters.h
@@ -100,6 +100,9 @@ struct Parameters {
Area(int left, int top, int right, int bottom, int weight):
left(left), top(top), right(right), bottom(bottom),
weight(weight) {}
+ bool isEmpty() const {
+ return (left == 0) && (top == 0) && (right == 0) && (bottom == 0);
+ }
};
Vector<Area> focusingAreas;