Merge "st-hal: fix session back to active due to playback event"
diff --git a/sound_trigger_hw.c b/sound_trigger_hw.c
index f677147..54d26d7 100644
--- a/sound_trigger_hw.c
+++ b/sound_trigger_hw.c
@@ -1246,8 +1246,8 @@
              platform_stdev_compare_device_type(&stdev->active_rx_dev_list,
                  AUDIO_DEVICE_OUT_SPEAKER) ||
              platform_stdev_compare_device_type(&stdev->active_rx_dev_list,
-                 AUDIO_DEVICE_IN_WIRED_HEADSET))) {
-
+                 AUDIO_DEVICE_IN_WIRED_HEADSET)) &&
+             stdev->session_allowed) {
             /* pause and resume ADSP sessions to send new echo reference */
             list_for_each(node, &stdev->sound_model_list) {
                 p_ses = node_to_item(node, st_session_t, list_node);
diff --git a/sound_trigger_platform.c b/sound_trigger_platform.c
index 4fb305a..ecef1d4 100644
--- a/sound_trigger_platform.c
+++ b/sound_trigger_platform.c
@@ -4669,7 +4669,7 @@
 {
     struct platform_data *my_data;
     sound_trigger_device_t *stdev;
-    bool concurrency_ses_allowed = false;
+    bool concurrency_ses_allowed = true;
 
     if (!platform) {
         ALOGE("%s: NULL platform", __func__);
@@ -4723,13 +4723,12 @@
         }
         if (event_type == AUDIO_EVENT_PLAYBACK_STREAM_ACTIVE ||
             event_type == AUDIO_EVENT_PLAYBACK_STREAM_INACTIVE) {
-            concurrency_ses_allowed = true;
             if (stdev->rx_concurrency_disabled &&
                 stdev->rx_concurrency_active > 0 &&
                 num_sessions > stdev->rx_conc_max_st_ses)
                 concurrency_ses_allowed = false;
-        } else if (stdev->conc_capture_supported) {
-            concurrency_ses_allowed = true;
+        }
+        if (concurrency_ses_allowed && stdev->conc_capture_supported) {
             if ((!stdev->conc_voice_call_supported && stdev->conc_voice_active) ||
                 (!stdev->conc_voip_call_supported && stdev->conc_voip_active))
                 concurrency_ses_allowed = false;
@@ -4757,8 +4756,8 @@
         }
         if (stdev->conc_capture_supported)
             concurrency_ses_allowed = stdev->session_allowed;
-        else if (stdev->tx_concurrency_active == 0)
-            concurrency_ses_allowed = true;
+        else if (stdev->tx_concurrency_active > 0)
+            concurrency_ses_allowed = false;
     }
 
     /*