diff options
author | Kozoriz <kozorizandriy@gmail.com> | 2016-04-11 16:25:05 +0300 |
---|---|---|
committer | Kozoriz <kozorizandriy@gmail.com> | 2016-04-25 12:05:00 +0300 |
commit | 313ed4ba92a5eb75befe9ede65eef5c15dac068c (patch) | |
tree | 797aabe5c8bae6bfd106a7724ed47655e22b14c0 /src/components/application_manager/src/resumption | |
parent | 65350ac57da63f3c267d3a27dce05a3752ddbba7 (diff) | |
download | sdl_core-313ed4ba92a5eb75befe9ede65eef5c15dac068c.tar.gz |
Policies and Resumption correctives after removing all singletons
Diffstat (limited to 'src/components/application_manager/src/resumption')
4 files changed, 97 insertions, 91 deletions
diff --git a/src/components/application_manager/src/resumption/resume_ctrl.cc b/src/components/application_manager/src/resumption/resume_ctrl.cc index 333a3b7f01..02440b13a6 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl.cc @@ -34,9 +34,8 @@ #include <fstream> #include <algorithm> -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" -#include "config_profile/profile.h" #include "utils/file_system.h" #include "connection_handler/connection_handler_impl.h" #include "application_manager/message_helper.h" @@ -44,6 +43,7 @@ #include "application_manager/commands/command_impl.h" #include "policy/policy_manager_impl.h" #include "application_manager/policies/policy_handler.h" +#include "application_manager/state_controller.h" #include "utils/helpers.h" #include "application_manager/resumption/resumption_data_db.h" #include "application_manager/resumption/resumption_data_json.h" @@ -55,23 +55,31 @@ using namespace application_manager; CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") -ResumeCtrl::ResumeCtrl() - : queue_lock_(false), - restore_hmi_level_timer_( - "RsmCtrlRstore", new timer::TimerTaskImpl<ResumeCtrl>( - this, &ResumeCtrl::ApplicationResumptiOnTimer)), - save_persistent_data_timer_( - "RsmCtrlPercist", - new timer::TimerTaskImpl<ResumeCtrl>(this, &ResumeCtrl::SaveDataOnTimer)), - is_resumption_active_(false), - is_data_saved_(false), - launch_time_(time(NULL)) {} +ResumeCtrl::ResumeCtrl(ApplicationManager& application_manager) + : event_engine::EventObserver(application_manager.event_dispatcher()), + queue_lock_(false) + , restore_hmi_level_timer_( + "RsmCtrlRstore", + new timer::TimerTaskImpl<ResumeCtrl>( + this, &ResumeCtrl::ApplicationResumptiOnTimer)) + , save_persistent_data_timer_("RsmCtrlPercist", + new timer::TimerTaskImpl<ResumeCtrl>( + this, &ResumeCtrl::SaveDataOnTimer)) + , is_resumption_active_(false) + , is_data_saved_(false) + , launch_time_(time(NULL)) + , application_manager_(application_manager) {} +#ifdef BUILD_TESTS +void ResumeCtrl::set_resumption_storage( + utils::SharedPtr<ResumptionData> mock_storage) { + resumption_storage_ = mock_storage; +} +#endif // BUILD_TESTS bool ResumeCtrl::Init(resumption::LastState& last_state) { - using namespace profile; - bool use_db = Profile::instance()->use_db_for_resumption(); + bool use_db = application_manager_.get_settings().use_db_for_resumption(); if (use_db) { - resumption_storage_.reset(new ResumptionDataDB()); + resumption_storage_.reset(new ResumptionDataDB(application_manager_)); if (!resumption_storage_->Init()) { return false; } @@ -95,7 +103,8 @@ bool ResumeCtrl::Init(resumption::LastState& last_state) { db->UpdateDBVersion(); } } else { - resumption_storage_.reset(new ResumptionDataJson(last_state)); + resumption_storage_.reset(new ResumptionDataJson(last_state, + application_manager_)); if (!resumption_storage_->Init()) { LOG4CXX_DEBUG(logger_, "Resumption storage initialisation failed"); return false; @@ -103,16 +112,15 @@ bool ResumeCtrl::Init(resumption::LastState& last_state) { } LoadResumeData(); save_persistent_data_timer_.Start( - profile::Profile::instance() - ->app_resumption_save_persistent_data_timeout(), - false); + application_manager_.get_settings().app_resumption_save_persistent_data_timeout(), + true); return true; } ResumeCtrl::~ResumeCtrl() {} void ResumeCtrl::SaveAllApplications() { - ApplicationManagerImpl::ApplicationListAccessor accessor; + DataAccessor<ApplicationSet> accessor(application_manager_.applications()); std::for_each(accessor.GetData().begin(), accessor.GetData().end(), std::bind1st(std::mem_fun(&ResumeCtrl::SaveApplication), this)); @@ -137,11 +145,11 @@ bool ResumeCtrl::RestoreAppHMIState(ApplicationSharedPtr application) { DCHECK_OR_RETURN(application, false); LOG4CXX_DEBUG(logger_, "app_id : " << application->app_id() << "; policy_app_id : " - << application->mobile_app_id()); + << application->policy_app_id()); const std::string& device_mac = application->mac_address(); smart_objects::SmartObject saved_app(smart_objects::SmartType_Map); bool result = resumption_storage_->GetSavedApplication( - application->mobile_app_id(), device_mac, saved_app); + application->policy_app_id(), device_mac, saved_app); if (result) { DCHECK_OR_RETURN(application, false); if (saved_app.keyExists(strings::hmi_level)) { @@ -164,7 +172,7 @@ bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(application, false); mobile_apis::HMILevel::eType default_hmi = - ApplicationManagerImpl::instance()->GetDefaultHmiLevel(application); + application_manager_.GetDefaultHmiLevel(application); return SetAppHMIState(application, default_hmi, false); } @@ -174,8 +182,7 @@ void ResumeCtrl::ApplicationResumptiOnTimer() { WaitingForTimerList::iterator it = waiting_for_timer_.begin(); for (; it != waiting_for_timer_.end(); ++it) { - ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(*it); + ApplicationSharedPtr app = application_manager_.application(*it); if (!app) { LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it); continue; @@ -213,18 +220,17 @@ bool ResumeCtrl::SetAppHMIState(ApplicationSharedPtr application, << check_policy); const std::string& device_mac = application->mac_address(); if (check_policy && - ApplicationManagerImpl::instance()-> - GetPolicyHandler().GetUserConsentForDevice(device_mac) != - policy::DeviceConsent::kDeviceAllowed) { - LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed"); + application_manager_.GetUserConsentForDevice(device_mac) != + policy::DeviceConsent::kDeviceAllowed) { + LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed."); SetupDefaultHMILevel(application); return false; } application->set_is_resuming(true); - ApplicationManagerImpl::instance()->SetHmiState(application->app_id(), - hmi_level); + application_manager_.state_controller().SetRegularState(application, + hmi_level); LOG4CXX_INFO(logger_, - "Application with policy id " << application->mobile_app_id() + "Application with policy id " << application->policy_app_id() << " got HMI level " << hmi_level); return true; @@ -248,9 +254,9 @@ uint32_t ResumeCtrl::GetHMIApplicationID(const std::string& policy_app_id, bool ResumeCtrl::RemoveApplicationFromSaved( ApplicationConstSharedPtr application) { - const std::string device_mac = application->mac_address(); + const std::string& device_mac = application->mac_address(); return resumption_storage_->RemoveApplicationFromSaved( - application->mobile_app_id(), device_mac); + application->policy_app_id(), device_mac); } void ResumeCtrl::OnSuspend() { @@ -271,9 +277,7 @@ void ResumeCtrl::StartSavePersistentDataTimer() { LOG4CXX_AUTO_TRACE(logger_); if (!save_persistent_data_timer_.is_running()) { save_persistent_data_timer_.Start( - profile::Profile::instance() - ->app_resumption_save_persistent_data_timeout(), - false); + application_manager_.get_settings().app_resumption_save_persistent_data_timeout(), true); } } @@ -292,14 +296,14 @@ bool ResumeCtrl::StartResumption(ApplicationSharedPtr application, " Resume app_id = " << application->app_id() << " hmi_app_id = " << application->hmi_app_id() << " policy_id = " - << application->mobile_app_id() + << application->policy_app_id() << " received hash = " << hash); SetupDefaultHMILevel(application); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); bool result = resumption_storage_->GetSavedApplication( - application->mobile_app_id(), + application->policy_app_id(), device_mac, saved_app); if (result) { @@ -324,12 +328,12 @@ bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) { << "with hmi_app_id " << application->hmi_app_id() << ", policy_app_id " - << application->mobile_app_id()); + << application->policy_app_id()); SetupDefaultHMILevel(application); const std::string& device_mac = application->mac_address(); smart_objects::SmartObject saved_app; bool result = resumption_storage_->GetSavedApplication( - application->mobile_app_id(), + application->policy_app_id(), device_mac, saved_app); if (result) { @@ -341,14 +345,13 @@ bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) { } void ResumeCtrl::StartAppHmiStateResumption(ApplicationSharedPtr application) { - using namespace profile; using namespace date_time; LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(application); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); bool result = resumption_storage_->GetSavedApplication( - application->mobile_app_id(), + application->policy_app_id(), device_mac, saved_app); DCHECK_OR_RETURN_VOID(result); @@ -359,17 +362,18 @@ void ResumeCtrl::StartAppHmiStateResumption(ApplicationSharedPtr application) { ((0 == ign_off_count) || CheckIgnCycleRestrictions(saved_app)); if (restore_data_allowed) { LOG4CXX_INFO(logger_, - "Resume application " << application->mobile_app_id()); + "Resume application " << application->policy_app_id()); RestoreAppHMIState(application); RemoveApplicationFromSaved(application); } else { LOG4CXX_INFO(logger_, "Do not need to resume application " - << application->mobile_app_id()); + << application->policy_app_id()); } } void ResumeCtrl::ResetLaunchTime() { + LOG4CXX_AUTO_TRACE(logger_); launch_time_ = time(NULL); } @@ -379,11 +383,11 @@ bool ResumeCtrl::CheckPersistenceFilesForResumption( DCHECK_OR_RETURN(application, false); LOG4CXX_DEBUG(logger_, " Resume app_id = " << application->app_id() << " policy_id = " - << application->mobile_app_id()); + << application->policy_app_id()); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); bool result = resumption_storage_->GetSavedApplication( - application->mobile_app_id(), + application->policy_app_id(), device_mac, saved_app); if (result) { @@ -406,7 +410,7 @@ bool ResumeCtrl::CheckApplicationHash(ApplicationSharedPtr application, smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); bool result = resumption_storage_->GetSavedApplication( - application->mobile_app_id(), + application->policy_app_id(), device_mac, saved_app); return result ? saved_app[strings::hash_id].asString() == hash : false; @@ -422,7 +426,7 @@ void ResumeCtrl::SaveDataOnTimer() { if (false == is_data_saved_) { SaveAllApplications(); is_data_saved_ = true; - if (!(profile::Profile::instance()->use_db_for_resumption())) { + if (!application_manager_.get_settings().use_db_for_resumption()) { resumption_storage_->Persist(); } } @@ -430,6 +434,7 @@ void ResumeCtrl::SaveDataOnTimer() { bool ResumeCtrl::IsDeviceMacAddressEqual(ApplicationSharedPtr application, const std::string& saved_device_mac) { + LOG4CXX_AUTO_TRACE(logger_); const std::string device_mac = application->mac_address(); return device_mac == saved_device_mac; } @@ -442,7 +447,7 @@ bool ResumeCtrl::RestoreApplicationData(ApplicationSharedPtr application) { smart_objects::SmartObject saved_app(smart_objects::SmartType_Map); const std::string& device_mac = application->mac_address(); bool result = resumption_storage_->GetSavedApplication( - application->mobile_app_id(), + application->policy_app_id(), device_mac, saved_app); if (result) { @@ -508,7 +513,7 @@ void ResumeCtrl::AddSubmenues(ApplicationSharedPtr application, application->AddSubMenu(submenu[strings::menu_id].asUInt(), submenu); } ProcessHMIRequests( - MessageHelper::CreateAddSubMenuRequestToHMI(application)); + MessageHelper::CreateAddSubMenuRequestToHMI(application, application_manager_.GetNextHMICorrelationID())); } else { LOG4CXX_FATAL(logger_, "application_submenus section is not exists"); } @@ -527,7 +532,7 @@ void ResumeCtrl::AddCommands(ApplicationSharedPtr application, application->AddCommand(command[strings::cmd_id].asUInt(), command); } ProcessHMIRequests( - MessageHelper::CreateAddCommandRequestToHMI(application)); + MessageHelper::CreateAddCommandRequestToHMI(application, application_manager_)); } else { LOG4CXX_FATAL(logger_, "application_commands section is not exists"); } @@ -547,7 +552,7 @@ void ResumeCtrl::AddChoicesets(ApplicationSharedPtr application, application->AddChoiceSet(choice_set_id, choice_set); } ProcessHMIRequests( - MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(application)); + MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(application, application_manager_)); } else { LOG4CXX_FATAL(logger_, "There is no any choicesets"); } @@ -562,7 +567,7 @@ void ResumeCtrl::SetGlobalProperties( const smart_objects::SmartObject& properties_so = saved_app[strings::application_global_properties]; application->load_global_properties(properties_so); - MessageHelper::SendGlobalPropertiesToHMI(application); + MessageHelper::SendGlobalPropertiesToHMI(application, application_manager_); } } @@ -574,8 +579,7 @@ void ResumeCtrl::AddWayPointsSubscription(app_mngr::ApplicationSharedPtr applica const smart_objects::SmartObject& subscribed_for_way_points_so = saved_app[strings::subscribed_for_way_points]; if (true == subscribed_for_way_points_so.asBool()) { - application_manager::ApplicationManagerImpl::instance()-> - SubscribeAppForWayPoints(application->app_id()); + application_manager_.SubscribeAppForWayPoints(application->app_id()); } } } @@ -597,7 +601,7 @@ void ResumeCtrl::AddSubscriptions(ApplicationSharedPtr application, application->SubscribeToButton(btn); } } - MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(application); + MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(application, application_manager_); if (subscribtions.keyExists(strings::application_vehicle_info)) { const smart_objects::SmartObject& subscribtions_ivi = @@ -607,8 +611,9 @@ void ResumeCtrl::AddSubscriptions(ApplicationSharedPtr application, ivi = static_cast<VehicleDataType>((subscribtions_ivi[i]).asInt()); application->SubscribeToIVI(ivi); } + ProcessHMIRequests( + MessageHelper::GetIVISubscriptionRequests(application, application_manager_)); } - ProcessHMIRequests(MessageHelper::GetIVISubscriptionRequests(application)); } } @@ -632,7 +637,6 @@ bool ResumeCtrl::CheckIgnCycleRestrictions( bool ResumeCtrl::DisconnectedJustBeforeIgnOff( const smart_objects::SmartObject& saved_app) { using namespace date_time; - using namespace profile; LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); @@ -647,9 +651,9 @@ bool ResumeCtrl::DisconnectedJustBeforeIgnOff( << "; sec_spent_before_ign " << sec_spent_before_ign << "; resumption_delay_before_ign " - << Profile::instance()->resumption_delay_before_ign()); + << application_manager_.get_settings().resumption_delay_before_ign()); return sec_spent_before_ign <= - Profile::instance()->resumption_delay_before_ign(); + application_manager_.get_settings().resumption_delay_before_ign(); } bool ResumeCtrl::CheckAppRestrictions( @@ -679,18 +683,17 @@ bool ResumeCtrl::CheckIcons(ApplicationSharedPtr application, using namespace smart_objects; LOG4CXX_AUTO_TRACE(logger_); const mobile_apis::Result::eType verify_images = - MessageHelper::VerifyImageFiles(obj, application); + MessageHelper::VerifyImageFiles(obj, application, application_manager_); return mobile_apis::Result::INVALID_DATA != verify_images; } bool ResumeCtrl::CheckDelayAfterIgnOn() { using namespace date_time; - using namespace profile; LOG4CXX_AUTO_TRACE(logger_); const time_t curr_time = time(NULL); const time_t sdl_launch_time = launch_time(); const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time); - const uint32_t wait_time = Profile::instance()->resumption_delay_after_ign(); + const uint32_t wait_time = application_manager_.get_settings().resumption_delay_after_ign(); LOG4CXX_DEBUG(logger_, "curr_time " << curr_time << "; sdl_launch_time " << sdl_launch_time @@ -721,7 +724,7 @@ bool ResumeCtrl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request, (*request)[strings::correlation_id].asInt(); subscribe_on_event(function_id, hmi_correlation_id); } - if (!ApplicationManagerImpl::instance()->ManageHMICommand(request)) { + if (!application_manager_.ManageHMICommand(request)) { LOG4CXX_ERROR(logger_, "Unable to send request"); return false; } @@ -738,15 +741,18 @@ void ResumeCtrl::ProcessHMIRequests( } } -void ResumeCtrl::AddToResumptionTimerQueue(uint32_t app_id) { +void ResumeCtrl::AddToResumptionTimerQueue(const uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); queue_lock_.Acquire(); waiting_for_timer_.push_back(app_id); queue_lock_.Release(); + LOG4CXX_DEBUG(logger_, + "Application ID " << app_id << " have been added" + " to resumption queue."); if (!is_resumption_active_) { is_resumption_active_ = true; restore_hmi_level_timer_.Start( - profile::Profile::instance()->app_resuming_timeout(), true); + application_manager_.get_settings().app_resuming_timeout(), false); } } diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index d068945d6b..f7332a796d 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -34,14 +34,14 @@ #include "utils/logger.h" #include "application_manager/smart_object_keys.h" #include "application_manager/vehicle_info_data.h" +#include "application_manager/application_manager_settings.h" namespace resumption { CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") -ResumptionData::ResumptionData(): - resumption_lock_(true) { -} +ResumptionData::ResumptionData(const application_manager::ApplicationManager& application_manager) + : resumption_lock_(true), application_manager_(application_manager) {} smart_objects::SmartObject ResumptionData::GetApplicationCommands( app_mngr::ApplicationConstSharedPtr application) const { diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 6765bf8eff..19d26dc249 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -36,11 +36,11 @@ #include "application_manager/resumption/resumption_data_db.h" #include "application_manager/resumption/resumption_sql_queries.h" #include "application_manager/smart_object_keys.h" -#include "config_profile/profile.h" #include "application_manager/message_helper.h" #include "utils/helpers.h" #include "utils/gen_hash.h" #include "utils/scope_guard.h" +#include "application_manager/application_manager_settings.h" namespace { const std::string kDatabaseName = "resumption"; @@ -49,10 +49,11 @@ const std::string kDatabaseName = "resumption"; namespace resumption { CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") -ResumptionDataDB::ResumptionDataDB() - : db_(new utils::dbms::SQLDatabase(kDatabaseName)) { +ResumptionDataDB::ResumptionDataDB(const application_manager::ApplicationManager& application_manager) + : ResumptionData(application_manager), + db_(new utils::dbms::SQLDatabase(kDatabaseName)) { #ifndef __QNX__ - std::string path = profile::Profile::instance()->app_storage_folder(); + std::string path = application_manager_.get_settings().app_storage_folder(); if (!path.empty()) { db_->set_path(path + "/"); } @@ -70,12 +71,10 @@ bool ResumptionDataDB::Init() { if (!db_->Open()) { LOG4CXX_ERROR(logger_, "Failed opening database."); LOG4CXX_INFO(logger_, "Starting opening retries."); - const uint16_t attempts = - profile::Profile::instance()->attempts_to_open_resumption_db(); + const uint16_t attempts = application_manager_.get_settings().attempts_to_open_resumption_db(); LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts); bool is_opened = false; - const uint16_t open_attempt_timeout_ms = - profile::Profile::instance()->open_attempt_timeout_ms_resumption_db(); + const uint16_t open_attempt_timeout_ms = application_manager_.get_settings().open_attempt_timeout_ms_resumption_db(); const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000; LOG4CXX_DEBUG(logger_, "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); @@ -140,7 +139,7 @@ void ResumptionDataDB::SaveApplication( LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(application); bool application_exist = false; - const std::string& policy_app_id = application->mobile_app_id(); + const std::string& policy_app_id = application->policy_app_id(); const std::string& device_mac = application->mac_address(); LOG4CXX_INFO(logger_, "app_id : " << application->app_id() << " policy_app_id : " @@ -234,6 +233,7 @@ bool ResumptionDataDB::CheckSavedApplication(const std::string& policy_app_id, uint32_t ResumptionDataDB::GetHMIApplicationID( const std::string& policy_app_id, const std::string& device_id) const { LOG4CXX_AUTO_TRACE(logger_); + uint32_t hmi_app_id = 0; SelectHMIId(policy_app_id, device_id, hmi_app_id); return hmi_app_id; @@ -687,9 +687,11 @@ bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const { data = smart_objects::SmartObject(smart_objects::SmartType_Array); uint32_t index = 0; + std::string app_id; + std::string device_id; while (query.Next()) { - const std::string app_id = query.GetString(0); - const std::string device_id = query.GetString(1); + app_id = query.GetString(0); + device_id = query.GetString(1); if (GetSavedApplication(app_id, device_id, data[index])) { ++index; } @@ -2614,8 +2616,7 @@ bool ResumptionDataDB::InsertApplicationData( const mobile_apis::HMILevel::eType hmi_level = application.m_hmi_level; bool is_media_application = application.m_is_media_application; bool is_subscribed_for_way_points = - app_mngr::ApplicationManagerImpl::instance()->IsAppSubscribedForWayPoints( - connection_key); + application_manager_.IsAppSubscribedForWayPoints(connection_key); if (!query.Prepare(kInsertApplication)) { LOG4CXX_WARN(logger_, diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index becc9c19ce..46fb21729e 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -37,7 +37,7 @@ #include "formatters/CFormatterJsonBase.h" #include "application_manager/message_helper.h" #include "application_manager/smart_object_keys.h" -#include "config_profile/profile.h" +#include "application_manager/application_manager_settings.h" namespace resumption { @@ -45,8 +45,9 @@ namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") -ResumptionDataJson::ResumptionDataJson(LastState& last_state) - : ResumptionData(), last_state_(last_state) {} +ResumptionDataJson::ResumptionDataJson(LastState& last_state, + const application_manager::ApplicationManager& application_manager) + : ResumptionData(application_manager), last_state_(last_state) {} void ResumptionDataJson::SaveApplication( app_mngr::ApplicationSharedPtr application) { @@ -54,7 +55,7 @@ void ResumptionDataJson::SaveApplication( LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(application); - const std::string& policy_app_id = application->mobile_app_id(); + const std::string& policy_app_id = application->policy_app_id(); LOG4CXX_DEBUG(logger_, "app_id : " << application->app_id() << " policy_app_id : " << policy_app_id); @@ -63,8 +64,7 @@ void ResumptionDataJson::SaveApplication( const uint32_t time_stamp = (uint32_t)time(NULL); const std::string device_mac = application->mac_address(); const mobile_apis::HMILevel::eType hmi_level = application->hmi_level(); - const bool is_subscribed_for_way_points = - app_mngr::ApplicationManagerImpl::instance()-> + const bool is_subscribed_for_way_points = application_manager_. IsAppSubscribedForWayPoints(application->app_id()); sync_primitives::AutoLock autolock(resumption_lock_); @@ -185,7 +185,6 @@ uint32_t ResumptionDataJson::GetHMIApplicationID( void ResumptionDataJson::OnSuspend() { using namespace app_mngr; - using namespace profile; LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock autolock(resumption_lock_); Json::Value to_save; |