summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-06-05 11:29:16 -0700
committerThe Android Automerger <android-build@android.com>2012-06-05 16:24:42 -0700
commit2084d15f41da278f2323bdd8a6b6616f4712d2d9 (patch)
tree347191c5111762a7c6f76fad87fa0302579f22be
parent5bf3edc651cd7745d8879a6b9d44237087a1446e (diff)
downloaddevice_samsung_crespo-2084d15f41da278f2323bdd8a6b6616f4712d2d9.zip
device_samsung_crespo-2084d15f41da278f2323bdd8a6b6616f4712d2d9.tar.gz
device_samsung_crespo-2084d15f41da278f2323bdd8a6b6616f4712d2d9.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.