diff options
author | AKalinich-Luxoft <AKalinich@luxoft.com> | 2017-06-27 12:05:14 +0300 |
---|---|---|
committer | AKalinich-Luxoft <AKalinich@luxoft.com> | 2017-12-12 14:11:47 +0200 |
commit | 3baea565f75bfc8cebacccc0bc04045af076e7f8 (patch) | |
tree | 95ee77a53ccc56fb45246c29ab006771b1ee95be /src/components/application_manager/src | |
parent | 4fe39afab7101e50f51415a20507821e2775387e (diff) | |
download | sdl_core-3baea565f75bfc8cebacccc0bc04045af076e7f8.tar.gz |
Removed is_suspended setter.
is_suspended flag was encapsulated inside resumption controller
Updated mocks
Diffstat (limited to 'src/components/application_manager/src')
-rw-r--r-- | src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc | 1 | ||||
-rw-r--r-- | src/components/application_manager/src/resumption/resume_ctrl_impl.cc | 19 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc index 6d131683d3..cb68b21263 100644 --- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc @@ -75,7 +75,6 @@ void OnExitAllApplicationsNotification::Run() { break; } case hmi_apis::Common_ApplicationsCloseReason::SUSPEND: { - application_manager_.resume_controller().set_is_suspended(true); application_manager_.resume_controller().OnSuspend(); SendOnSDLPersistenceComplete(); return; diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index bf7a365b9e..435e621169 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -264,19 +264,19 @@ bool ResumeCtrlImpl::RemoveApplicationFromSaved( void ResumeCtrlImpl::OnSuspend() { LOG4CXX_AUTO_TRACE(logger_); - StopSavePersistentDataTimer(); - SaveAllApplications(); - resumption_storage_->Persist(); + is_suspended_ = true; + FinalPersistData(); } void ResumeCtrlImpl::OnIgnitionOff() { LOG4CXX_AUTO_TRACE(logger_); resumption_storage_->IncrementIgnOffCount(); - OnSuspend(); + FinalPersistData(); } void ResumeCtrlImpl::OnAwake() { LOG4CXX_AUTO_TRACE(logger_); + is_suspended_ = false; ResetLaunchTime(); StartSavePersistentDataTimer(); } @@ -285,10 +285,6 @@ bool ResumeCtrlImpl::is_suspended() const { return is_suspended_; } -void ResumeCtrlImpl::set_is_suspended(const bool suspended_flag) { - is_suspended_ = suspended_flag; -} - void ResumeCtrlImpl::StartSavePersistentDataTimer() { LOG4CXX_AUTO_TRACE(logger_); if (!save_persistent_data_timer_.is_running()) { @@ -447,6 +443,13 @@ void ResumeCtrlImpl::SaveDataOnTimer() { } } +void ResumeCtrlImpl::FinalPersistData() { + LOG4CXX_AUTO_TRACE(logger_); + StopSavePersistentDataTimer(); + SaveAllApplications(); + resumption_storage_->Persist(); +} + bool ResumeCtrlImpl::IsDeviceMacAddressEqual( ApplicationSharedPtr application, const std::string& saved_device_mac) { LOG4CXX_AUTO_TRACE(logger_); |