diff options
author | Javier Ferrer <javi.f.o@gmail.com> | 2014-05-14 23:59:00 +0100 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-05-17 22:18:33 +0100 |
commit | 553571f7e89a276972464f1e46086ca68ddf8444 (patch) | |
tree | 1ded110a787419d3de367fc98cdde0b377d27972 | |
parent | 63f3f0ef966f45dc5f5d8a3e9b7e50219bd05137 (diff) | |
download | device_samsung_i9300-553571f7e89a276972464f1e46086ca68ddf8444.zip device_samsung_i9300-553571f7e89a276972464f1e46086ca68ddf8444.tar.gz device_samsung_i9300-553571f7e89a276972464f1e46086ca68ddf8444.tar.bz2 |
camerawrapper: Do not cancel auto focus when preview is not running
Change-Id: I9a457b7bab327a9252cf13a6ee46517063f603fa
-rw-r--r-- | camera/CameraWrapper.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index 2c1b49c..721852e 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -37,6 +37,8 @@ static android::Mutex gCameraWrapperLock; static camera_module_t *gVendorModule = 0; +static bool preview_running = false; + static int camera_device_open(const hw_module_t* module, const char *name, hw_device_t **device); static int camera_device_close(hw_device_t* device); @@ -235,13 +237,17 @@ int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) int camera_start_preview(struct camera_device * device) { + int rc; ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if (!device) return -EINVAL; - return VENDOR_CALL(device, start_preview); + rc = VENDOR_CALL(device, start_preview); + if (rc) + preview_running = true; + return rc; } void camera_stop_preview(struct camera_device * device) @@ -253,6 +259,7 @@ void camera_stop_preview(struct camera_device * device) return; VENDOR_CALL(device, stop_preview); + preview_running = false; } int camera_preview_enabled(struct camera_device * device) @@ -347,7 +354,10 @@ int camera_cancel_auto_focus(struct camera_device * device) if (!device) return -EINVAL; - return VENDOR_CALL(device, cancel_auto_focus); + if (preview_running) + return VENDOR_CALL(device, cancel_auto_focus); + else + return 0; } int camera_take_picture(struct camera_device * device) |