diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc index ab6e1cc143d..268eb7bba3f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc @@ -197,8 +197,21 @@ bool ResetGlobalPropertiesRequest::ResetHelpPromt( SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } + const std::vector& help_prompt = + application_manager_.get_settings().help_prompt(); + smart_objects::SmartObject so_help_prompt = smart_objects::SmartObject(smart_objects::SmartType_Array); + + for (size_t i = 0; i < help_prompt.size(); ++i) { + smart_objects::SmartObject help_prompt_item = + smart_objects::SmartObject(smart_objects::SmartType_Map); + help_prompt_item[strings::text] = help_prompt[i]; + help_prompt_item[strings::type] = + hmi_apis::Common_SpeechCapabilities::SC_TEXT; + so_help_prompt[i] = help_prompt_item; + } + app->set_help_prompt(so_help_prompt); return true; } @@ -217,7 +230,7 @@ bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( smart_objects::SmartObject so_time_out_promt = smart_objects::SmartObject(smart_objects::SmartType_Array); - for (uint32_t i = 0; i < time_out_promt.size(); ++i) { + for (size_t i = 0; i < time_out_promt.size(); ++i) { smart_objects::SmartObject timeoutPrompt = smart_objects::SmartObject(smart_objects::SmartType_Map); timeoutPrompt[strings::text] = time_out_promt[i]; @@ -237,8 +250,16 @@ bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems( SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } + + const std::string& vr_help_title = + application_manager_.get_settings().vr_help_title(); + smart_objects::SmartObject so_vr_help_title = + smart_objects::SmartObject(smart_objects::SmartType_String); + so_vr_help_title[strings::vr_help_title] = vr_help_title; + app->reset_vr_help_title(); app->reset_vr_help(); + app->set_vr_help_title(so_vr_help_title); return true; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc index 4cdf4f8858a..f110fbc4b22 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc @@ -140,8 +140,21 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) { mobile_apis::GlobalProperty::KEYBOARDPROPERTIES; EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); + std::vector help_prompt = {"help_prompt"}; + + EXPECT_CALL(app_mngr_settings_, help_prompt()) + .WillOnce(ReturnRef(help_prompt)); + + smart_objects::SmartObject help_prompt_ = + smart_objects::SmartObject(smart_objects::SmartType_Map); + help_prompt_[am::strings::text] = help_prompt[0]; + help_prompt_[am::strings::type] = + hmi_apis::Common_SpeechCapabilities::SC_TEXT; + smart_objects::SmartObject so_prompt = smart_objects::SmartObject(smart_objects::SmartType_Array); + so_prompt[0] = help_prompt_; + EXPECT_CALL(*mock_app_, set_help_prompt(so_prompt)); std::vector time_out_prompt; @@ -162,6 +175,15 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) { EXPECT_CALL(*mock_app_, set_timeout_prompt(so_time_out_prompt)); + std::string vr_help_title("vr_help_title"); + EXPECT_CALL(app_mngr_settings_, vr_help_title()) + .WillOnce(ReturnRef(vr_help_title)); + + smart_objects::SmartObject so_vr_help_title = + smart_objects::SmartObject(smart_objects::SmartType_String); + so_vr_help_title[am::strings::vr_help_title] = vr_help_title; + EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title)); + EXPECT_CALL(*mock_app_, reset_vr_help_title()); EXPECT_CALL(*mock_app_, reset_vr_help()); @@ -191,8 +213,21 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) { mobile_apis::GlobalProperty::KEYBOARDPROPERTIES; EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); + + std::vector help_prompt = {"help_prompt"}; + + EXPECT_CALL(app_mngr_settings_, help_prompt()) + .WillOnce(ReturnRef(help_prompt)); + + smart_objects::SmartObject help_prompt_ = + smart_objects::SmartObject(smart_objects::SmartType_Map); + help_prompt_[am::strings::text] = help_prompt[0]; + help_prompt_[am::strings::type] = + hmi_apis::Common_SpeechCapabilities::SC_TEXT; + smart_objects::SmartObject so_prompt = smart_objects::SmartObject(smart_objects::SmartType_Array); + so_prompt[0] = help_prompt_; EXPECT_CALL(*mock_app_, set_help_prompt(so_prompt)); std::vector time_out_prompt; @@ -213,6 +248,15 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) { EXPECT_CALL(*mock_app_, set_timeout_prompt(so_time_out_prompt)); + std::string vr_help_title("vr_help_title"); + EXPECT_CALL(app_mngr_settings_, vr_help_title()) + .WillOnce(ReturnRef(vr_help_title)); + + smart_objects::SmartObject so_vr_help_title = + smart_objects::SmartObject(smart_objects::SmartType_String); + so_vr_help_title[am::strings::vr_help_title] = vr_help_title; + EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title)); + EXPECT_CALL(*mock_app_, reset_vr_help_title()); EXPECT_CALL(*mock_app_, reset_vr_help()); @@ -266,6 +310,15 @@ TEST_F(ResetGlobalPropertiesRequestTest, (*msg_)[am::strings::msg_params][am::strings::properties][0] = mobile_apis::GlobalProperty::VRHELPTITLE; + std::string vr_help_title("vr_help_title"); + EXPECT_CALL(app_mngr_settings_, vr_help_title()) + .WillOnce(ReturnRef(vr_help_title)); + + smart_objects::SmartObject so_vr_help_title = + smart_objects::SmartObject(smart_objects::SmartType_String); + so_vr_help_title[am::strings::vr_help_title] = vr_help_title; + EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title)); + EXPECT_CALL(*mock_app_, reset_vr_help_title()); EXPECT_CALL(*mock_app_, reset_vr_help()); EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); @@ -359,6 +412,15 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { (*msg_)[am::strings::msg_params][am::strings::properties][0] = mobile_apis::GlobalProperty::VRHELPTITLE; + std::string vr_help_title("vr_help_title"); + EXPECT_CALL(app_mngr_settings_, vr_help_title()) + .WillOnce(ReturnRef(vr_help_title)); + + smart_objects::SmartObject so_vr_help_title = + smart_objects::SmartObject(smart_objects::SmartType_String); + so_vr_help_title[am::strings::vr_help_title] = vr_help_title; + EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title)); + EXPECT_CALL(*mock_app_, reset_vr_help_title()); EXPECT_CALL(*mock_app_, reset_vr_help()); diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 81491b7bf9b..2d03ca98382 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1203,9 +1203,20 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp( return NULL; } smart_objects::SmartObject& vr_help = *result; - vr_help[strings::vr_help_title] = app->name(); + const smart_objects::SmartObject* vr_help_title = app->vr_help_title(); + if (vr_help_title && + vr_help_title->keyExists(strings::vr_help_title)) { + vr_help[strings::vr_help_title] = + (*vr_help_title)[strings::vr_help_title].asString(); + } int32_t index = 0; + + smart_objects::SmartObject so_vr_help(smart_objects::SmartType_Map); + so_vr_help[strings::position] = index + 1; + so_vr_help[strings::text] = app->name(); + vr_help[strings::vr_help][index++] = so_vr_help; + if (app->vr_synonyms()) { smart_objects::SmartObject item(smart_objects::SmartType_Map); item[strings::text] = (*(app->vr_synonyms())).getElement(0); diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h index 8f9d7496c8a..0c7f0b6123f 100644 --- a/src/components/include/application_manager/application_manager_settings.h +++ b/src/components/include/application_manager/application_manager_settings.h @@ -70,7 +70,9 @@ class ApplicationManagerSettings : public RequestControlerSettings, virtual const std::string& tts_delimiter() const = 0; virtual const uint32_t& put_file_in_none() const = 0; virtual const std::string& sdl_version() const = 0; + virtual const std::string& vr_help_title() const = 0; virtual const std::vector& time_out_promt() const = 0; + virtual const std::vector& help_prompt() const = 0; virtual const std::string& hmi_capabilities_file_name() const = 0; virtual const std::string& video_server_type() const = 0; virtual const std::string& audio_server_type() const = 0; diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h index 735539156af..85c216906ce 100644 --- a/src/components/include/test/application_manager/mock_application_manager_settings.h +++ b/src/components/include/test/application_manager/mock_application_manager_settings.h @@ -76,6 +76,8 @@ class MockApplicationManagerSettings MOCK_CONST_METHOD0(tts_delimiter, const std::string&()); MOCK_CONST_METHOD0(put_file_in_none, const uint32_t&()); MOCK_CONST_METHOD0(sdl_version, const std::string&()); + MOCK_CONST_METHOD0(vr_help_title, const std::string&()); + MOCK_CONST_METHOD0(help_prompt, const std::vector&()); MOCK_CONST_METHOD0(time_out_promt, const std::vector&()); MOCK_CONST_METHOD0(hmi_capabilities_file_name, const std::string&()); MOCK_CONST_METHOD0(video_server_type, const std::string&());