From a1ef19dcc795cb3c969cee6399226f90080701bd Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 10 May 2022 14:59:05 +0900 Subject: [PATCH] Update default assistant appid on wakeup event Change-Id: I04e3059320e4a9f8e6d4c8902219297d47239a97 --- plugins/wakeup-manager/inc/wakeup_settings.h | 2 ++ plugins/wakeup-manager/src/wakeup_manager.cpp | 7 ++++++- plugins/wakeup-manager/src/wakeup_settings.cpp | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/wakeup-manager/inc/wakeup_settings.h b/plugins/wakeup-manager/inc/wakeup_settings.h index d69d71a..64b8b25 100644 --- a/plugins/wakeup-manager/inc/wakeup_settings.h +++ b/plugins/wakeup-manager/inc/wakeup_settings.h @@ -66,6 +66,8 @@ public: const vector& get_observers(); string get_default_assistant_appid(); + void set_default_assistant_appid(std::string appid); + bool get_ui_panel_enabled(); float get_conversation_timeout(); bool get_multiple_mode(); diff --git a/plugins/wakeup-manager/src/wakeup_manager.cpp b/plugins/wakeup-manager/src/wakeup_manager.cpp index fdc1c4e..90580cc 100644 --- a/plugins/wakeup-manager/src/wakeup_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager.cpp @@ -1073,7 +1073,12 @@ void CWakeupManager::CPolicyEventObserver::on_wakeup(mas_wakeup_event_info wakeu CAudioManager *audio_manager = mWakeupManager->get_audio_manager(); CWakeupEngineManager *engine_manager = mWakeupManager->get_engine_manager(); - if (nullptr == audio_manager || nullptr == engine_manager) return; + CWakeupSettings* settings = mWakeupManager->get_wakeup_settings(); + if (nullptr == audio_manager || nullptr == engine_manager || nullptr == settings) return; + + if (wakeup_info.wakeup_appid && strlen(wakeup_info.wakeup_appid) > 0) { + settings->set_default_assistant_appid(wakeup_info.wakeup_appid); + } mWakeupManager->stop_streaming_utterance_data(); mWakeupManager->stop_streaming_previous_utterance_data(); diff --git a/plugins/wakeup-manager/src/wakeup_settings.cpp b/plugins/wakeup-manager/src/wakeup_settings.cpp index c7c1142..4022002 100644 --- a/plugins/wakeup-manager/src/wakeup_settings.cpp +++ b/plugins/wakeup-manager/src/wakeup_settings.cpp @@ -274,6 +274,13 @@ string CWakeupSettings::get_default_assistant_appid() return mDefaultAssistantAppid; } +void CWakeupSettings::set_default_assistant_appid(std::string appid) +{ + int ret = vconf_set_str(WAKEUP_SETTINGS_KEY_DEFAULT_ASSISTANT_APPID, appid.c_str()); + MWR_LOGD("default_assistant_appid : %s, %d", appid.c_str(), ret); + mDefaultAssistantAppid = appid; +} + bool CWakeupSettings::get_ui_panel_enabled() { return mUiPanelEnabled; -- 2.7.4