From 8df3194783f68e56f3b32b80bd1bcadd7faaf031 Mon Sep 17 00:00:00 2001 From: Sampath Vangaveti Date: Wed, 18 Nov 2015 15:08:05 +0530 Subject: [PATCH] camera/QCamera2: HAL: Send Inactive AF state in landscape/sunset mode Issue: When scene mode is Landscape/Sunset, Backend AF mode is set to Infinity and AF state is INACTIVE and then when APP calls do AF, focus state is still Inactive and since there is no change in AF state, HAL not sending the state to frameworks and APP got stuck. Fix: Check backend AF mode is INFINITY and if its Active AF call then send the corresponding AF INACTIVE state to frameworks. Change-Id: I4663e29ecd3be8f257cfd18dd037c9208fb019ee --- camera/QCamera2/HAL/QCamera2HWI.cpp | 15 +++++++++++++++ camera/QCamera2/stack/common/cam_types.h | 1 + 2 files changed, 16 insertions(+) diff --git a/camera/QCamera2/HAL/QCamera2HWI.cpp b/camera/QCamera2/HAL/QCamera2HWI.cpp index 2cd4624..cd26407 100755 --- a/camera/QCamera2/HAL/QCamera2HWI.cpp +++ b/camera/QCamera2/HAL/QCamera2HWI.cpp @@ -4043,6 +4043,13 @@ int32_t QCamera2HardwareInterface::processAutoFocusEvent(cam_auto_focus_data_t & break; } + // If the HAL focus mode is different from AF INFINITY focus mode, send event to app + if ((focus_data.focus_mode == CAM_FOCUS_MODE_INFINITY) && + (focus_data.focus_state == CAM_AF_INACTIVE)) { + ret = sendEvtNotify(CAMERA_MSG_FOCUS, true, 0); + break; + } + if (focus_data.focus_state == CAM_AF_PASSIVE_SCANNING || focus_data.focus_state == CAM_AF_PASSIVE_FOCUSED || focus_data.focus_state == CAM_AF_PASSIVE_UNFOCUSED) { @@ -4081,6 +4088,14 @@ int32_t QCamera2HardwareInterface::processAutoFocusEvent(cam_auto_focus_data_t & break; case CAM_FOCUS_MODE_CONTINOUS_VIDEO: case CAM_FOCUS_MODE_CONTINOUS_PICTURE: + + // If the HAL focus mode is different from AF INFINITY focus mode, send event to app + if ((focus_data.focus_mode == CAM_FOCUS_MODE_INFINITY) && + (focus_data.focus_state == CAM_AF_INACTIVE)) { + ret = sendEvtNotify(CAMERA_MSG_FOCUS, false, 0); + break; + } + if (mActiveAF && (focus_data.focus_state == CAM_AF_PASSIVE_FOCUSED || focus_data.focus_state == CAM_AF_PASSIVE_UNFOCUSED)) { diff --git a/camera/QCamera2/stack/common/cam_types.h b/camera/QCamera2/stack/common/cam_types.h index 270f869..0a49e71 100644 --- a/camera/QCamera2/stack/common/cam_types.h +++ b/camera/QCamera2/stack/common/cam_types.h @@ -851,6 +851,7 @@ typedef struct { cam_focus_distances_info_t focus_dist; /* focus distance */ int32_t focus_pos; uint32_t focused_frame_idx; + cam_focus_mode_type focus_mode; /* focus mode from backend */ } cam_auto_focus_data_t; typedef struct {