diff options
Diffstat (limited to 'src/components/application_manager/src/resumption')
5 files changed, 29 insertions, 18 deletions
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 96870c12c1..c74ccaf4a1 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -734,7 +734,7 @@ bool ResumeCtrlImpl::CheckDelayBeforeIgnOff( return true; } - const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp); + const uint64_t sec_spent_before_ign = labs(ign_off_time - time_stamp); SDL_LOG_DEBUG( "ign_off_time " << ign_off_time << "; app_disconnect_time " << time_stamp diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index 50b95dba42..0663237c43 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -163,7 +163,8 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( subscriptions); } - for (auto extension : application->Extensions()) { + auto extensions = application->Extensions(); + for (auto& extension : extensions.GetData()) { extension->SaveResumptionData(subscriptions); } 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 eedfc48b73..ce68609ee9 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -356,7 +356,7 @@ bool ResumptionDataDB::RemoveApplicationFromSaved( return result; } -uint32_t ResumptionDataDB::GetIgnOffTime() const { +int64_t ResumptionDataDB::GetIgnOffTime() const { SDL_LOG_AUTO_TRACE(); return SelectIgnOffTime(); } @@ -533,14 +533,14 @@ bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id, return false; } -uint32_t ResumptionDataDB::SelectIgnOffTime() const { +int64_t ResumptionDataDB::SelectIgnOffTime() const { SDL_LOG_AUTO_TRACE(); - uint32_t ignOffTime = 0; + int64_t ignOffTime = 0; utils::dbms::SQLQuery query(db()); if (query.Prepare(kSelectIgnOffTime)) { if (query.Exec()) { - ignOffTime = query.GetUInteger(0); + ignOffTime = query.GetLongInt(0); SDL_LOG_INFO("Last ign off time = " << ignOffTime); return ignOffTime; } @@ -612,7 +612,7 @@ void ResumptionDataDB::SelectDataForLoadResumeData( SmartObject so_obj(SmartType_Map); so_obj[strings::hmi_level] = select_data.GetInteger(0); so_obj[strings::ign_off_count] = select_data.GetInteger(1); - so_obj[strings::time_stamp] = select_data.GetUInteger(2); + so_obj[strings::time_stamp] = select_data.GetLongInt(2); so_obj[strings::app_id] = select_data.GetString(3); so_obj[strings::device_id] = select_data.GetString(4); so_array_data[i++] = so_obj; @@ -1470,7 +1470,7 @@ bool ResumptionDataDB::SelectDataFromAppTable( saved_app[strings::hmi_app_id] = query.GetUInteger(4); saved_app[strings::hmi_level] = query.GetInteger(5); saved_app[strings::ign_off_count] = query.GetInteger(6); - saved_app[strings::time_stamp] = query.GetUInteger(7); + saved_app[strings::time_stamp] = query.GetLongInt(7); saved_app[strings::device_id] = query.GetString(8); saved_app[strings::is_media_application] = query.GetBoolean(9); saved_app[strings::subscribed_for_way_points] = query.GetBoolean(10); 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 5d6d008911..a2b99b4ac1 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -62,7 +62,7 @@ void ResumptionDataJson::SaveApplication( << " policy_app_id : " << policy_app_id); const std::string hash = application->curHash(); const uint32_t grammar_id = application->get_grammar_id(); - const uint32_t time_stamp = (uint32_t)time(NULL); + const int64_t time_stamp = (int64_t)time(NULL); const std::string device_mac = application->mac_address(); const mobile_apis::HMILevel::eType hmi_level = application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); @@ -288,7 +288,7 @@ bool ResumptionDataJson::RemoveApplicationFromSaved( return result; } -uint32_t ResumptionDataJson::GetIgnOffTime() const { +int64_t ResumptionDataJson::GetIgnOffTime() const { using namespace app_mngr; SDL_LOG_AUTO_TRACE(); @@ -300,7 +300,7 @@ uint32_t ResumptionDataJson::GetIgnOffTime() const { accessor.GetMutableData().set_dictionary(dictionary); SDL_LOG_WARN("last_save_time section is missed"); } - return resumption[strings::last_ign_off_time].asUInt(); + return resumption[strings::last_ign_off_time].asInt64(); } uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const { @@ -399,7 +399,7 @@ void ResumptionDataJson::GetDataForLoadResumeData( smart_objects::SmartObject so(smart_objects::SmartType_Map); so[strings::hmi_level] = saved_app[strings::hmi_level].asInt(); so[strings::ign_off_count] = saved_app[strings::ign_off_count].asInt(); - so[strings::time_stamp] = saved_app[strings::time_stamp].asUInt(); + so[strings::time_stamp] = saved_app[strings::time_stamp].asInt64(); so[strings::app_id] = saved_app[strings::app_id].asString(); so[strings::device_id] = saved_app[strings::device_id].asString(); so_array_data[i++] = so; @@ -532,7 +532,7 @@ void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time, SDL_LOG_WARN("ign_off_time = " << ign_off_time); Json::Value& resumption = GetResumptionData(dictionary); - resumption[strings::last_ign_off_time] = static_cast<uint32_t>(ign_off_time); + resumption[strings::last_ign_off_time] = static_cast<int64_t>(ign_off_time); } bool ResumptionDataJson::Init() { diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index b8462a533a..996b4f3026 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -178,7 +178,7 @@ void ResumptionDataProcessorImpl::ProcessResumptionStatus( } } -void ResumptionDataProcessorImpl::EraseProcessedRequest( +bool ResumptionDataProcessorImpl::EraseProcessedRequest( const uint32_t app_id, const ResumptionRequest& found_request) { SDL_LOG_AUTO_TRACE(); @@ -194,7 +194,11 @@ void ResumptionDataProcessorImpl::EraseProcessedRequest( request.request_id.function_id == found_request.request_id.function_id; }); - list_of_sent_requests.erase(request_iter); + if (request_iter != list_of_sent_requests.end()) { + list_of_sent_requests.erase(request_iter); + return true; + } + return false; } bool ResumptionDataProcessorImpl::IsResumptionFinished( @@ -285,6 +289,7 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI( SDL_LOG_DEBUG("app_id is: " << app_id); auto found_request = GetRequest(app_id, function_id, corr_id); + if (!found_request) { SDL_LOG_ERROR("Request with function id " << function_id << " and corr id " << corr_id << " not found"); @@ -293,7 +298,11 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI( auto request = *found_request; ProcessResumptionStatus(app_id, response, request); - EraseProcessedRequest(app_id, request); + + if (!EraseProcessedRequest(app_id, request)) { + SDL_LOG_DEBUG("Request has already been processed"); + return; + } if (!IsResumptionFinished(app_id)) { SDL_LOG_DEBUG("Resumption app " @@ -890,7 +899,8 @@ void ResumptionDataProcessorImpl::AddPluginsSubscriptions( const smart_objects::SmartObject& saved_app) { SDL_LOG_AUTO_TRACE(); - for (auto& extension : application->Extensions()) { + auto extensions = application->Extensions(); + for (auto& extension : extensions.GetData()) { extension->ProcessResumption(saved_app); } } @@ -995,7 +1005,7 @@ void ResumptionDataProcessorImpl::DeletePluginsSubscriptions( resumption_status_lock_.Release(); auto extensions = application->Extensions(); - for (auto& extension : extensions) { + for (auto& extension : extensions.GetData()) { extension->RevertResumption(resumption_data_to_revert); } } |