diff options
author | Artem Nosach <ANosach@luxoft.com> | 2016-02-24 09:43:39 +0200 |
---|---|---|
committer | Artem Nosach <ANosach@luxoft.com> | 2016-02-24 09:43:39 +0200 |
commit | 85918cbc46b7c920b70e76a8c5a9b724379c4d98 (patch) | |
tree | 6805dafc6d72f807c16b1bea27e51878c91a9d5b | |
parent | 303571bd6026b6a7ee3a1f0fa1c69846483314c7 (diff) | |
parent | 0dcb608da650f6baf1147368fd4b37f29db8a7d2 (diff) | |
download | smartdevicelink-develop.tar.gz |
Merge pull request #385 from LuxoftSDL/hotfix/Resumption_failed_not_getting_Activate_App_for_Media_App_Fulldevelop
Resumption failed : not getting Activate App (for Media App - Full)
4 files changed, 41 insertions, 5 deletions
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h index 9263d5b67..8f5f5f3cd 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h @@ -268,6 +268,20 @@ class ResumeCtrl: public app_mngr::event_engine::EventObserver { * returns false */ bool Init(); + + /** + * @brief Notify resume controller about new application + * @param policy_app_id - mobile application id + * @param device_id - id of device where application is run + */ + void OnAppRegistrationStart(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Notify resume controller about delete new application + */ + void OnAppRegistrationEnd(); + private: /** diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 088e69c22..c6a0cadf6 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -548,6 +548,11 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( : GenerateNewHMIAppID()); } + // 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. + resume_ctrl_.OnAppRegistrationStart(policy_app_id, device_mac); + // Add application to registered app list and set appropriate mark. // Lock has to be released before adding app to policy DB to avoid possible // deadlock with simultaneous PTU processing diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index 9ef30c295..b0393ac6f 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -327,9 +327,11 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(key); + resumption::ResumeCtrl& resumer = ApplicationManagerImpl::instance()->resume_controller(); if (!application) { - LOG4CXX_ERROR(logger_, - "There is no application for such connection key" << key); + LOG4CXX_ERROR(logger_, "There is no application for such connection key" << key); + LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer"); + resumer.OnAppRegistrationEnd(); return; } @@ -503,9 +505,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { std::string hash_id; std::string add_info; - resumption::ResumeCtrl& resumer = - ApplicationManagerImpl::instance()->resume_controller(); - if (resumption) { hash_id = (*message_)[strings::msg_params][strings::hash_id].asString(); if (!resumer.CheckApplicationHash(application, hash_id)) { diff --git a/src/components/application_manager/src/resumption/resume_ctrl.cc b/src/components/application_manager/src/resumption/resume_ctrl.cc index 926c98808..8c4c26389 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl.cc @@ -182,6 +182,7 @@ void ResumeCtrl::ApplicationResumptiOnTimer() { } is_resumption_active_ = false; waiting_for_timer_.clear(); + StartSavePersistentDataTimer(); } void ResumeCtrl::OnAppActivated(ApplicationSharedPtr application) { @@ -747,10 +748,27 @@ void ResumeCtrl::LoadResumeData() { } } +void ResumeCtrl::OnAppRegistrationStart(const std::string& policy_app_id, + const std::string& device_id) { + LOG4CXX_AUTO_TRACE(logger_); + if (IsApplicationSaved(policy_app_id, device_id)) { + LOG4CXX_INFO(logger_, "Application is found in resumption " + "data and will try to resume. Stopping resume data persistent timer"); + StopSavePersistentDataTimer(); + } +} + +void ResumeCtrl::OnAppRegistrationEnd() { + LOG4CXX_AUTO_TRACE(logger_); + StartSavePersistentDataTimer(); +} + bool ResumeCtrl::IsAppDataResumptionExpired( const smart_objects::SmartObject& application) const { const int32_t max_ign_off_count = 3; return max_ign_off_count <= application[strings::ign_off_count].asInt(); } + + } // namespce resumption |