summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2011-11-16 22:18:26 -0600
committerIliyan Malchev <malchev@google.com>2011-11-17 11:45:29 -0800
commit78dac813ae2c442dd0669db208abd3720d0ea6c4 (patch)
tree9665b17816fe62452938c68e8a4b2c756932b37a /camera
parent05ea07dfe04d915b4288d3e71afbf70f8082fea4 (diff)
downloadhardware_ti_omap4xxx-78dac813ae2c442dd0669db208abd3720d0ea6c4.zip
hardware_ti_omap4xxx-78dac813ae2c442dd0669db208abd3720d0ea6c4.tar.gz
hardware_ti_omap4xxx-78dac813ae2c442dd0669db208abd3720d0ea6c4.tar.bz2
CameraHAL: Do not return error if AF fails
Fixes b/5612881 Some third-party apps do not handle errors thrown by the camera HAL when they try to invoke autoFocus while AF is in progress. The Barcode Scanner, in particular, will quit in this case without releasing the Camera handle, wreaking all sorts of power-management havoc. Even though CTS does not mandate it, previous versions of Android and other camera HAL implementations simply return success in this case. This patch makes this HAL conform to this behavior. Change-Id: I758e2de7f84b61043267f052169068b64d75d0d1 Signed-off-by: Sundar Raman <sunds@ti.com>
Diffstat (limited to 'camera')
-rw-r--r--camera/CameraHal.cpp28
-rw-r--r--camera/inc/CameraHal.h11
2 files changed, 24 insertions, 15 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index 7e18330..c192007 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -2158,17 +2158,30 @@ status_t CameraHal::autoFocus()
#endif
-
LOG_FUNCTION_NAME;
- {
Mutex::Autolock lock(mLock);
+
mMsgEnabled |= CAMERA_MSG_FOCUS;
- }
+ if ( NULL == mCameraAdapter )
+ {
+ ret = -1;
+ goto EXIT;
+ }
+
+ CameraAdapter::AdapterState state;
+ ret = mCameraAdapter->getState(state);
+ if (ret != NO_ERROR)
+ {
+ goto EXIT;
+ }
- if ( NULL != mCameraAdapter )
+ if (state == CameraAdapter::AF_STATE)
{
+ CAMHAL_LOGDA("Ignoring start-AF (already in progress)");
+ goto EXIT;
+ }
#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS
@@ -2181,12 +2194,7 @@ status_t CameraHal::autoFocus()
#endif
- }
- else
- {
- ret = -1;
- }
-
+EXIT:
LOG_FUNCTION_NAME_EXIT;
return ret;
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index f33515a..d139c9c 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -833,6 +833,12 @@ public:
// Rolls the state machine back to INTIALIZED_STATE from the current state
virtual status_t rollbackToInitializedState() = 0;
+
+ // Retrieves the current Adapter state - for internal use (not locked)
+ virtual status_t getState(AdapterState &state) = 0;
+ // Retrieves the next Adapter state - for internal use (not locked)
+ virtual status_t getNextState(AdapterState &state) = 0;
+
protected:
//The first two methods will try to switch the adapter state.
//Every call to setState() should be followed by a corresponding
@@ -841,11 +847,6 @@ protected:
virtual status_t setState(CameraCommands operation) = 0;
virtual status_t commitState() = 0;
virtual status_t rollbackState() = 0;
-
- // Retrieves the current Adapter state - for internal use (not locked)
- virtual status_t getState(AdapterState &state) = 0;
- // Retrieves the next Adapter state - for internal use (not locked)
- virtual status_t getNextState(AdapterState &state) = 0;
};
class DisplayAdapter : public BufferProvider, public virtual RefBase