Add missing implementation for resolving appid from pid 51/215751/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 15 Oct 2019 07:55:08 +0000 (16:55 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 18 Oct 2019 04:30:47 +0000 (13:30 +0900)
Change-Id: Idfb73b15e7a116f93be61e5f8c6f0e1afa5f6095

src/multi_assistant_service.c

index f0754a0..073967b 100644 (file)
@@ -369,7 +369,13 @@ int mas_client_send_result(int pid, char* display_text, char* utterance_text, ch
                MAS_LOGE("[ERROR] Fail to send result, ret(%d)", ret);
        }
 
-       multi_assistant_service_plugin_update_recognition_result(NULL, MA_RECOGNITION_RESULT_EVENT_SUCCESS);
+       const char* pid_appid = NULL;
+       char buf[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) {
+               buf[MAX_APPID_LEN - 1] = '\0';
+               pid_appid = buf;
+       }
+       multi_assistant_service_plugin_update_recognition_result(pid_appid, MA_RECOGNITION_RESULT_EVENT_SUCCESS);
 
        return ret;
 }
@@ -382,7 +388,13 @@ int mas_client_send_recognition_result(int pid, int result)
                MAS_LOGE("[ERROR] Fail to send recognition result, ret(%d)", ret);
        }
 
-       multi_assistant_service_plugin_update_recognition_result(NULL, result);
+       const char* pid_appid = NULL;
+       char buf[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) {
+               buf[MAX_APPID_LEN - 1] = '\0';
+               pid_appid = buf;
+       }
+       multi_assistant_service_plugin_update_recognition_result(pid_appid, result);
 
        return ret;
 }
@@ -426,19 +438,37 @@ int mas_client_stop_streaming_audio_data(int pid, int type)
 
 int mas_client_update_voice_feedback_state(int pid, int state)
 {
-       multi_assistant_service_plugin_update_voice_feedback_state(NULL, state);
+       const char* pid_appid = NULL;
+       char buf[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) {
+               buf[MAX_APPID_LEN - 1] = '\0';
+               pid_appid = buf;
+       }
+       multi_assistant_service_plugin_update_voice_feedback_state(pid_appid, state);
        return 0;
 }
 
 int mas_client_send_assistant_specific_command(int pid, const char *command)
 {
-       multi_assistant_service_plugin_send_assistant_specific_command(NULL, command);
+       const char* pid_appid = NULL;
+       char buf[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) {
+               buf[MAX_APPID_LEN - 1] = '\0';
+               pid_appid = buf;
+       }
+       multi_assistant_service_plugin_send_assistant_specific_command(pid_appid, command);
        return 0;
 }
 
 int mas_client_set_background_volume(int pid, double ratio)
 {
-       multi_assistant_service_plugin_set_background_volume(NULL, ratio);
+       const char* pid_appid = NULL;
+       char buf[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) {
+               buf[MAX_APPID_LEN - 1] = '\0';
+               pid_appid = buf;
+       }
+       multi_assistant_service_plugin_set_background_volume(pid_appid, ratio);
        return 0;
 }
 
@@ -490,8 +520,14 @@ int mas_client_send_preprocessing_result(int pid, bool result)
 
 int mas_client_set_wake_word_audio_require_flag(int pid, bool require)
 {
-       multi_assistant_service_plugin_set_wake_word_audio_require_flag(NULL, require);
+       const char* pid_appid = NULL;
+       char buf[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) {
+               buf[MAX_APPID_LEN - 1] = '\0';
+               pid_appid = buf;
+       }
 
+       multi_assistant_service_plugin_set_wake_word_audio_require_flag(pid_appid, require);
        return 0;
 }