diff options
author | Alexander <akutsan@luxoft.com> | 2018-06-16 20:44:20 +0300 |
---|---|---|
committer | Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2018-06-26 12:01:48 +0300 |
commit | fb5f5edd793ebe353c91df91950f76816b5f200c (patch) | |
tree | 019ec1e7db4e983a613e07ba308d6d3870195367 /src/components | |
parent | f86f1829ed1fc41d6bf1fc9a5203d637b80255cb (diff) | |
download | sdl_core-fb5f5edd793ebe353c91df91950f76816b5f200c.tar.gz |
Move using functions for clear subscriptions to plugin
Diffstat (limited to 'src/components')
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 a18073cba3..06678416c1 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 42a235a991..972ca812d0 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 e8a969718d..c56e065f47 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 @@ -292,10 +292,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 57a35e5283..5bd5a3f245 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -543,11 +543,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 |