diff options
author | Alexander <akutsan@luxoft.com> | 2018-06-16 20:44:20 +0300 |
---|---|---|
committer | Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2018-06-27 18:20:30 +0300 |
commit | 240fd5b8e9eeba18e80092de750f77de061a9d55 (patch) | |
tree | 2372c9b7279b4459b08e3ed4ffc3db0cfd1a53c3 | |
parent | d342fb87821c37ef724cc55aa9d24bb4added530 (diff) | |
download | sdl_core-240fd5b8e9eeba18e80092de750f77de061a9d55.tar.gz |
Move using functions for clear subscriptions to plugin
6 files changed, 5 insertions, 73 deletions
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index dfc1e2a240..c91bd43e72 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -803,17 +803,6 @@ class MessageHelper { ApplicationManager& app_mngr); /** - * @brief SendUnsubscribeIVIRequest sends request to HMI to remove vehicle - * data subscription for application - * @param ivi_id Vehicle data item id - * @param application Application to unsubscribe - * @param app_mngr Application manager - */ - static void SendUnsubscribeIVIRequest(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr); - - /** * @brief Sends HMI status notification to mobile * @param application_impl application with changed HMI status **/ diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc index 16b49faa2a..bfe6b15930 100644 --- a/src/components/application_manager/src/helpers/application_helper.cc +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -87,20 +87,6 @@ void DeleteButtonSubscriptions(ApplicationSharedPtr app, } } -void DeleteVISubscriptions(ApplicationSharedPtr app, - ApplicationManager& app_manager) { - VehicleInfoSubscriptions ivi = app->SubscribedIVI().GetData(); - - for (auto i : ivi) { - app->UnsubscribeFromIVI(i); - SubscribedToIVIPredicate p(i); - auto app = FindApp(app_manager.applications(), p); - if (!app) { - MessageHelper::SendUnsubscribeIVIRequest(i, app, app_manager); - } - } -} - void CleanupAppFiles(ApplicationSharedPtr app) { const auto icon_file = app->app_icon_path(); @@ -139,8 +125,12 @@ void DeleteApplicationData(ApplicationSharedPtr app, DeleteChoiceSets(app, app_manager); DeleteGlobalProperties(app, app_manager); DeleteButtonSubscriptions(app, app_manager); - DeleteVISubscriptions(app, app_manager); CleanupAppFiles(app); + app_manager.GetPluginManager().ForEachPlugin( + [&app](plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent( + plugin_manager::ApplicationEvent::kDeleteApplicationData, app); + }); } } // namespace application_manager 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 33ddcdb733..f2c47ea12d 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -637,40 +637,6 @@ void MessageHelper::SendUnsubscribeButtonNotification( app_mngr.GetRPCService().ManageHMICommand(message); } -void MessageHelper::SendUnsubscribeIVIRequest(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr) { - using namespace smart_objects; - - std::string key_name; - for (auto item : vehicle_data_) { - if (ivi_id == item.second) { - key_name = item.first; - break; - } - } - - if (key_name.empty()) { - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[key_name] = true; - - SmartObjectSPtr message = CreateMessageForHMI( - hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); - DCHECK(message); - - SmartObject& object = *message; - object[strings::params][strings::function_id] = - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData; - - object[strings::msg_params] = msg_params; - - app_mngr.GetRPCService().ManageHMICommand(message); -} - const VehicleData& MessageHelper::vehicle_data() { return vehicle_data_; } diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc index 620aad0f0b..b27ed57872 100644 --- a/src/components/application_manager/test/application_helper_test.cc +++ b/src/components/application_manager/test/application_helper_test.cc @@ -245,8 +245,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) { EXPECT_CALL(*mock_message_helper_, SendUnsubscribeButtonNotification(_, _, _)); - EXPECT_CALL(*mock_message_helper_, SendUnsubscribeIVIRequest(_, _, _)); - // Act application_manager::DeleteApplicationData(app_impl_, app_manager_impl_); } diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index 93b67016b3..e8b0473c50 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -295,10 +295,6 @@ class MockMessageHelper { void(mobile_apis::ButtonName::eType button, ApplicationSharedPtr application, ApplicationManager& app_mngr)); - MOCK_METHOD3(SendUnsubscribeIVIRequest, - void(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr)); static MockMessageHelper* message_helper_mock(); }; diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 998023e0c7..23dea01c8c 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -549,11 +549,4 @@ void MessageHelper::SendUnsubscribeButtonNotification( ->SendUnsubscribeButtonNotification(button, application, app_mngr); } -void MessageHelper::SendUnsubscribeIVIRequest(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr) { - return MockMessageHelper::message_helper_mock()->SendUnsubscribeIVIRequest( - ivi_id, application, app_mngr); -} - } // namespace application_manager |