QCamera2: handle snapshot_done evt in different states

Because snapshot_done evt is now a sync call, need to handle this
event in all states to signal condition variable to avoid hang of
notifyThread.

Change-Id: I4e3cb366e95cfde88403f875539cec2def395e1f
diff --git a/QCamera2/HAL/QCameraStateMachine.cpp b/QCamera2/HAL/QCameraStateMachine.cpp
index 7504ef8..558ff39 100644
--- a/QCamera2/HAL/QCameraStateMachine.cpp
+++ b/QCamera2/HAL/QCameraStateMachine.cpp
@@ -558,9 +558,18 @@
             }
         }
         break;
+    case QCAMERA_SM_EVT_SNAPSHOT_DONE:
+        {
+            // No ops, but need to notify
+            ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
+            result.status = rc;
+            result.request_api = evt;
+            result.result_type = QCAMERA_API_RESULT_TYPE_DEF;
+            m_parent->signalEvtResult(&result);
+        }
+       break;
     case QCAMERA_SM_EVT_EVT_INTERNAL:
     case QCAMERA_SM_EVT_JPEG_EVT_NOTIFY:
-    case QCAMERA_SM_EVT_SNAPSHOT_DONE:
     default:
         ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
         break;
@@ -838,9 +847,18 @@
             }
         }
         break;
+    case QCAMERA_SM_EVT_SNAPSHOT_DONE:
+        {
+            // No ops, but need to notify
+            ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
+            result.status = rc;
+            result.request_api = evt;
+            result.result_type = QCAMERA_API_RESULT_TYPE_DEF;
+            m_parent->signalEvtResult(&result);
+        }
+       break;
     case QCAMERA_SM_EVT_EVT_INTERNAL:
     case QCAMERA_SM_EVT_JPEG_EVT_NOTIFY:
-    case QCAMERA_SM_EVT_SNAPSHOT_DONE:
     case QCAMERA_SM_EVT_THERMAL_NOTIFY:
     default:
         ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
@@ -1203,8 +1221,17 @@
                     *(qcamera_thermal_level_enum_t *)&payload);
         }
         break;
-    case QCAMERA_SM_EVT_JPEG_EVT_NOTIFY:
     case QCAMERA_SM_EVT_SNAPSHOT_DONE:
+        {
+            // No ops, but need to notify
+            ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
+            result.status = rc;
+            result.request_api = evt;
+            result.result_type = QCAMERA_API_RESULT_TYPE_DEF;
+            m_parent->signalEvtResult(&result);
+        }
+       break;
+    case QCAMERA_SM_EVT_JPEG_EVT_NOTIFY:
     default:
         ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
         break;
@@ -1312,9 +1339,18 @@
             }
         }
         break;
+    case QCAMERA_SM_EVT_SNAPSHOT_DONE:
+        {
+            // No ops, but need to notify
+            ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
+            result.status = rc;
+            result.request_api = evt;
+            result.result_type = QCAMERA_API_RESULT_TYPE_DEF;
+            m_parent->signalEvtResult(&result);
+        }
+       break;
     case QCAMERA_SM_EVT_THERMAL_NOTIFY:
     case QCAMERA_SM_EVT_JPEG_EVT_NOTIFY:
-    case QCAMERA_SM_EVT_SNAPSHOT_DONE:
     default:
         ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
         break;
@@ -1930,8 +1966,17 @@
                     *(qcamera_thermal_level_enum_t *)&payload);
         }
         break;
-    case QCAMERA_SM_EVT_JPEG_EVT_NOTIFY:
     case QCAMERA_SM_EVT_SNAPSHOT_DONE:
+        {
+            // No ops, but need to notify
+            ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
+            result.status = rc;
+            result.request_api = evt;
+            result.result_type = QCAMERA_API_RESULT_TYPE_DEF;
+            m_parent->signalEvtResult(&result);
+        }
+       break;
+    case QCAMERA_SM_EVT_JPEG_EVT_NOTIFY:
     default:
         ALOGE("%s: cannot handle evt(%d) in state(%d)", __func__, evt, m_state);
         break;