diff options
10 files changed, 186 insertions, 87 deletions
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 27b6c8123e..185d700d58 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -601,6 +601,7 @@ class ApplicationImpl : public virtual Application, std::atomic_bool is_resuming_; mobile_api::HMILevel::eType deferred_resumption_hmi_level_; bool is_hash_changed_during_suspend_; + smart_objects::SmartObject user_location_; uint32_t video_stream_retry_number_; uint32_t audio_stream_retry_number_; @@ -617,7 +618,6 @@ class ApplicationImpl : public virtual Application, std::string cloud_transport_type_; mobile_apis::HybridAppPreference::eType hybrid_app_preference_; std::string certificate_; - smart_objects::SmartObject user_location_; /** * @brief Defines number per time in seconds limits 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 c0d12c526f..25e28515d4 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 @@ -181,13 +181,15 @@ class ApplicationManagerImpl uint32_t hmi_app_id) const OVERRIDE; ApplicationSharedPtr application_by_policy_id( const std::string& policy_app_id) const OVERRIDE; - ApplicationSharedPtr application_by_name( - const std::string& app_name) const OVERRIDE; + DEPRECATED ApplicationSharedPtr + application_by_name(const std::string& app_name) const OVERRIDE; ApplicationSharedPtr pending_application_by_policy_id( const std::string& policy_app_id) const OVERRIDE; ApplicationSharedPtr reregister_application_by_policy_id( const std::string& policy_app_id) const OVERRIDE; + std::vector<ApplicationSharedPtr> applications_by_name( + const std::string& app_name) const OVERRIDE; std::vector<ApplicationSharedPtr> applications_by_button( uint32_t button) OVERRIDE; std::vector<ApplicationSharedPtr> applications_with_navi() OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index c55dcb65fc..d59964bbc7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -134,30 +134,39 @@ class RegisterAppInterfaceRequest app_mngr::ApplicationConstSharedPtr app, bool resumption = false, bool need_restore_vr = false); - /* + + /** * @brief Check new ID along with known mobile application ID * * return TRUE if ID is known already, otherwise - FALSE */ bool IsApplicationWithSameAppIdRegistered(); - /* + /** * @brief Check new application parameters (name, tts, vr) for * coincidence with already known parameters of registered applications - * @param out_duplicate_apps In the case other apps was found with duplicate - * names, this field will be filled with a list of said apps * - * return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms, + * @return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms, * otherwise appropriate error code returns */ - mobile_apis::Result::eType CheckCoincidence( + mobile_apis::Result::eType CheckCoincidence(); + + /** + * @brief Search for any apps with the same appName as the one being + * registered + * @param out_duplicate_apps To be filled with a list of all of the apps which + * have duplicate appNames to the app being registered (registered or pending) + * + * @return TRUE if at least one duplicate app was found, otherwise FALSE + */ + bool GetDuplicateNames( std::vector<app_mngr::ApplicationSharedPtr>& out_duplicate_apps); - /* + /** * @brief Predicate for using with CheckCoincidence method to compare with VR * synonym SO * - * return TRUE if there is coincidence of VR, otherwise FALSE + * @return TRUE if there is coincidence of VR, otherwise FALSE */ struct CoincidencePredicateVR { CoincidencePredicateVR(const custom_str::CustomString& newItem) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index b9ac00aef4..c2f4418b66 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -297,53 +297,73 @@ void RegisterAppInterfaceRequest::Run() { return; } + mobile_apis::Result::eType coincidence_result = CheckCoincidence(); + + if (mobile_apis::Result::SUCCESS != coincidence_result) { + LOG4CXX_ERROR(logger_, "Coincidence check failed."); + SendResponse(false, coincidence_result); + return; + } + std::vector<ApplicationSharedPtr> duplicate_apps; - mobile_apis::Result::eType coincidence_result = - CheckCoincidence(duplicate_apps); - - if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result && - duplicate_apps.size() == 1) { - ApplicationSharedPtr duplicate_app = duplicate_apps.front(); - bool error_response = true; - if (duplicate_app->is_cloud_app()) { - if (duplicate_app->hybrid_app_preference() == - mobile_apis::HybridAppPreference::MOBILE) { - // Unregister cloud application and allow mobile application to register - // in it's place - application_manager_.UnregisterApplication( - duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED); - error_response = false; - } + if (GetDuplicateNames(duplicate_apps)) { + LOG4CXX_ERROR(logger_, + "Found duplicate app names, checking for hybrid apps."); + // Default preference to BOTH + mobile_apis::HybridAppPreference::eType preference = + mobile_apis::HybridAppPreference::BOTH; + ApplicationSharedPtr app = + application_manager_.pending_application_by_policy_id(policy_app_id); + bool is_cloud_app = app.use_count() != 0 && app->is_cloud_app(); + if (is_cloud_app) { + // Retrieve hybrid app preference from registering app + preference = app->hybrid_app_preference(); } else { - ApplicationSharedPtr cloud_app = - application_manager_.pending_application_by_policy_id(policy_app_id); - // If the duplicate name was not because of a mobile/cloud app pair, go - // through the normal process for handling duplicate names - if (cloud_app.use_count() == 0 || !cloud_app->is_cloud_app()) { - usage_statistics::AppCounter count_of_rejections_duplicate_name( - GetPolicyHandler().GetStatisticManager(), - policy_app_id, - usage_statistics::REJECTIONS_DUPLICATE_NAME); - ++count_of_rejections_duplicate_name; - } else if (cloud_app->hybrid_app_preference() == - mobile_apis::HybridAppPreference::CLOUD) { - // Unregister mobile application and allow cloud application to - // register in it's place - application_manager_.UnregisterApplication( - duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED); - error_response = false; + // Search for the hybrid app preference in the duplicate app list + for (auto duplicate_app : duplicate_apps) { + if (duplicate_app->is_cloud_app()) { + preference = duplicate_app->hybrid_app_preference(); + break; + } } } - if (error_response) { - LOG4CXX_ERROR(logger_, "Coincidence check failed."); - SendResponse(false, coincidence_result); - return; + if (preference == mobile_apis::HybridAppPreference::MOBILE || + preference == mobile_apis::HybridAppPreference::CLOUD) { + bool cloud_app_exists = is_cloud_app; + bool mobile_app_exists = !is_cloud_app; + for (auto duplicate_app : duplicate_apps) { + cloud_app_exists = cloud_app_exists || (duplicate_app->IsRegistered() && + duplicate_app->is_cloud_app()); + mobile_app_exists = mobile_app_exists || !duplicate_app->is_cloud_app(); + if (is_cloud_app && !duplicate_app->is_cloud_app() && + preference == mobile_apis::HybridAppPreference::CLOUD) { + // Unregister mobile application and allow cloud application to + // register in it's place + LOG4CXX_ERROR( + logger_, + "Unregistering app because a preferred version is registered."); + application_manager_.UnregisterApplication( + duplicate_app->app_id(), + mobile_apis::Result::USER_DISALLOWED, + "App is disabled by user preferences"); + } + } + + bool mobile_app_matches = + !is_cloud_app && + preference == mobile_apis::HybridAppPreference::MOBILE; + bool cloud_app_matches = + is_cloud_app && preference == mobile_apis::HybridAppPreference::CLOUD; + + bool is_preferred_application = mobile_app_matches || cloud_app_matches; + if (mobile_app_exists && cloud_app_exists && !is_preferred_application) { + SendResponse(false, + mobile_apis::Result::USER_DISALLOWED, + "App is disabled by user preferences"); + return; + } } - } else if (mobile_apis::Result::SUCCESS != coincidence_result) { - LOG4CXX_ERROR(logger_, "Coincidence check failed."); - SendResponse(false, coincidence_result); - return; } if (IsWhiteSpaceExist()) { @@ -996,8 +1016,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( DCHECK(rpc_service_.ManageHMICommand(notification)); } -mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( - std::vector<ApplicationSharedPtr>& out_duplicate_apps) { +mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -1021,8 +1040,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( const auto& cur_name = app->name(); if (app_name.CompareIgnoreCase(cur_name)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - out_duplicate_apps.push_back(app); - continue; + return mobile_apis::Result::DUPLICATE_NAME; } const auto vr = app->vr_synonyms(); if (vr) { @@ -1031,8 +1049,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - out_duplicate_apps.push_back(app); - continue; + return mobile_apis::Result::DUPLICATE_NAME; } } @@ -1043,8 +1060,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); - out_duplicate_apps.push_back(app); - continue; + return mobile_apis::Result::DUPLICATE_NAME; } } // End vr check @@ -1069,12 +1085,44 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( } // Application for end - if (!out_duplicate_apps.empty()) { - return mobile_apis::Result::DUPLICATE_NAME; - } return mobile_apis::Result::SUCCESS; } // method end +bool RegisterAppInterfaceRequest::GetDuplicateNames( + std::vector<ApplicationSharedPtr>& out_duplicate_apps) { + LOG4CXX_AUTO_TRACE(logger_); + const smart_objects::SmartObject& msg_params = + (*message_)[strings::msg_params]; + + const auto& app_name = msg_params[strings::app_name].asCustomString(); + { + const auto& accessor = application_manager_.applications().GetData(); + + for (const auto& app : accessor) { + const auto& cur_name = app->name(); + if (app_name.CompareIgnoreCase(cur_name)) { + out_duplicate_apps.push_back(app); + } + } + } + + const std::string policy_app_id = + application_manager_.GetCorrectMobileIDFromMessage(message_); + { + const auto& accessor = + application_manager_.pending_applications().GetData(); + + for (const auto& app : accessor) { + const auto& cur_name = app->name(); + if (app_name.CompareIgnoreCase(cur_name) && + policy_app_id != app->policy_app_id()) { + out_duplicate_apps.push_back(app); + } + } + } + return !out_duplicate_apps.empty(); +} + mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { LOG4CXX_AUTO_TRACE(logger_); // TODO(AOleynik): Check is necessary to allow register application in case diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index 636175c56f..d5e001b7ac 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -83,6 +83,8 @@ const hmi_apis::Common_Language::eType kHmiLanguage = hmi_apis::Common_Language::EN_US; const mobile_apis::Language::eType kMobileLanguage = mobile_apis::Language::EN_US; +const mobile_apis::HybridAppPreference::eType kHybridAppPreference = + mobile_apis::HybridAppPreference::INVALID_ENUM; const std::string kMacAddress1 = "test_mac_address1"; const std::string kMacAddress2 = "test_mac_address2"; const std::string kAppId1 = "test_app1_id"; @@ -102,6 +104,7 @@ class RegisterAppInterfaceRequestTest , app_name_("test_app_name_") , app2_name_("test_app2_name_") , lock_ptr_(std::make_shared<sync_primitives::Lock>()) + , pending_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , mock_application_helper_( application_manager_test::MockApplicationHelper:: application_helper_mock()) { @@ -141,6 +144,9 @@ class RegisterAppInterfaceRequestTest ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(kDummyString)); ON_CALL(*mock_app, language()).WillByDefault(ReturnRef(kMobileLanguage)); ON_CALL(*mock_app, ui_language()).WillByDefault(ReturnRef(kMobileLanguage)); + ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false)); + ON_CALL(*mock_app, hybrid_app_preference()) + .WillByDefault(ReturnRef(kHybridAppPreference)); ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId1)); ON_CALL(*mock_app, msg_version()) .WillByDefault(ReturnRef(mock_semantic_version)); @@ -190,6 +196,8 @@ class RegisterAppInterfaceRequestTest ON_CALL(app_mngr_, IsAppInReconnectMode(_, _)).WillByDefault(Return(false)); ON_CALL(app_mngr_, application_by_policy_id(_)) .WillByDefault(Return(ApplicationSharedPtr())); + ON_CALL(app_mngr_, pending_application_by_policy_id(_)) + .WillByDefault(Return(ApplicationSharedPtr())); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); ON_CALL( @@ -260,6 +268,8 @@ class RegisterAppInterfaceRequestTest const utils::custom_string::CustomString app2_name_; std::shared_ptr<sync_primitives::Lock> lock_ptr_; am::ApplicationSet app_set_; + std::shared_ptr<sync_primitives::Lock> pending_lock_ptr_; + am::AppsWaitRegistrationSet pending_app_set_; typedef IsNiceMock<policy_test::MockPolicyHandlerInterface, kMocksAreNice>::Result MockPolicyHandlerInterface; @@ -313,6 +323,9 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) { ON_CALL(app_mngr_, applications()) .WillByDefault( Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_))); + ON_CALL(app_mngr_, pending_applications()) + .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>( + pending_app_set_, pending_lock_ptr_))); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); @@ -432,6 +445,9 @@ TEST_F(RegisterAppInterfaceRequestTest, ON_CALL(app_mngr_, applications()) .WillByDefault( Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_))); + ON_CALL(app_mngr_, pending_applications()) + .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>( + pending_app_set_, pending_lock_ptr_))); ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true)); ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _)) .WillByDefault(Return(true)); @@ -622,6 +638,9 @@ TEST_F(RegisterAppInterfaceRequestTest, ON_CALL(app_mngr_, applications()) .WillByDefault( Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_))); + ON_CALL(app_mngr_, pending_applications()) + .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>( + pending_app_set_, pending_lock_ptr_))); MockAppPtr mock_app2 = CreateBasicMockedApp(); @@ -659,6 +678,9 @@ TEST_F(RegisterAppInterfaceRequestTest, ON_CALL(app_mngr_, applications()) .WillByDefault( Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_))); + ON_CALL(app_mngr_, pending_applications()) + .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>( + pending_app_set_, pending_lock_ptr_))); InitBasicMessage(); (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey2; diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 2b328ae9a1..f66c87b47b 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -132,7 +132,7 @@ ApplicationImpl::ApplicationImpl( protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3) , is_voice_communication_application_(false) , is_resuming_(false) - , deferred_resumption_hmi_level_(mobile_api::HMILevel::eType::INVALID_ENUM) + , deferred_resumption_hmi_level_(mobile_api::HMILevel::INVALID_ENUM) , is_hash_changed_during_suspend_(false) , video_stream_retry_number_(0) , audio_stream_retry_number_(0) @@ -144,6 +144,7 @@ ApplicationImpl::ApplicationImpl( "AudioStreamSuspend", new ::timer::TimerTaskImpl<ApplicationImpl>( this, &ApplicationImpl::OnAudioStreamSuspend)) + , hybrid_app_preference_(mobile_api::HybridAppPreference::INVALID_ENUM) , vi_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , button_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , application_manager_(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 d67ffbe348..6187a6daba 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -295,13 +295,6 @@ ApplicationSharedPtr ApplicationManagerImpl::application_by_policy_id( return FindApp(accessor, finder); } -ApplicationSharedPtr ApplicationManagerImpl::application_by_name( - const std::string& app_name) const { - AppNamePredicate finder(app_name); - DataAccessor<ApplicationSet> accessor = applications(); - return FindApp(accessor, finder); -} - ApplicationSharedPtr ApplicationManagerImpl::pending_application_by_policy_id( const std::string& policy_app_id) const { PolicyAppIdPredicate finder(policy_app_id); @@ -309,6 +302,13 @@ ApplicationSharedPtr ApplicationManagerImpl::pending_application_by_policy_id( return FindPendingApp(accessor, finder); } +ApplicationSharedPtr ApplicationManagerImpl::application_by_name( + const std::string& app_name) const { + AppNamePredicate finder(app_name); + DataAccessor<ApplicationSet> accessor = applications(); + return FindApp(accessor, finder); +} + ApplicationSharedPtr ApplicationManagerImpl::reregister_application_by_policy_id( const std::string& policy_app_id) const { @@ -420,6 +420,13 @@ ApplicationManagerImpl::applications_by_button(uint32_t button) { return FindAllApps(accessor, finder); } +std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_name( + const std::string& app_name) const { + AppNamePredicate finder(app_name); + DataAccessor<ApplicationSet> accessor = applications(); + return FindAllApps(accessor, finder); +} + struct IsApplication { IsApplication(connection_handler::DeviceHandle device_handle, const std::string& policy_app_id) @@ -1026,15 +1033,23 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { } else if (mobile_apis::HybridAppPreference::MOBILE == hybrid_app_preference) { auto nickname_it = nicknames.begin(); + bool duplicate_found = false; for (; nickname_it != nicknames.end(); ++nickname_it) { - auto app = application_by_name(*nickname_it); - if (app.use_count() != 0) { - LOG4CXX_ERROR( - logger_, - "Mobile app already registered for cloud app: " << *nickname_it); - continue; + auto apps = applications_by_name(*nickname_it); + for (auto app : apps) { + if (app.use_count() != 0 && !app->is_cloud_app()) { + LOG4CXX_ERROR(logger_, + "Mobile app already registered for cloud app: " + << *nickname_it); + duplicate_found = true; + break; + } } } + + if (duplicate_found) { + continue; + } } pending_device_map_.insert( @@ -3130,13 +3145,10 @@ void ApplicationManagerImpl::UnregisterApplication( "There is no more SDL4 apps with device handle: " << handle); RemoveAppsWaitingForRegistration(handle); - RefreshCloudAppInformation(); - SendUpdateAppList(); - } else if (app_to_remove->is_cloud_app()) { - RefreshCloudAppInformation(); - SendUpdateAppList(); } } + RefreshCloudAppInformation(); + SendUpdateAppList(); } commands_holder_->Clear(app_to_remove); diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index db1ee2dce5..1bb1ecbde3 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -258,10 +258,10 @@ void ConnectionHandlerImpl::OnConnectionPending( const transport_manager::ConnectionUID connection_id) { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, - "OnConnectionEstablished!!!: " - << device_info.device_handle() << " " << device_info.name() - << " " << device_info.mac_address() << " " - << device_info.connection_type()); + "OnConnectionPending!!!: " << device_info.device_handle() << " " + << device_info.name() << " " + << device_info.mac_address() << " " + << device_info.connection_type()); DeviceMap::iterator it = device_list_.find(device_info.device_handle()); if (device_list_.end() == it) { LOG4CXX_ERROR(logger_, "Unknown device!"); diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index df50c43e52..9343d7d973 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -184,7 +184,7 @@ class ApplicationManager { virtual ApplicationSharedPtr application_by_policy_id( const std::string& policy_app_id) const = 0; - virtual ApplicationSharedPtr application_by_name( + DEPRECATED virtual ApplicationSharedPtr application_by_name( const std::string& app_name) const = 0; virtual ApplicationSharedPtr pending_application_by_policy_id( @@ -193,6 +193,8 @@ class ApplicationManager { virtual ApplicationSharedPtr reregister_application_by_policy_id( const std::string& policy_app_id) const = 0; + virtual AppSharedPtrs applications_by_name( + const std::string& app_name) const = 0; virtual AppSharedPtrs applications_by_button(uint32_t button) = 0; virtual AppSharedPtrs applications_with_navi() = 0; 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 22f3ad1219..60ad7196a8 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -118,6 +118,9 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_CONST_METHOD1(reregister_application_by_policy_id, application_manager::ApplicationSharedPtr( const std::string& policy_app_id)); + MOCK_CONST_METHOD1(applications_by_name, + std::vector<application_manager::ApplicationSharedPtr>( + const std::string& app_name)); MOCK_METHOD1( applications_by_button, std::vector<application_manager::ApplicationSharedPtr>(uint32_t button)); |