Camera2: When focus is already locked in CAF mode, do not trigger HAL.
In HAL2 CAF modes, once focus is locked by an AF trigger, additional
triggers will not cause AF notifications, since the state will not
change again until a cancelAutofocus call.
Since the old API still expects to see a notification, short-circuit
this at the service and send an immediate success notification.
Bug: 7318298
Change-Id: Ib209a24eaf2a35a247d06aea671efe80a33d751e
diff --git a/services/camera/libcameraservice/camera2/Parameters.cpp b/services/camera/libcameraservice/camera2/Parameters.cpp
index 3c679da..9a0083a 100644
--- a/services/camera/libcameraservice/camera2/Parameters.cpp
+++ b/services/camera/libcameraservice/camera2/Parameters.cpp
@@ -633,6 +633,7 @@
params.set(CameraParameters::KEY_SUPPORTED_FOCUS_MODES,
supportedFocusModes);
}
+ focusState = ANDROID_CONTROL_AF_STATE_INACTIVE;
shadowFocusMode = FOCUS_MODE_INVALID;
camera_metadata_ro_entry_t max3aRegions =
@@ -1462,8 +1463,9 @@
}
}
}
+ validatedParams.focusState = ANDROID_CONTROL_AF_STATE_INACTIVE;
// Always reset shadow focus mode to avoid reverting settings
- shadowFocusMode = FOCUS_MODE_INVALID;
+ validatedParams.shadowFocusMode = FOCUS_MODE_INVALID;
// Update in case of override
newParams.set(CameraParameters::KEY_FOCUS_MODE,
focusModeEnumToString(validatedParams.focusMode));