Camera: Allowed auto focus when last auto focus is cancelled in preview state

Cancel auto focus is invoked only when auto focus is in progress
Auto focus is not invoked only when cancel auto focus is in progress
Auto focus will continue when previous auto focus was cancelled
in preview state
Removed auto focus state variable

CRs-Fixed: 228472
diff --git a/QualcommCameraHardware.cpp b/QualcommCameraHardware.cpp
index eb8baa2..ce6fc36 100644
--- a/QualcommCameraHardware.cpp
+++ b/QualcommCameraHardware.cpp
@@ -2469,11 +2469,6 @@
     }
     mParameters.set("max-zoom",mMaxZoom);
 
-    //Initialize AF state to AF_NOTSTARTED
-    mAfLock.lock();
-    mAfState = AF_NOTSTARTED;
-    mAfLock.unlock();
-
     LOGV("startPreviewInternal X");
     return NO_ERROR;
 }
@@ -2590,20 +2585,15 @@
     status_t err;
     err = mAfLock.tryLock();
     if(err == NO_ERROR) {
-        //Got Lock, so start AF if required.
-        if(mAfState != AF_CANCELLED) {
-            mAfState = AF_STARTED;
-            LOGV("Start AF");
-            status = native_set_afmode(mAutoFocusFd, afMode);
-        } else {
-            status = FALSE;
-        }
+        LOGV("Start AF");
+        status = native_set_afmode(mAutoFocusFd, afMode);
         mAfLock.unlock();
     }
     else{
         //AF Cancel would have acquired the lock,
         //so, no need to perform any AF
-        LOGV("Failed to obtain Lock...is busy");
+        LOGV("As Cancel auto focus is in progress, auto focus request "
+                "is ignored");
         status = FALSE;
     }
 
@@ -2653,8 +2643,8 @@
     if(err == NO_ERROR) {
         //Got Lock, means either AF hasn't started or
         // AF is done. So no need to cancel it, just change the state
-        LOGV("Change AF State to Cancelled");
-        mAfState = AF_CANCELLED;
+        LOGV("As Auto Focus is not in progress, Cancel Auto Focus "
+                "is ignored");
         mAfLock.unlock();
     }
     else {