exynos: audiohal: Always allow to reconfigure stream if voice recognition is active

* This allows apps to use the mic even if OK google is currently using it,
  as soon as the app is done, it will be routed to recognition-mic again

Change-Id: Ie92770db71e566ea6fc28df4d5ead1b099d15e9d
diff --git a/libaudio/audiohal/audio_hw.c b/libaudio/audiohal/audio_hw.c
index 8fa8e34..6309324 100644
--- a/libaudio/audiohal/audio_hw.c
+++ b/libaudio/audiohal/audio_hw.c
@@ -2671,6 +2671,17 @@
     parms = str_parms_create_str(kvpairs);
 
     pthread_mutex_lock(&in->common.lock);
+    ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_INPUT_SOURCE, value, sizeof(value));
+    if (ret >= 0) {
+        unsigned int new_source = atoi(value);
+        if (in->requested_source == AUDIO_SOURCE_VOICE_RECOGNITION || new_source == AUDIO_SOURCE_VOICE_RECOGNITION) {
+            stop_active_input(in);
+            in->requested_source = new_source;
+            in->common.stream_usage = adev_get_capture_ausage(adev, in);
+            in->pcm_reconfig = true;
+        }
+    }
+
     ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value));
     if (ret >= 0) {
         audio_devices_t requested_devices = atoi(value);