summaryrefslogtreecommitdiff
path: root/camera
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-09-28 14:14:09 -0500
committerIliyan Malchev <malchev@google.com>2011-10-07 12:29:22 -0700
commit2ecb39c0ca21ce9ae00c4585e3f7002e8b4e6ca7 (patch)
treedc84fbe09e3d166ff225d068c451fc9ae56d52d2 /camera
parent7016577b173fc73f5b43e76cbc122bb0a9346613 (diff)
downloadomap4xxx-2ecb39c0ca21ce9ae00c4585e3f7002e8b4e6ca7.tar.gz
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>
Diffstat (limited to 'camera')
-rw-r--r--camera/AppCallbackNotifier.cpp2
-rw-r--r--camera/CameraHal.cpp21
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