Merge "hal: fix input stream open fail for AUDIO_SOURCE_VOICE_COMMUNICATION" into audio-hal.lnx.4.0
diff --git a/qahw_api/src/qahw_api.cpp b/qahw_api/src/qahw_api.cpp
index 8967e79..cbd9041 100644
--- a/qahw_api/src/qahw_api.cpp
+++ b/qahw_api/src/qahw_api.cpp
@@ -1113,6 +1113,7 @@
 
 int qahw_unload_module(qahw_module_handle_t *hw_module)
 {
+    int rc = -EINVAL;
     ALOGV("%d:%s",__LINE__, __func__);
     if (g_binder_enabled) {
         if (!g_qas_died && ((g_qas_load_count > 0) && (--g_qas_load_count == 0))) {
@@ -1120,7 +1121,13 @@
             if (qas_status(qas) == -1)
                 return -ENODEV;
             pthread_mutex_destroy(&list_lock);
-            return qas->qahw_unload_module(hw_module);
+            rc = qas->qahw_unload_module(hw_module);
+            if (g_death_notifier != NULL) {
+                IInterface::asBinder(qas)->unlinkToDeath(g_death_notifier);
+                g_death_notifier.clear();
+            }
+            g_qas = NULL;
+            return rc;
         } else {
             return -ENODEV;
         }
diff --git a/qahw_api/test/qap_wrapper_extn.c b/qahw_api/test/qap_wrapper_extn.c
index a084277..9cd9fd6 100644
--- a/qahw_api/test/qap_wrapper_extn.c
+++ b/qahw_api/test/qap_wrapper_extn.c
@@ -814,6 +814,22 @@
 
             break;
         }
+        case QAP_MODULE_CALLBACK_EVENT_INPUT_CFG_CHANGE:
+        {
+            if (size < sizeof(qap_input_config_t)) {
+                ALOGE("%s %d event id %d, wrong payload size %d\n",
+                      __func__, __LINE__, event_id, size);
+                break;
+            }
+            qap_input_config_t *p_stream_format = (qap_input_config_t*)data;
+
+            ALOGV(" %s %d Input format updated; sample_rate %lu, channels %lu, bitwidth %lu",
+                  __func__, __LINE__,
+                  p_stream_format->sample_rate,
+                  p_stream_format->channels,
+                  p_stream_format->bit_width);
+            break;
+        }
         default:
         break;
     }