diff options
author | Tyler Luu <tluu@ti.com> | 2011-09-28 14:14:09 -0500 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-10-07 12:29:22 -0700 |
commit | eca9906d37a8cc71332bdaceb65b7f41aaf90c21 (patch) | |
tree | 9da74283d14872dab3316c74a8b406e29ee9851c | |
parent | 6cd6e6f0f952d68e0301b58f7c77422448f51730 (diff) | |
download | hardware_ti_omap4-eca9906d37a8cc71332bdaceb65b7f41aaf90c21.zip hardware_ti_omap4-eca9906d37a8cc71332bdaceb65b7f41aaf90c21.tar.gz hardware_ti_omap4-eca9906d37a8cc71332bdaceb65b7f41aaf90c21.tar.bz2 |
omap4xxx: camera: timing issue with autoFocus/cancelAutoFocus
Fixes b/5332895
If cancelAutoFocus comes when Ducati is already sending focus
callback, CameraHal will go ahead and send focus callback to
the application. This can cause the subsequent autoFocus call
to be acked almost immediately with the previous autoFocus call's
notification. Application will think autoFocus is done while
CamearHal is still focusing, takePicture from the application
will return an error.
To fix this issue, do not always send focus notification. We are
going to internally enable/disable auto focus message. Enable focus
message when autoFocus call comes and disable focus message after
notification or if cancelAutoFocus call comes. This will prevent us
from sending notify message if application calls cancelAutoFocus.
Change-Id: I8c8892f14894e23a9d73fa1c2b058389d196eefa
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r-- | camera/AppCallbackNotifier.cpp | 2 | ||||
-rw-r--r-- | camera/CameraHal.cpp | 21 |
2 files changed, 21 insertions, 2 deletions
diff --git a/camera/AppCallbackNotifier.cpp b/camera/AppCallbackNotifier.cpp index a69cfc0..cc53fb4 100644 --- a/camera/AppCallbackNotifier.cpp +++ b/camera/AppCallbackNotifier.cpp @@ -352,6 +352,7 @@ void AppCallbackNotifier::notifyEvent() ( mCameraHal->msgTypeEnabled(CAMERA_MSG_FOCUS) ) ) { mNotifyCb(CAMERA_MSG_FOCUS, true, 0, mCallbackCookie); + mCameraHal->disableMsgType(CAMERA_MSG_FOCUS); } else if ( focusEvtData->focusError && ( NULL != mCameraHal ) && @@ -359,6 +360,7 @@ void AppCallbackNotifier::notifyEvent() ( mCameraHal->msgTypeEnabled(CAMERA_MSG_FOCUS) ) ) { mNotifyCb(CAMERA_MSG_FOCUS, false, 0, mCallbackCookie); + mCameraHal->disableMsgType(CAMERA_MSG_FOCUS); } break; diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 3ced011..8556a31 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -129,6 +129,12 @@ void CameraHal::enableMsgType(int32_t msgType) msgType &= ~CAMERA_MSG_SHUTTER; } + // ignoring enable focus message from camera service + // we will enable internally in autoFocus call + if (msgType & CAMERA_MSG_FOCUS) { + msgType &= ~CAMERA_MSG_FOCUS; + } + { Mutex::Autolock lock(mLock); mMsgEnabled |= msgType; @@ -2144,6 +2150,12 @@ status_t CameraHal::autoFocus() LOG_FUNCTION_NAME; + { + Mutex::Autolock lock(mLock); + mMsgEnabled |= CAMERA_MSG_FOCUS; + } + + if ( NULL != mCameraAdapter ) { @@ -2185,6 +2197,12 @@ status_t CameraHal::autoFocus() status_t CameraHal::cancelAutoFocus() { LOG_FUNCTION_NAME; + + { + Mutex::Autolock lock(mLock); + mMsgEnabled &= ~CAMERA_MSG_FOCUS; + } + if( NULL != mCameraAdapter ) { mCameraAdapter->sendCommand(CameraAdapter::CAMERA_CANCEL_AUTOFOCUS); @@ -3373,8 +3391,7 @@ void CameraHal::forceStopPreview() // and application needs to call startFaceDection again // to restart FD mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_FD); - - cancelAutoFocus(); + mCameraAdapter->sendCommand(CameraAdapter::CAMERA_CANCEL_AUTOFOCUS); } // only need to send these control commands to state machine if we are |