From 2d76a0698db5b10110eecba78d49c5853a45f9cd Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Tue, 5 Jun 2012 11:29:16 -0700 Subject: Camera: Fix crash when cancelling autofocus outside of preview. Cancelling autofocus should be possible outside of preview. Make it a no-op, since the lens is re-initialized on preview start in any case. Bug: 6579941 Change-Id: I3d7444becf052e1ca2593937bee494c637715cb6 --- libcamera/SecCameraHWInterface.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libcamera') diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp index 5907f34..ab60bd2 100755 --- a/libcamera/SecCameraHWInterface.cpp +++ b/libcamera/SecCameraHWInterface.cpp @@ -898,6 +898,11 @@ status_t CameraHardwareSec::cancelAutoFocus() { ALOGV("%s :", __func__); + // If preview is not running, cancel autofocus can still be called. + // Since the camera subsystem is completely reset on preview start, + // cancel AF is a no-op. + if (!mPreviewRunning) return NO_ERROR; + // cancelAutoFocus should be allowed after preview is started. But if // the preview is deferred, cancelAutoFocus will fail. Ignore it if that is // the case. -- cgit v1.1