QCamera2: Don't initialize preview channel in ready state

 Flash torch configuration shouldn't trigger
 preview channel initialization/release once
 we are in preview ready state. At this point
 the client has already called 'startPreview'
 and the flash configuration will get applied
 once a valid preview window starts preview.

Change-Id: Ib44af3af593daabc7f1b901cd0b74eee773d20ad
diff --git a/QCamera2/HAL/QCameraStateMachine.cpp b/QCamera2/HAL/QCameraStateMachine.cpp
index 9dc67e9..65054ae 100644
--- a/QCamera2/HAL/QCameraStateMachine.cpp
+++ b/QCamera2/HAL/QCameraStateMachine.cpp
@@ -2912,6 +2912,26 @@
 }
 
 /*===========================================================================
+ * FUNCTION   : isPreviewReady
+ *
+ * DESCRIPTION: check if preview is in ready state.
+ *
+ * PARAMETERS : None
+ *
+ * RETURN     : true -- preview is in ready state
+ *              false -- preview is stopped
+ *==========================================================================*/
+bool QCameraStateMachine::isPreviewReady()
+{
+    switch (m_state) {
+    case QCAMERA_SM_STATE_PREVIEW_READY:
+        return true;
+    default:
+        return false;
+    }
+}
+
+/*===========================================================================
  * FUNCTION   : isCaptureRunning
  *
  * DESCRIPTION: check if image capture is in process.