OSDN Git Service

Camera2/3: Don't trigger AF when in INFINITY focus mode.
authorEino-Ville Talvala <etalvala@google.com>
Mon, 3 Jun 2013 23:50:53 +0000 (16:50 -0700)
committerThe Android Automerger <android-build@android.com>
Tue, 4 Jun 2013 19:05:35 +0000 (12:05 -0700)
While the HAL should ignore it, it's faster to immediately respond
with success.

Also filter out cancel autofocus calls for FIXED/INFINITY focus.

Bug: 9263856
Change-Id: I637ec7c8b459d654ef11cb1142b959f2674224c5

services/camera/libcameraservice/Camera2Client.cpp

index dd50e3c..5fdec34 100644 (file)
@@ -1007,8 +1007,12 @@ status_t Camera2Client::autoFocus() {
           * If the camera does not support auto-focus, it is a no-op and
           * onAutoFocus(boolean, Camera) callback will be called immediately
           * with a fake value of success set to true.
+          *
+          * Similarly, if focus mode is set to INFINITY, there's no reason to
+          * bother the HAL.
           */
-        if (l.mParameters.focusMode == Parameters::FOCUS_MODE_FIXED) {
+        if (l.mParameters.focusMode == Parameters::FOCUS_MODE_FIXED ||
+                l.mParameters.focusMode == Parameters::FOCUS_MODE_INFINITY) {
             notifyImmediately = true;
             notifySuccess = true;
         }
@@ -1068,6 +1072,11 @@ status_t Camera2Client::cancelAutoFocus() {
     int triggerId;
     {
         SharedParameters::Lock l(mParameters);
+        // Canceling does nothing in FIXED or INFINITY modes
+        if (l.mParameters.focusMode == Parameters::FOCUS_MODE_FIXED ||
+                l.mParameters.focusMode == Parameters::FOCUS_MODE_INFINITY) {
+            return OK;
+        }
         triggerId = ++l.mParameters.afTriggerCounter;
 
         // When using triggerAfWithAuto quirk, may need to reset focus mode to