summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-06-05 11:29:16 -0700
committerEino-Ville Talvala <etalvala@google.com>2012-06-05 11:29:16 -0700
commit2d76a0698db5b10110eecba78d49c5853a45f9cd (patch)
treed0134e062ccd1f94e91b22f41f351321b7a23eff
parent78897c51c2e8249257c8f19800912849460e0c57 (diff)
downloaddevice_samsung_crespo-2d76a0698db5b10110eecba78d49c5853a45f9cd.zip
device_samsung_crespo-2d76a0698db5b10110eecba78d49c5853a45f9cd.tar.gz
device_samsung_crespo-2d76a0698db5b10110eecba78d49c5853a45f9cd.tar.bz2
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
-rwxr-xr-xlibcamera/SecCameraHWInterface.cpp5
1 files changed, 5 insertions, 0 deletions
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.