agm: plugins: test: Update voice ui test with latest GKV

Update voice ui test with latest GKV.

Change-Id: Ic80aee2fbcfe98116b68b59c5b23567f0d5610fc
diff --git a/plugins/tinyalsa/test/Android.mk b/plugins/tinyalsa/test/Android.mk
index 5316769..a351a7d 100644
--- a/plugins/tinyalsa/test/Android.mk
+++ b/plugins/tinyalsa/test/Android.mk
@@ -87,5 +87,26 @@
 
 LOCAL_VENDOR_MODULE := true
 include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+
+LOCAL_C_INCLUDES += $(TOP)/external/tinyalsa/include
+LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/include/mm-audio/
+LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/include/mm-audio/acdbdata/
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -DBACKEND_CONF_FILE=\"/vendor/etc/backend_conf.xml\"
+
+LOCAL_SRC_FILES := agm_voiceui.c
+
+LOCAL_MODULE := agmvoiceui
+LOCAL_MODULE_OWNER         := qti
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+        libtinyalsa\
+        libagmmixer
+
+LOCAL_VENDOR_MODULE := true
+include $(BUILD_EXECUTABLE)
 endif
 endif
diff --git a/plugins/tinyalsa/test/agm_voiceui.c b/plugins/tinyalsa/test/agm_voiceui.c
index 8e3591d..000b3ce 100644
--- a/plugins/tinyalsa/test/agm_voiceui.c
+++ b/plugins/tinyalsa/test/agm_voiceui.c
@@ -299,8 +299,8 @@
         goto err_close_mixer;
     }
 
-    param_buf = merge_payload(5, &param_size, "/etc/sound_model", "/etc/wakeup_config", "/etc/event_config",
-                                 "/etc/buffer_config", "/etc/stream_setup_duration");
+    param_buf = merge_payload(5, &param_size, "/vendor/etc/sound_model", "/vendor/etc/wakeup_config", "/vendor/etc/event_config",
+                                 "/vendor/etc/buffer_config", "/vendor/etc/stream_setup_duration");
 
     if (agm_mixer_set_param(mixer, device, STREAM_PCM, param_buf, param_size)) {
         printf("setparam failed\n");
@@ -371,10 +371,8 @@
 
     record_lab_buffer(pcm, cap_time);
 
-    agm_mixer_get_event_param(mixer, device, STREAM_PCM, miid);
-
     /* Reset Engine */
-    if (agm_mixer_set_param_with_file(mixer, device, STREAM_PCM, "/etc/engine_reset")) {
+    if (agm_mixer_set_param_with_file(mixer, device, STREAM_PCM, "/vendor/etc/engine_reset")) {
         printf("stream setup duration configuration failed\n");
         goto err_close_pcm;
     }
diff --git a/plugins/tinyalsa/test/agmmixer.c b/plugins/tinyalsa/test/agmmixer.c
index 00d0522..9cdccec 100644
--- a/plugins/tinyalsa/test/agmmixer.c
+++ b/plugins/tinyalsa/test/agmmixer.c
@@ -548,6 +548,13 @@
     if (val == PCM_LL_PLAYBACK || val == COMPRESSED_OFFLOAD_PLAYBACK)
         num_gkv += 1;
 
+    if (val == VOICE_UI) {
+        if (intf_name)
+            num_gkv = 2;
+        else
+            num_gkv = 3;
+    }
+
     gkv_size = num_gkv * sizeof(struct agm_key_value);
     ckv_size = num_ckv * sizeof(struct agm_key_value);
     prop_size = sizeof(struct prop_data) + (num_props * sizeof(uint32_t));
@@ -568,29 +575,47 @@
         return -ENOMEM;
     }
 
-    if (d == PLAYBACK)
-        gkv[index].key = STREAMRX;
-    else
-        gkv[index].key = STREAMTX;
-
-    gkv[index].value = val;
-
-    index++;
-    if (val == PCM_LL_PLAYBACK || val == COMPRESSED_OFFLOAD_PLAYBACK) {
-        gkv[index].key = INSTANCE;
-        gkv[index].value = INSTANCE_1;
-	index++;
-    }
-
-    if (d == PLAYBACK) {
-        gkv[index].key = DEVICEPP_RX;
-        gkv[index].value = DEVICEPP_RX_AUDIO_MBDRC;
-    } else {
-        gkv[index].key = DEVICEPP_TX;
-        if (val == VOICE_UI)
+    if (val == VOICE_UI) {
+        if (intf_name) {
+            gkv[index].key = DEVICEPP_TX;
             gkv[index].value = DEVICEPP_TX_VOICE_UI_FLUENCE_FFECNS;
+            index++;
+            gkv[index].key = DEVICETX;
+            gkv[index].value = HANDSETMIC;
+            index++;
+        } else {
+            gkv[index].key = STREAMTX;
+            gkv[index].value = val;
+            index++;
+            gkv[index].key = INSTANCE;
+            gkv[index].value = INSTANCE_1;
+            index++;
+            gkv[index].key = VOICE_UI_STREAM_CONFIG;
+            gkv[index].value = VUI_STREAM_CFG_SVA;
+            index++;
+        }
+    } else {
+        if (d == PLAYBACK)
+            gkv[index].key = STREAMRX;
         else
+            gkv[index].key = STREAMTX;
+
+        gkv[index].value = val;
+
+        index++;
+        if (val == PCM_LL_PLAYBACK || val == COMPRESSED_OFFLOAD_PLAYBACK) {
+            gkv[index].key = INSTANCE;
+            gkv[index].value = INSTANCE_1;
+            index++;
+        }
+
+        if (d == PLAYBACK) {
+            gkv[index].key = DEVICEPP_RX;
+            gkv[index].value = DEVICEPP_RX_AUDIO_MBDRC;
+        } else {
+            gkv[index].key = DEVICEPP_TX;
             gkv[index].value = DEVICEPP_TX_AUDIO_FLUENCE_SMECNS;
+        }
     }
 
     index = 0;