diff options
author | JackLivio <jack@livio.io> | 2018-02-12 16:17:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-12 16:17:00 -0500 |
commit | 21112d37d0462573cc311c4ecb73ec272ac2fc73 (patch) | |
tree | 4d1aed127f42444c740a1c414c01177e70340b81 | |
parent | 37614e497366fb2a91f788da72fc9046527fcff2 (diff) | |
parent | 3e0852ef27d0fff950ea4a1dae136c972c40c759 (diff) | |
download | sdl_core-21112d37d0462573cc311c4ecb73ec272ac2fc73.tar.gz |
Merge pull request #1970 from LitvinenkoIra/fix/OnDriverDistruction
Implement new behavior for OnDriverDistraction
13 files changed, 301 insertions, 36 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index eca22afa63..0c93f7447b 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -169,6 +169,11 @@ typedef std::set<mobile_apis::VehicleDataType::eType> VehicleInfoSubscriptions; */ typedef std::set<mobile_apis::ButtonName::eType> ButtonSubscriptions; +/** + * @breif Collection for the mobile command smart object. + */ +typedef std::vector<smart_objects::SmartObjectSPtr> MobileMessageQueue; + class DynamicApplicationData { public: virtual ~DynamicApplicationData() {} @@ -809,6 +814,21 @@ class Application : public virtual InitialApplicationData, */ virtual uint32_t GetAvailableDiskSpace() = 0; + /** + * @brief Allows to save mobile's command smart object in order to perform + * this command later. + * @param mobile_message the message smart_object. + */ + virtual void PushMobileMessage( + smart_objects::SmartObjectSPtr mobile_message) = 0; + + /** + * @brief Allows to obtain the whole list of pending commands in order to + * process them. + * @param mobile_message the messages array which is filled by the method. + */ + virtual void SwapMobileMessageQueue(MobileMessageQueue& mobile_messages) = 0; + #ifdef SDL_REMOTE_CONTROL /** * @brief set_system_context Set system context for application diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index fd6dd13e39..32804d9e93 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -382,6 +382,11 @@ class ApplicationImpl : public virtual Application, AppExtensionPtr QueryInterface(AppExtensionUID uid) OVERRIDE; #endif + void PushMobileMessage( + smart_objects::SmartObjectSPtr mobile_message) OVERRIDE; + + void SwapMobileMessageQueue(MobileMessageQueue& mobile_messages) OVERRIDE; + protected: /** * @brief Clean up application folder. Persistent files will stay @@ -510,6 +515,9 @@ class ApplicationImpl : public virtual Application, std::string folder_name_; ApplicationManager& application_manager_; + sync_primitives::Lock mobile_message_lock_; + MobileMessageQueue mobile_message_queue_; + friend void SwitchApplicationParameters(ApplicationSharedPtr app, const uint32_t app_id, const size_t device_id, diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 22ae032a00..78fe938568 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -495,14 +495,16 @@ class ApplicationManagerImpl * * @return Current state of the distraction state */ - inline bool driver_distraction() const; + hmi_apis::Common_DriverDistractionState::eType driver_distraction_state() + const; /* * @brief Sets state for driver distraction * * @param state New state to be set */ - void set_driver_distraction(const bool is_distracting) OVERRIDE; + void set_driver_distraction_state( + const hmi_apis::Common_DriverDistractionState::eType state) OVERRIDE; /* * DEPRECATED @@ -1463,6 +1465,32 @@ class ApplicationManagerImpl */ bool IsLowVoltage(); + /** + * @brief Allows to process postponed commands for application + * when its HMI level has been changed. + * @param app_id the application id for processing. + * @param from the old HMILevel. + * @param to the new HMILevel for the certain app. + */ + void ProcessPostponedMessages(const uint32_t app_id); + + /** + * @brief Allows to process applications after HMILevel has been changed. + * @param app_id the application id for processing. + * @param from the old HMILevel. + * @param to the new HMILevel for the certain app. + */ + void ProcessApp(const uint32_t app_id, + const mobile_apis::HMILevel::eType from, + const mobile_apis::HMILevel::eType to); + + /** + * @brief Allows to send appropriate message to mobile device. + * @param message The smart object which contains all neccesary info to send + * notification. + */ + void SendMobileMessage(smart_objects::SmartObjectSPtr message); + private: /* * NaviServiceStatusMap shows which navi service (audio/video) is opened @@ -1555,6 +1583,14 @@ class ApplicationManagerImpl protocol_handler::MajorProtocolVersion SupportedSDLVersion() const; /** + * @brief Checks if driver distraction state is valid, creates message + * and puts it to postponed message. + * @param application contains registered application. + */ + void PutDriverDistractionMessageToPostponed( + ApplicationSharedPtr application) const; + + /** * @brief Types of directories used by Application Manager */ enum DirectoryType { TYPE_STORAGE, TYPE_SYSTEM, TYPE_ICONS }; @@ -1668,7 +1704,7 @@ class ApplicationManagerImpl bool audio_pass_thru_active_; sync_primitives::Lock audio_pass_thru_lock_; sync_primitives::Lock tts_global_properties_app_list_lock_; - bool is_distracting_driver_; + hmi_apis::Common_DriverDistractionState::eType driver_distraction_state_; bool is_vr_session_strated_; bool hmi_cooperating_; bool is_all_apps_allowed_; @@ -1794,10 +1830,6 @@ DEPRECATED bool ApplicationManagerImpl::vr_session_started() const { return is_vr_session_strated_; } -bool ApplicationManagerImpl::driver_distraction() const { - return is_distracting_driver_; -} - inline bool ApplicationManagerImpl::all_apps_allowed() const { return is_all_apps_allowed_; } diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 115a52eef3..22a0f2628e 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -1115,4 +1115,16 @@ void ApplicationImpl::RemoveExtensions() { } #endif // SDL_REMOTE_CONTROL +void ApplicationImpl::PushMobileMessage( + smart_objects::SmartObjectSPtr mobile_message) { + sync_primitives::AutoLock lock(mobile_message_lock_); + mobile_message_queue_.push_back(mobile_message); +} + +void ApplicationImpl::SwapMobileMessageQueue( + MobileMessageQueue& mobile_messages) { + sync_primitives::AutoLock lock(mobile_message_lock_); + mobile_messages.swap(mobile_message_queue_); +} + } // namespace application_manager diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 4e13da694b..a2703aca75 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -143,7 +143,8 @@ ApplicationManagerImpl::ApplicationManagerImpl( : settings_(am_settings) , applications_list_lock_(true) , audio_pass_thru_active_(false) - , is_distracting_driver_(false) + , driver_distraction_state_( + hmi_apis::Common_DriverDistractionState::INVALID_ENUM) , is_vr_session_strated_(false) , hmi_cooperating_(false) , is_all_apps_allowed_(true) @@ -621,6 +622,8 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( const std::string& bundle_id = app_info[strings::bundle_id].asString(); application->set_bundle_id(bundle_id); } + PutDriverDistractionMessageToPostponed(application); + // Stops timer of saving data to resumption in order to // doesn't erase data from resumption storage. // Timer will be started after hmi level resumption. @@ -791,8 +794,14 @@ bool ApplicationManagerImpl::EndAudioPassThrough() { } } -void ApplicationManagerImpl::set_driver_distraction(const bool is_distracting) { - is_distracting_driver_ = is_distracting; +hmi_apis::Common_DriverDistractionState::eType +ApplicationManagerImpl::driver_distraction_state() const { + return driver_distraction_state_; +} + +void ApplicationManagerImpl::set_driver_distraction_state( + const hmi_apis::Common_DriverDistractionState::eType state) { + driver_distraction_state_ = state; } DEPRECATED void ApplicationManagerImpl::set_vr_session_started( @@ -1850,7 +1859,6 @@ bool ApplicationManagerImpl::ManageMobileCommand( const commands::MessageSharedPtr message, commands::Command::CommandOrigin origin) { LOG4CXX_AUTO_TRACE(logger_); - if (!message) { LOG4CXX_WARN(logger_, "Null-pointer message received."); return false; @@ -3608,6 +3616,41 @@ void ApplicationManagerImpl::OnHMILevelChanged( mobile_apis::HMILevel::eType from, mobile_apis::HMILevel::eType to) { LOG4CXX_AUTO_TRACE(logger_); + ProcessPostponedMessages(app_id); + ProcessApp(app_id, from, to); +} + +void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) { + LOG4CXX_AUTO_TRACE(logger_); + + ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_WARN(logger_, "The app with id: " << app_id << " does not exist"); + return; + } + MobileMessageQueue messages; + app->SwapMobileMessageQueue(messages); + auto push_allowed_messages = + [this, &app](smart_objects::SmartObjectSPtr message) { + const std::string function_id = MessageHelper::StringifiedFunctionID( + static_cast<mobile_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asUInt())); + const RPCParams params; + const mobile_apis::Result::eType check_result = + CheckPolicyPermissions(app, function_id, params); + if (mobile_api::Result::SUCCESS == check_result) { + ManageMobileCommand(message, + commands::Command::CommandOrigin::ORIGIN_SDL); + } else { + app->PushMobileMessage(message); + } + }; + std::for_each(messages.begin(), messages.end(), push_allowed_messages); +} + +void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, + const mobile_apis::HMILevel::eType from, + const mobile_apis::HMILevel::eType to) { using namespace mobile_apis::HMILevel; using namespace helpers; @@ -4145,6 +4188,28 @@ void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) { #endif // SDL_REMOTE_CONTROL } +void ApplicationManagerImpl::PutDriverDistractionMessageToPostponed( + ApplicationSharedPtr application) const { + LOG4CXX_AUTO_TRACE(logger_); + if (hmi_apis::Common_DriverDistractionState::INVALID_ENUM == + driver_distraction_state()) { + LOG4CXX_WARN(logger_, "DriverDistractionState is INVALID_ENUM"); + return; + } + smart_objects::SmartObjectSPtr on_driver_distraction = + utils::MakeShared<smart_objects::SmartObject>(); + + (*on_driver_distraction)[strings::params][strings::message_type] = + static_cast<int32_t>(application_manager::MessageType::kNotification); + (*on_driver_distraction)[strings::params][strings::function_id] = + mobile_api::FunctionID::OnDriverDistractionID; + (*on_driver_distraction)[strings::msg_params][mobile_notification::state] = + driver_distraction_state(); + (*on_driver_distraction)[strings::params][strings::connection_key] = + application->app_id(); + application->PushMobileMessage(on_driver_distraction); +} + protocol_handler::MajorProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc index 4c322c456f..a895d353ce 100644 --- a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc @@ -34,8 +34,10 @@ #include "application_manager/commands/hmi/on_driver_distraction_notification.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" +#include "utils/make_shared.h" namespace application_manager { @@ -43,6 +45,53 @@ namespace commands { namespace hmi { +namespace { +struct OnDriverDistractionProcessor { + OnDriverDistractionProcessor( + OnDriverDistractionNotification& command, + smart_objects::SmartObjectSPtr on_driver_distraction_so, + ApplicationManager& application_manager) + : command_(command) + , on_driver_distraction_so_(on_driver_distraction_so) + , application_manager_(application_manager) + , stringified_function_id_(MessageHelper::StringifiedFunctionID( + mobile_api::FunctionID::OnDriverDistractionID)) {} + + void operator()(ApplicationSharedPtr application) { + if (application) { + (*on_driver_distraction_so_)[strings::params][strings::connection_key] = + application->app_id(); + const RPCParams params; + policy::CheckPermissionResult result; + application_manager_.GetPolicyHandler().CheckPermissions( + application, stringified_function_id_, params, result); + if (result.hmi_level_permitted != policy::kRpcAllowed) { + MobileMessageQueue messages; + application->SwapMobileMessageQueue(messages); + messages.erase( + std::remove_if( + messages.begin(), + messages.end(), + [this](smart_objects::SmartObjectSPtr message) { + return (*message)[strings::params][strings::function_id] + .asString() == stringified_function_id_; + }), + messages.end()); + application->PushMobileMessage(on_driver_distraction_so_); + return; + } + command_.SendNotificationToMobile(on_driver_distraction_so_); + } + } + + private: + OnDriverDistractionNotification& command_; + smart_objects::SmartObjectSPtr on_driver_distraction_so_; + ApplicationManager& application_manager_; + std::string stringified_function_id_; +}; +} + OnDriverDistractionNotification::OnDriverDistractionNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) : NotificationFromHMI(message, application_manager) {} @@ -51,38 +100,31 @@ OnDriverDistractionNotification::~OnDriverDistractionNotification() {} void OnDriverDistractionNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - const hmi_apis::Common_DriverDistractionState::eType state = static_cast<hmi_apis::Common_DriverDistractionState::eType>( (*message_)[strings::msg_params][hmi_notification::state].asInt()); - application_manager_.set_driver_distraction(state); + application_manager_.set_driver_distraction_state(state); smart_objects::SmartObjectSPtr on_driver_distraction = - new smart_objects::SmartObject(); + utils::MakeShared<smart_objects::SmartObject>(); if (!on_driver_distraction) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; } - (*on_driver_distraction)[strings::params][strings::function_id] = mobile_api::FunctionID::OnDriverDistractionID; - + (*on_driver_distraction)[strings::params][strings::message_type] = + static_cast<int32_t>(application_manager::MessageType::kNotification); (*on_driver_distraction)[strings::msg_params][mobile_notification::state] = state; const ApplicationSet applications = application_manager_.applications().GetData(); - ApplicationSetConstIt it = applications.begin(); - for (; applications.end() != it; ++it) { - const ApplicationSharedPtr app = *it; - if (app) { - (*on_driver_distraction)[strings::params][strings::connection_key] = - app->app_id(); - SendNotificationToMobile(on_driver_distraction); - } - } + OnDriverDistractionProcessor processor( + *this, on_driver_distraction, application_manager_); + std::for_each(applications.begin(), applications.end(), processor); } } // namespace hmi diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index e02191e4da..6b7f78b8f7 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -804,6 +804,29 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) { EXPECT_FALSE(app_impl->audio_streaming_approved()); } +TEST_F(ApplicationImplTest, PushPopMobileMessage) { + smart_objects::SmartObjectSPtr on_driver_distraction = + utils::MakeShared<smart_objects::SmartObject>(); + const hmi_apis::Common_DriverDistractionState::eType state = + hmi_apis::Common_DriverDistractionState::DD_ON; + (*on_driver_distraction)[strings::params][strings::function_id] = + mobile_api::FunctionID::OnDriverDistractionID; + + (*on_driver_distraction)[strings::msg_params][mobile_notification::state] = + state; + + app_impl->PushMobileMessage(on_driver_distraction); + app_impl->PushMobileMessage(on_driver_distraction); + + MobileMessageQueue messages; + app_impl->SwapMobileMessageQueue(messages); + + EXPECT_EQ(2u, messages.size()); + + app_impl->SwapMobileMessageQueue(messages); + EXPECT_TRUE(messages.empty()); +} + } // namespace application_manager_test } // namespace components } // namespace test diff --git a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc index 5a40a4e582..ffedf1b4f6 100644 --- a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc +++ b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc @@ -182,6 +182,11 @@ ACTION_P(GetEventId, event_id) { ACTION_P(GetArg, arg) { *arg = arg0; } + +ACTION_P(GetArg3, result) { + arg3 = *result; +} + ACTION_P2(GetConnectIdPermissionConsent, connect_id, consent) { *connect_id = arg0; std::vector<policy::FunctionalGroupPermission>::const_iterator it = @@ -1910,7 +1915,7 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) { utils::SharedPtr<Command> command = CreateCommand<hmi::OnDriverDistractionNotification>(message); - EXPECT_CALL(app_mngr_, set_driver_distraction(state)); + EXPECT_CALL(app_mngr_, set_driver_distraction_state(state)); EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0); @@ -1945,12 +1950,18 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) { CreateCommand<hmi::OnDriverDistractionNotification>(message); application_set_.insert(app_); - EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_)); + policy::CheckPermissionResult result; + result.hmi_level_permitted = policy::kRpcAllowed; + EXPECT_CALL(app_mngr_, GetPolicyHandler()) + .WillOnce(ReturnRef(policy_interface_)); + EXPECT_CALL(policy_interface_, CheckPermissions(_, _, _, _)) + .WillOnce(GetArg3(&result)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, Command::CommandOrigin::ORIGIN_SDL)) .WillOnce(GetMessage(message)); EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_)); + command->Run(); EXPECT_EQ( static_cast<int32_t>(am::mobile_api::FunctionID::OnDriverDistractionID), diff --git a/src/components/application_manager/test/commands/hmi/on_driver_distraction_notification_test.cc b/src/components/application_manager/test/commands/hmi/on_driver_distraction_notification_test.cc index 94dd1c6599..b8a8c68ece 100644 --- a/src/components/application_manager/test/commands/hmi/on_driver_distraction_notification_test.cc +++ b/src/components/application_manager/test/commands/hmi/on_driver_distraction_notification_test.cc @@ -43,6 +43,7 @@ #include "commands/commands_test.h" #include "application_manager/mock_application.h" #include "application_manager/mock_application_manager.h" +#include "application_manager/policies/mock_policy_handler_interface.h" #include "hmi/on_driver_distraction_notification.h" #include "interfaces/MOBILE_API.h" @@ -68,6 +69,7 @@ class HMIOnDriverDistractionNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: ::sync_primitives::Lock app_set_lock_; + policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_; }; MATCHER_P2(CheckNotificationParams, function_id, state, "") { @@ -83,16 +85,52 @@ MATCHER_P2(CheckNotificationParams, function_id, state, "") { return is_function_id_matched && is_state_matched; } +ACTION_P(GetArg3, result) { + arg3 = *result; +} + +TEST_F(HMIOnDriverDistractionNotificationTest, Run_PushMobileMessage_SUCCESS) { + const hmi_apis::Common_DriverDistractionState::eType state = + hmi_apis::Common_DriverDistractionState::DD_ON; + MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map)); + (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state; + + NotificationPtr command( + CreateCommand<OnDriverDistractionNotification>(commands_msg)); + + EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state))); + + MockAppPtr mock_app = CreateMockApp(); + am::ApplicationSet app_set; + app_set.insert(mock_app); + + DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_); + EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); + policy::CheckPermissionResult result; + result.hmi_level_permitted = policy::kRpcDisallowed; + EXPECT_CALL(app_mngr_, GetPolicyHandler()) + .WillOnce(ReturnRef(mock_policy_handler_interface_)); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) + .WillOnce(GetArg3(&result)); + + EXPECT_CALL(*mock_app, + PushMobileMessage(CheckNotificationParams( + am::mobile_api::FunctionID::OnDriverDistractionID, state))); + + command->Run(); +} + TEST_F(HMIOnDriverDistractionNotificationTest, Run_SendNotificationToMobile_SUCCESS) { - MessageSharedPtr msg = CreateMessage(); const hmi_apis::Common_DriverDistractionState::eType state = hmi_apis::Common_DriverDistractionState::DD_ON; - (*msg)[am::strings::msg_params][am::hmi_notification::state] = state; + MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map)); + (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state; - NotificationPtr command(CreateCommand<OnDriverDistractionNotification>(msg)); + NotificationPtr command( + CreateCommand<OnDriverDistractionNotification>(commands_msg)); - EXPECT_CALL(app_mngr_, set_driver_distraction(state)); + EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state))); MockAppPtr mock_app = CreateMockApp(); am::ApplicationSet app_set; @@ -101,9 +139,12 @@ TEST_F(HMIOnDriverDistractionNotificationTest, DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_); EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); - const uint32_t app_id = 1u; - EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(app_id)); - + policy::CheckPermissionResult result; + result.hmi_level_permitted = policy::kRpcAllowed; + EXPECT_CALL(app_mngr_, GetPolicyHandler()) + .WillOnce(ReturnRef(mock_policy_handler_interface_)); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) + .WillOnce(GetArg3(&result)); EXPECT_CALL(app_mngr_, ManageMobileCommand( CheckNotificationParams( diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h index 10cf5f746e..5bf2f2368e 100644 --- a/src/components/application_manager/test/include/application_manager/mock_application.h +++ b/src/components/application_manager/test/include/application_manager/mock_application.h @@ -292,6 +292,10 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(IsRegistered, bool()); MOCK_CONST_METHOD0(SchemaUrl, std::string()); MOCK_CONST_METHOD0(PackageName, std::string()); + MOCK_METHOD1(PushMobileMessage, void(smart_objects::SmartObjectSPtr message)); + MOCK_METHOD1( + SwapMobileMessageQueue, + void(::application_manager::MobileMessageQueue& mobile_messages)); #ifdef SDL_REMOTE_CONTROL MOCK_METHOD1( diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 96803e69a8..eb9159f0b3 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -465,7 +465,8 @@ class ApplicationManager { * * @param state New state to be set */ - virtual void set_driver_distraction(bool is_distracting) = 0; + virtual void set_driver_distraction_state( + const hmi_apis::Common_DriverDistractionState::eType state) = 0; /* * @brief Starts audio pass thru thread diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 4f2d964488..58edcb637a 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -189,7 +189,9 @@ class MockApplicationManager : public application_manager::ApplicationManager { const std::string& file_name, const int64_t offset)); MOCK_METHOD1(SetAllAppsAllowed, void(const bool allowed)); - MOCK_METHOD1(set_driver_distraction, void(bool is_distracting)); + MOCK_METHOD1( + set_driver_distraction_state, + void(const hmi_apis::Common_DriverDistractionState::eType state)); MOCK_METHOD6(StartAudioPassThruThread, void(int32_t session_key, int32_t correlation_id, diff --git a/src/components/remote_control/test/include/mock_application.h b/src/components/remote_control/test/include/mock_application.h index e50a869be7..a46b48673d 100644 --- a/src/components/remote_control/test/include/mock_application.h +++ b/src/components/remote_control/test/include/mock_application.h @@ -302,6 +302,10 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(IsRegistered, bool()); MOCK_CONST_METHOD0(SchemaUrl, std::string()); MOCK_CONST_METHOD0(PackageName, std::string()); + MOCK_METHOD1(PushMobileMessage, void(smart_objects::SmartObjectSPtr message)); + MOCK_METHOD1( + SwapMobileMessageQueue, + void(::application_manager::MobileMessageQueue& mobile_messages)); #ifdef SDL_REMOTE_CONTROL MOCK_METHOD1( |