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
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 @@
 {
     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.