sthal: add a check to skip client detection callback

To prevent a race condition when stop recognition is
called immediately after start recognition is done
but client detection callback is not called, add a
check in function pal_callback to invoke callback
function only when the session state is active.

Change-Id: I6f2fe264afef522a2afece128710014ea10f0be9
diff --git a/SoundTriggerSession.cpp b/SoundTriggerSession.cpp
index 2175371..34d9b81 100644
--- a/SoundTriggerSession.cpp
+++ b/SoundTriggerSession.cpp
@@ -200,7 +200,10 @@
     session->ses_mutex_.unlock();
     lock_status = false;
     ATRACE_BEGIN("sthal: client detection callback");
-    callback(st_event, session->GetCookie());
+    if (session->state_ == ACTIVE)
+        callback(st_event, session->GetCookie());
+    else
+        ALOGW("%s: skip detection callback as client has stopped", __func__);
     ATRACE_END();
 
 exit: