diff options
author | Andriy Chepurnyy <x0155536@ti.com> | 2013-01-30 17:08:21 +0200 |
---|---|---|
committer | Hashcode <hashcode0f@gmail.com> | 2015-02-03 13:38:20 -0800 |
commit | 0da39f328913b05ae03dc7b53a2326c44b03aaf1 (patch) | |
tree | afe8d76a2438b00402911fd69768375f39698a49 /camera | |
parent | 90a5178c65aaec85604683f6ed4ce0253064d55f (diff) | |
download | hardware_ti_omap4-0da39f328913b05ae03dc7b53a2326c44b03aaf1.zip hardware_ti_omap4-0da39f328913b05ae03dc7b53a2326c44b03aaf1.tar.gz hardware_ti_omap4-0da39f328913b05ae03dc7b53a2326c44b03aaf1.tar.bz2 |
CameraHal: Correctly handle sendCommand call inside CameraHal
There is no restriction for stopFaceDetection API call. So
theoretically it can be executed when preview disabled (this
patch correctly handle this situation).
Also do not return error on unknown commands, since this will
break potential API extensions.
Change-Id: I7567f680a70cecbcce6e5bb0df830159350adb31
Signed-off-by: Andriy Chepurnyy <x0155536@ti.com>
Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'camera')
-rw-r--r-- | camera/CameraHal.cpp | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 37e422c..720d2d6 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -3825,61 +3825,44 @@ status_t CameraHal::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) } /////////////////////////////////////////////////////// - // Following commands do NOT need preview to be started + // Following commands NEED preview to be started /////////////////////////////////////////////////////// - switch ( cmd ) { -#ifdef ANDROID_API_JB_OR_LATER - case CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG: - { - const bool enable = static_cast<bool>(arg1); - android::AutoMutex lock(mLock); - if ( enable ) { - mMsgEnabled |= CAMERA_MSG_FOCUS_MOVE; - } else { - mMsgEnabled &= ~CAMERA_MSG_FOCUS_MOVE; - } - } - return OK; -#endif - } - - if ( ret == OK && !previewEnabled() + if ((!previewEnabled()) && ((cmd == CAMERA_CMD_START_SMOOTH_ZOOM) + || (cmd == CAMERA_CMD_STOP_SMOOTH_ZOOM) + || (cmd == CAMERA_CMD_START_FACE_DETECTION) #ifdef OMAP_ENHANCEMENT_VTC - && (cmd != CAMERA_CMD_PREVIEW_INITIALIZATION) + || (cmd == CAMERA_CMD_PREVIEW_DEINITIALIZATION) #endif - ) { - CAMHAL_LOGEA("Preview is not running"); - ret = -EINVAL; + )) + { + CAMHAL_LOGEA("sendCommand with cmd = 0x%x need preview to be started", cmd); + return BAD_VALUE; } - /////////////////////////////////////////////////////// - // Following commands NEED preview to be started - /////////////////////////////////////////////////////// - if ( NO_ERROR == ret ) { switch(cmd) { case CAMERA_CMD_START_SMOOTH_ZOOM: - ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_START_SMOOTH_ZOOM, arg1); break; - case CAMERA_CMD_STOP_SMOOTH_ZOOM: + case CAMERA_CMD_STOP_SMOOTH_ZOOM: ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_SMOOTH_ZOOM); + break; case CAMERA_CMD_START_FACE_DETECTION: - ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_START_FD); break; case CAMERA_CMD_STOP_FACE_DETECTION: - - ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_FD); + if (previewEnabled()) { + ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_FD); + } break; @@ -3908,6 +3891,20 @@ status_t CameraHal::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) break; #endif +#ifdef ANDROID_API_JB_OR_LATER + case CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG: + { + const bool enable = static_cast<bool>(arg1); + android::AutoMutex lock(mLock); + if ( enable ) { + mMsgEnabled |= CAMERA_MSG_FOCUS_MOVE; + } else { + mMsgEnabled &= ~CAMERA_MSG_FOCUS_MOVE; + } + break; + } +#endif + default: break; }; |