From ed6f6921882fee2577b25be38ef2a2230c39ecef Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 16 Jul 2020 20:09:12 +0900 Subject: [PATCH 01/16] Add logs for checking wakeup_engine_command delivery Change-Id: Ib114ff5f46c96850d344eb26c43135f371222b74 --- plugins/wakeup-manager/src/wakeup_engine_manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index d9181dc..40f6833 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -728,7 +728,8 @@ bool CWakeupEngineManager::on_audio_data_require_status(string engine_name, bool bool CWakeupEngineManager::on_wakeup_engine_command(string engine_name, mas_wakeup_engine_command_target_e target, string assistant_name, string command) { - MWR_LOGD("[ENTER]"); + MWR_LOGI("[ENTER] : %s %d %s %s", + engine_name.c_str(), target, assistant_name.c_str(), command.c_str()); for (const auto& observer : mObservers) { if (observer) { @@ -745,6 +746,7 @@ bool CWakeupEngineManager::on_wakeup_engine_command(string engine_name, mas_wake for (const auto& assistant : iter->assistant_list) { if (0 == assistant_name.compare(assistant) || MAS_WAKEUP_ENGINE_COMMAND_TARGET_ALL_ASSISTANTS == target) { + MWR_LOGI("Calling on_wakeup_engine_command for %s", assistant.c_str()); if (!observer->on_wakeup_engine_command(target, engine_name, assistant, command)) { LOGE("[Recorder WARNING] One of the observer returned false"); } -- 2.7.4 From 39ee9688098e5e7f79fe5d510373fed1c6446152 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 17 Jul 2020 11:42:04 +0900 Subject: [PATCH 02/16] Bump version to 0.2.35 Change-Id: Ib8b1ca66b5e49ef6266973cb960092c7839473a3 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index db96b45..c012fe7 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index f5ffa24..5288e81 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.2.34 +Version: 0.2.35 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From eb0c49d73f42ef9d2adbad128bf0744b8807ba17 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 17 Jul 2020 21:29:55 +0900 Subject: [PATCH 03/16] Replace ecore_thread_main_loop_* functions with alternatives Change-Id: Ied3b35f41bb7c9f8bc74bc24d42e5a92e3b4b551 --- plugins/wakeup-manager/inc/wakeup_policy_default.h | 8 ++++++- .../wakeup-manager/src/wakeup_policy_default.cpp | 28 ++++++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/plugins/wakeup-manager/inc/wakeup_policy_default.h b/plugins/wakeup-manager/inc/wakeup_policy_default.h index d4b36b7..914c539 100644 --- a/plugins/wakeup-manager/inc/wakeup_policy_default.h +++ b/plugins/wakeup-manager/inc/wakeup_policy_default.h @@ -40,12 +40,18 @@ public: bool valid() override; void set_assistant_priority(string appid, int priority); - void set_delay(float seconds); void wakeup_candidate(mas_wakeup_event_info wakeup_info) override; void select_candidate(mas_wakeup_event_info wakeup_info) override; void timer_expired(); + + void set_delay(float seconds); + float get_delay(); + + void set_timer(Ecore_Timer* timer); + Ecore_Timer* get_timer(); + private: typedef struct { string appid; diff --git a/plugins/wakeup-manager/src/wakeup_policy_default.cpp b/plugins/wakeup-manager/src/wakeup_policy_default.cpp index e07374c..45b5caa 100644 --- a/plugins/wakeup-manager/src/wakeup_policy_default.cpp +++ b/plugins/wakeup-manager/src/wakeup_policy_default.cpp @@ -45,12 +45,28 @@ void CWakeupPolicyDefault::set_delay(float seconds) mDelaySeconds = seconds; } +float CWakeupPolicyDefault::get_delay() +{ + return mDelaySeconds; +} + +void CWakeupPolicyDefault::set_timer(Ecore_Timer* timer) +{ + mTimer = timer; +} + +Ecore_Timer* CWakeupPolicyDefault::get_timer() +{ + return mTimer; +} + static Eina_Bool timer_func(void *data) { LOGD("[ENTER]"); if (data) { CWakeupPolicyDefault *policy = static_cast(data); policy->timer_expired(); + policy->set_timer(nullptr); } return ECORE_CALLBACK_CANCEL; } @@ -59,11 +75,13 @@ void CWakeupPolicyDefault::wakeup_candidate(mas_wakeup_event_info wakeup_info) { mWakeupInfos.push_back(wakeup_info); if (nullptr == mTimer) { - LOGD("Begin Ecore Thread Main Loop"); - ecore_thread_main_loop_begin(); - mTimer = ecore_timer_add(mDelaySeconds, timer_func, this); - LOGD("End Ecore Thread Main Loop"); - ecore_thread_main_loop_end(); + ecore_main_loop_thread_safe_call_async([](void* data) { + CWakeupPolicyDefault* policy = static_cast(data); + if (!policy) return; + + Ecore_Timer* timer = ecore_timer_add(policy->get_delay(), timer_func, data); + policy->set_timer(timer); + }, this); } } -- 2.7.4 From e667ff3d7f76ec4daf1c2f8cdd7defe789ae9647 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 22 Jul 2020 16:49:01 +0900 Subject: [PATCH 04/16] Bump version to 0.3.4 Change-Id: I07a09e3abf3283bd5e737bbb7682b689c6a6d204 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index 2a18a99..83153e1 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 10c9ac5..4781812 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.3.3 +Version: 0.3.4 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 894ba9867035e67eda19e35f17e105f36cef911b Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 22 Jul 2020 17:21:24 +0900 Subject: [PATCH 05/16] Bump version to 0.2.36 Change-Id: Idf77f083e501e14f1c5b00f802cc01c60a929754 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index c012fe7..13cc8d2 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 5288e81..495fec1 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.2.35 +Version: 0.2.36 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 111600c4d88fdc3ae398b1cd0bc2a840b32ffa7e Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Mon, 3 Aug 2020 16:36:48 +0900 Subject: [PATCH 06/16] Fix bug assigning a newly created variable's value to itself Change-Id: I4ed18c047de2d7747193bf7296984eb2d782f70b --- src/service_plugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/service_plugin.cpp b/src/service_plugin.cpp index fe05b22..ca4416c 100644 --- a/src/service_plugin.cpp +++ b/src/service_plugin.cpp @@ -157,6 +157,7 @@ static void process_wakeup_event_by_word_timer(void* data) char* wakeup_word = static_cast(param->data); const char* appid = nullptr; + int id = param->id; CServicePlugin* plugin = param->plugin; CServiceMain* service_main = nullptr; @@ -174,7 +175,7 @@ static void process_wakeup_event_by_word_timer(void* data) if (service_main && appid) { param = new(std::nothrow) AsyncParam; if (param) { - param->id = param->id; + param->id = id; param->data = static_cast(strdup(appid)); param->plugin = plugin; process_wakeup_event_by_appid_timer(static_cast(param)); -- 2.7.4 From 6b26929dd1f6dc252d3fe89e6532aab4724b4743 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Mon, 3 Aug 2020 16:37:48 +0900 Subject: [PATCH 07/16] Bump version to 0.3.5 Change-Id: Ic80e59952a36c16b2f0f0508d880a83de78419d0 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index 83153e1..e7ec256 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 4781812..1aa7b5c 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.3.4 +Version: 0.3.5 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From fe16d7610ebe5d86ec24df523118ab1bfaf0cb96 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 7 Aug 2020 15:25:06 +0900 Subject: [PATCH 08/16] Fix bug NULL is passed on streaming failure event Change-Id: I5b2900a9110d10051bfa028deb0ab5adf5f24a4e --- src/service_plugin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/service_plugin.cpp b/src/service_plugin.cpp index ca4416c..254fb8e 100644 --- a/src/service_plugin.cpp +++ b/src/service_plugin.cpp @@ -350,8 +350,15 @@ void handle_speech_streaming_event_failure(void* data) static void __audio_streaming_cb(mas_speech_streaming_event_e event, void* buffer, int len, void *user_data) { + CServicePlugin* plugin = static_cast(user_data); + if (event == MAS_SPEECH_STREAMING_EVENT_FAIL) { - ecore_main_loop_thread_safe_call_async(handle_speech_streaming_event_failure, NULL); + AsyncParam* param = new(std::nothrow) AsyncParam; + if (param) { + param->plugin = plugin; + ecore_main_loop_thread_safe_call_async( + handle_speech_streaming_event_failure, static_cast(param)); + } return; } static int count = 0; @@ -361,7 +368,6 @@ static void __audio_streaming_cb(mas_speech_streaming_event_e event, void* buffe } ++count; - CServicePlugin* plugin = static_cast(user_data); CServiceIpcDbus* service_ipc = nullptr; CServiceMain* service_main = nullptr; if (plugin) { -- 2.7.4 From acb7991ffb6361917e8923ac1fbadac98a3c9be1 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 7 Aug 2020 15:26:03 +0900 Subject: [PATCH 09/16] Bump version to 0.3.6 Change-Id: Ibe2072f0b0d6b81c8d110d45ec41e25a3e456cc2 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index e7ec256..7ac0e5a 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 1aa7b5c..6957ade 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.3.5 +Version: 0.3.6 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 600725865c2dce036e6260c28a812fa18659aff0 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 13 Aug 2020 14:14:36 +0900 Subject: [PATCH 10/16] Ignore streaming requests from clients not currently woken up Change-Id: I875b53caf10a110c967f6039604fbd4761ea47b7 --- src/service_main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/service_main.cpp b/src/service_main.cpp index 7830c3f..a741ae0 100644 --- a/src/service_main.cpp +++ b/src/service_main.cpp @@ -200,6 +200,17 @@ int CServiceMain::client_send_recognition_result(pid_t pid, int result) int CServiceMain::client_start_streaming_audio_data(pid_t pid, int type) { int ret = -1; + const char *current_maclient_appid = NULL; + if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { + current_maclient_appid = mClientInfo[mCurrentClientInfo].appid; + pid_t pid_by_appid = mClientManager.find_client_pid_by_appid( + std::string{current_maclient_appid}); + if (pid != pid_by_appid) { + MAS_LOGE("[ERROR] Current client: [%d], active client : [%d %s]", + pid, pid_by_appid, current_maclient_appid); + return ret; + } + } switch(type) { case MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE: ret = mServicePlugin.start_streaming_utterance_data(); -- 2.7.4 From 26affd08fabbb73a92e13e430b5f9a352b5d9d3a Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 13 Aug 2020 14:32:28 +0900 Subject: [PATCH 11/16] Add more logs for tracking detailed streaming process Change-Id: Ic252bfc9af80f8fb49a882d49cc34f94e409d016 --- plugins/wakeup-manager/src/wakeup_engine_manager.cpp | 4 +++- plugins/wakeup-manager/src/wakeup_manager.cpp | 5 +++++ src/client_manager.cpp | 5 +++++ src/service_main.cpp | 2 ++ src/service_plugin.cpp | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index 0706120..2765498 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -270,8 +270,10 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() { MWR_LOGI("[ENTER]"); - if (nullptr == mSelectedEngine) + if (nullptr == mSelectedEngine) { + MWR_LOGE("No Engine Selected"); return; + } const wakeup_engine_interface *interface = &(mSelectedEngine->interface); diff --git a/plugins/wakeup-manager/src/wakeup_manager.cpp b/plugins/wakeup-manager/src/wakeup_manager.cpp index d1331cb..5b04280 100644 --- a/plugins/wakeup-manager/src/wakeup_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager.cpp @@ -888,7 +888,9 @@ void CWakeupManager::set_dependency_module_command(string engine_name, string co void CWakeupManager::start_streaming_duration_timer() { + MWR_LOGI("DURATION_TIMER START"); ecore_main_loop_thread_safe_call_async([](void* data) { + MWR_LOGI("DURATION_TIMER START - async"); CWakeupManager* manager = static_cast(data); if (!manager) return; @@ -907,7 +909,9 @@ void CWakeupManager::stop_streaming_duration_timer() { MWR_LOGI("DURATION_TIMER STOP"); if (mStreamingDurationTimer) { + MWR_LOGI("DURATION_TIMER STOP - has timer"); ecore_main_loop_thread_safe_call_async([](void* data) { + MWR_LOGI("DURATION_TIMER STOP - async"); CWakeupManager* manager = static_cast(data); if (!manager) return; @@ -921,6 +925,7 @@ void CWakeupManager::stop_streaming_duration_timer() void CWakeupManager::set_streaming_duration_timer(Ecore_Timer* timer) { + MWR_LOGI("DURATION_TIMER SET : %p", timer); mStreamingDurationTimer = timer; } diff --git a/src/client_manager.cpp b/src/client_manager.cpp index 01cd9d5..18339df 100644 --- a/src/client_manager.cpp +++ b/src/client_manager.cpp @@ -38,6 +38,7 @@ int CClientManager::create_client(pid_t pid, std::string appid) data->pid = pid; data->appid = appid; mClientList = g_slist_append(mClientList, data); + MAS_LOGI("Create client : %s %d", appid.c_str(), pid); } else { MAS_LOGE("[ERROR] data is NULL"); return -1;// MA_ERROR_OUT_OF_MEMORY; @@ -74,6 +75,7 @@ int CClientManager::destroy_client_by_appid(std::string appid) ma_client_s* CClientManager::find_client_by_appid(std::string appid) { + MAS_LOGI("Looking for client with appid : %s", appid.c_str()); ma_client_s *data = NULL; int count = g_slist_length(mClientList); @@ -84,6 +86,7 @@ ma_client_s* CClientManager::find_client_by_appid(std::string appid) if (NULL != data) { if (0 == appid.compare(data->appid)) { + MAS_LOGI("Found client : %s %d", data->appid.c_str(), data->pid); return data; } } @@ -138,6 +141,7 @@ pid_t CClientManager::find_client_pid_by_index(unsigned int index) pid_t CClientManager::find_client_pid_by_appid(std::string appid) { + MAS_LOGI("Checking PID of appid : %s", appid.c_str()); pid_t pid = -1; if (nullptr == mApplicationManager) { @@ -147,6 +151,7 @@ pid_t CClientManager::find_client_pid_by_appid(std::string appid) ma_client_s* client = find_client_by_appid(appid); if (client) { + MAS_LOGI("Found client : %s %d", client->appid.c_str(), client->pid); bool running = mApplicationManager->is_application_running(client->pid); if (false == running) { MAS_LOGE("The PID for %s was %d, but it seems to be terminated", diff --git a/src/service_main.cpp b/src/service_main.cpp index a741ae0..bb377a2 100644 --- a/src/service_main.cpp +++ b/src/service_main.cpp @@ -199,6 +199,7 @@ int CServiceMain::client_send_recognition_result(pid_t pid, int result) int CServiceMain::client_start_streaming_audio_data(pid_t pid, int type) { + MAS_LOGI("[ENTER"); int ret = -1; const char *current_maclient_appid = NULL; if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { @@ -748,6 +749,7 @@ pid_t CServiceMain::get_current_audio_processing_pid() pid_t CServiceMain::get_client_pid_by_appid(const char *appid) { + MAS_LOGI("Checking PID of appid : %s", appid); pid_t ret = -1; if (appid) { diff --git a/src/service_plugin.cpp b/src/service_plugin.cpp index 254fb8e..7f26d00 100644 --- a/src/service_plugin.cpp +++ b/src/service_plugin.cpp @@ -1020,6 +1020,7 @@ int CServicePlugin::process_event(int event, void *data, int len) int CServicePlugin::start_streaming_utterance_data(void) { + MAS_LOGI("[ENTER"); int ret = -1; if (NULL != mPluginHandle) { wakeup_manager_start_streaming_utterance_data func = mWakeupManagerInterface.start_streaming_utterance_data; -- 2.7.4 From d8d75be5cdb3ebe1b55d33426fbcb38bcc7d79a9 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 13 Aug 2020 14:34:31 +0900 Subject: [PATCH 12/16] Bump version to 0.3.7 Change-Id: I7d91386600cd93aab861f3b68644a607c0c978d5 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index 7ac0e5a..2f8a2db 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 6957ade..80dfbcb 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.3.6 +Version: 0.3.7 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 1b6655cf77b6081571eef2897b64196bc6b77fec Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 19 Aug 2020 15:23:34 +0900 Subject: [PATCH 13/16] Check sender validity on streaming related requests Change-Id: I648536f129462e4980a8b31e11e10d9dac996aac --- inc/service_main.h | 1 + src/service_main.cpp | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/inc/service_main.h b/inc/service_main.h index 414a3b9..766e512 100644 --- a/inc/service_main.h +++ b/inc/service_main.h @@ -157,6 +157,7 @@ private: bool check_preprocessing_assistant_exists(); ma_preprocessing_allow_mode_e get_preprocessing_allow_mode(const char* appid); bool is_current_preprocessing_assistant(const char* appid); + bool is_current_assistant(pid_t pid); private: std::string mCurrentLanguage{"en_US"}; diff --git a/src/service_main.cpp b/src/service_main.cpp index bb377a2..bbf3098 100644 --- a/src/service_main.cpp +++ b/src/service_main.cpp @@ -57,6 +57,24 @@ bool CServiceMain::check_preprocessing_assistant_exists() return ret; } +bool CServiceMain::is_current_assistant(pid_t pid) +{ + bool ret = false; + const char *current_maclient_appid = NULL; + if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { + current_maclient_appid = mClientInfo[mCurrentClientInfo].appid; + pid_t pid_by_appid = mClientManager.find_client_pid_by_appid( + std::string{current_maclient_appid}); + if (pid == pid_by_appid) { + ret = true; + } else { + MAS_LOGE("[ERROR] Current client: [%d], active client : [%d %s]", + pid, pid_by_appid, current_maclient_appid); + } + } + return ret; +} + bool CServiceMain::is_current_preprocessing_assistant(const char* appid) { if (NULL == appid) return false; @@ -138,6 +156,8 @@ int CServiceMain::client_send_voice_key_status_change(pid_t pid, ma_voice_key_st int CServiceMain::client_send_asr_result(pid_t pid, int event, const char* asr_result) { MAS_LOGD("[Enter] pid(%d), event(%d), asr_result(%s)", pid, event, asr_result); + if (!is_current_assistant(pid)) return -1; + bool ui_panel_enabled = mServicePlugin.is_ui_panel_enabled(); int ret = 0; if (ui_panel_enabled) { @@ -156,6 +176,8 @@ int CServiceMain::client_send_result(pid_t pid, const char* display_text, const char* utterance_text, const char* result_json) { MAS_LOGD("[Enter] pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json); + if (!is_current_assistant(pid)) return -1; + bool ui_panel_enabled = mServicePlugin.is_ui_panel_enabled(); int ret = 0; if (ui_panel_enabled) { @@ -178,6 +200,8 @@ int CServiceMain::client_send_result(pid_t pid, const char* display_text, int CServiceMain::client_send_recognition_result(pid_t pid, int result) { MAS_LOGD("[Enter] pid(%d), result(%d)", pid, result); + if (!is_current_assistant(pid)) return -1; + bool ui_panel_enabled = mServicePlugin.is_ui_panel_enabled(); int ret = 0; if (ui_panel_enabled) { @@ -200,18 +224,10 @@ int CServiceMain::client_send_recognition_result(pid_t pid, int result) int CServiceMain::client_start_streaming_audio_data(pid_t pid, int type) { MAS_LOGI("[ENTER"); + int ret = -1; - const char *current_maclient_appid = NULL; - if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { - current_maclient_appid = mClientInfo[mCurrentClientInfo].appid; - pid_t pid_by_appid = mClientManager.find_client_pid_by_appid( - std::string{current_maclient_appid}); - if (pid != pid_by_appid) { - MAS_LOGE("[ERROR] Current client: [%d], active client : [%d %s]", - pid, pid_by_appid, current_maclient_appid); - return ret; - } - } + if (!is_current_assistant(pid)) return ret; + switch(type) { case MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE: ret = mServicePlugin.start_streaming_utterance_data(); @@ -232,6 +248,8 @@ int CServiceMain::client_start_streaming_audio_data(pid_t pid, int type) int CServiceMain::client_stop_streaming_audio_data(pid_t pid, int type) { int ret = -1; + if (!is_current_assistant(pid)) return ret; + switch(type) { case MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE: ret = mServicePlugin.stop_streaming_utterance_data(); @@ -270,6 +288,8 @@ int CServiceMain::client_set_assistant_specific_command(pid_t pid, const char *c int CServiceMain::client_set_background_volume(pid_t pid, double ratio) { + if (!is_current_assistant(pid)) return -1; + std::string pid_appid; boost::optional appid_by_pid = mApplicationManager.get_appid_by_pid(pid); if (appid_by_pid) { -- 2.7.4 From c0e901fe1e4d9963cb9ee1196c6923f836e21f4d Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 19 Aug 2020 15:25:56 +0900 Subject: [PATCH 14/16] Bump version to 0.3.8 Change-Id: I768c61e5d71633032fb2f4e6c222429b39aa1db1 --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index 2f8a2db..758e906 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 80dfbcb..cbd3503 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.3.7 +Version: 0.3.8 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4 From 7221b868f05816b602529d053b145e84a025db44 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 26 Aug 2020 11:27:14 +0900 Subject: [PATCH 15/16] Update selected wakeup info based on wakeup engine name Change-Id: Ib9098fd831797fbd1e6c0509438e090f5593a47f --- plugins/wakeup-manager/src/wakeup_engine_manager.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index 2765498..09803a8 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -160,14 +160,18 @@ bool CWakeupEngineManager::get_audio_data_required() void CWakeupEngineManager::set_selected_wakeup_info(mas_wakeup_event_info wakeup_info) { mSelectedEngine = nullptr; - for (const auto& info : mEngineInfo) { - string appid = string{wakeup_info.wakeup_appid}; - bool found = contains(info.assistant_list, appid); - if (found) { - mSelectedEngine = &info; - MWR_LOGD("Selected : %s", info.engine_name.c_str()); - } + const auto& iter = find_if(mEngineInfo.begin(), mEngineInfo.end(), + [wakeup_info](const EngineInfo& info) { + if (nullptr == wakeup_info.wakeup_engine) + return false; + + return (0 == info.engine_name.compare(wakeup_info.wakeup_engine)); + }); + + if (iter != mEngineInfo.end()) { + mSelectedEngine = &(*iter); + MWR_LOGD("Selected : %s", iter->engine_name.c_str()); } } -- 2.7.4 From 3cf9d456596c4410baa1a67ffca0e410986d6c80 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 27 Aug 2020 18:32:15 +0900 Subject: [PATCH 16/16] Bump version to 0.3.9 Change-Id: I64e064c0ed61e3faa6e71ad3d82604abb2ec69ce --- org.tizen.multi-assistant-service.xml | 2 +- packaging/org.tizen.multi-assistant-service.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.multi-assistant-service.xml b/org.tizen.multi-assistant-service.xml index 758e906..1db9ad8 100644 --- a/org.tizen.multi-assistant-service.xml +++ b/org.tizen.multi-assistant-service.xml @@ -1,5 +1,5 @@ - + Won Nam Jang Sooyeon Kim diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index cbd3503..9e6a485 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -1,6 +1,6 @@ Name: org.tizen.multi-assistant-service Summary: Multi assistant service -Version: 0.3.8 +Version: 0.3.9 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Flora-1.1 -- 2.7.4