diff options
author | Yevhenii Dementieiev (GitHub) <ydementieiev@luxoft.com> | 2020-01-31 12:57:39 +0200 |
---|---|---|
committer | sniukalov <sniukaov@luxoft.com> | 2020-02-06 19:57:50 +0200 |
commit | 32c1314d9abc2eeccdc6afafb7877a06e18bcbe3 (patch) | |
tree | 83d2fdda95ff6de9ee7cdd7116a14e6eb4952ee6 | |
parent | 5bf6af4c27e11cbd511eb4baaa1e3001f375c91a (diff) | |
download | sdl_core-32c1314d9abc2eeccdc6afafb7877a06e18bcbe3.tar.gz |
fixup! Start the new PTU after a failed retry sequence in case some trigger occurs during the retry sequence
12 files changed, 31 insertions, 31 deletions
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 7d99a67bbc..fc411c8e43 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -428,12 +428,12 @@ class PolicyHandler : public PolicyHandlerInterface, * the same app id exists * @param new_app_id app id new application */ - void PushAppIdToQueue(const uint32_t new_app_id); + void PushAppIdToPTUQueue(const uint32_t new_app_id); /** * @brief Remove the first application from applications queue */ - void PopAppIdFromQueue(); + void PopAppIdFromPTUQueue(); custom_str::CustomString GetAppName( const std::string& policy_app_id) OVERRIDE; @@ -602,7 +602,7 @@ class PolicyHandler : public PolicyHandlerInterface, /** * @brief Queue applications for which PTU has not yet been completed */ - std::set<uint32_t> queue_applications_for_ptu_; + std::set<uint32_t> applications_ptu_queue; /** * @brief OnAppRegisteredOnMobile allows to handle event when application were diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 32589c90bd..0e1bc1f3c3 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -302,7 +302,7 @@ PolicyHandler::PolicyHandler(const PolicySettings& settings, , statistic_manager_impl_(std::make_shared<StatisticManagerImpl>(this)) , settings_(settings) , application_manager_(application_manager) - , last_registered_policy_app_id_("") {} + , last_registered_policy_app_id_(std::string()) {} PolicyHandler::~PolicyHandler() {} @@ -466,23 +466,23 @@ uint32_t PolicyHandler::GetAppIdForSending() const { return ChooseRandomAppForPolicyUpdate(apps_with_none_level); } -void PolicyHandler::PushAppIdToQueue(const uint32_t app_id) { +void PolicyHandler::PushAppIdToPTUQueue(const uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(app_id_queue_lock_); - const auto result = queue_applications_for_ptu_.insert(app_id); + const auto result = applications_ptu_queue.insert(app_id); if (result.second) { - policy_manager_->OnChangeApplicationCount( - queue_applications_for_ptu_.size()); + policy_manager_->UpdatePTUReadyAppsCount( + applications_ptu_queue.size()); } } -void PolicyHandler::PopAppIdFromQueue() { +void PolicyHandler::PopAppIdFromPTUQueue() { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(app_id_queue_lock_); - if (queue_applications_for_ptu_.size() > 0) { - queue_applications_for_ptu_.erase(queue_applications_for_ptu_.begin()); - policy_manager_->OnChangeApplicationCount( - queue_applications_for_ptu_.size()); + if (applications_ptu_queue.size() > 0) { + applications_ptu_queue.erase(applications_ptu_queue.begin()); + policy_manager_->UpdatePTUReadyAppsCount( + applications_ptu_queue.size()); } } @@ -1144,7 +1144,7 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file, const bool is_ptu_successful = load_pt_result == PolicyManager::PtProcessingResult::kSuccess; OnPTUFinished(is_ptu_successful); - PopAppIdFromQueue(); + PopAppIdFromPTUQueue(); if (is_ptu_successful) { LOG4CXX_INFO(logger_, "PTU was successful."); policy_manager_->CleanupUnpairedDevices(); @@ -1522,7 +1522,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, } void PolicyHandler::OnPTUTimeOut() { - PopAppIdFromQueue(); + PopAppIdFromPTUQueue(); #ifndef EXTERNAL_PROPRIETARY_MODE application_manager_.protocol_handler().ProcessFailedPTU(); #endif @@ -1938,7 +1938,7 @@ void PolicyHandler::OnPTUFinished(const bool ptu_result) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(listeners_lock_); if (!ptu_result) { - PopAppIdFromQueue(); + PopAppIdFromPTUQueue(); } std::for_each( listeners_.begin(), @@ -2244,7 +2244,7 @@ void PolicyHandler::OnAddedNewApplicationToAppList( return; } last_registered_policy_app_id_ = policy_id; - PushAppIdToQueue(new_app_id); + PushAppIdToPTUQueue(new_app_id); } void PolicyHandler::OnAppRegisteredOnMobile(const std::string& device_id, diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h index ee454b4b19..3d7a913991 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -537,7 +537,7 @@ class PolicyManager : public usage_statistics::StatisticsManager, * @brief Change applications count ready for PTU * @param new_app_count new applications count for PTU */ - virtual void OnChangeApplicationCount(const uint32_t new_app_count) = 0; + virtual void UpdatePTUReadyAppsCount(const uint32_t new_app_count) = 0; /** * @brief OnAppRegisteredOnMobile allows to handle event when application were diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h index 0385a8c93a..26a90b0470 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -528,7 +528,7 @@ class PolicyManager : public usage_statistics::StatisticsManager, * @brief Change applications count ready for PTU * @param new_app_count new applications count for PTU */ - virtual void OnChangeApplicationCount(const uint32_t new_app_count) = 0; + virtual void UpdatePTUReadyAppsCount(const uint32_t new_app_count) = 0; /** * @brief Get state of request types for given application diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h index 9f93b57813..aa12106914 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h @@ -212,7 +212,7 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed)); MOCK_METHOD0(OnAppsSearchStarted, void()); MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu)); - MOCK_METHOD1(OnChangeApplicationCount, void(const uint32_t new_app_count)); + MOCK_METHOD1(UpdatePTUReadyAppsCount, void(const uint32_t new_app_count)); MOCK_METHOD2(OnAppRegisteredOnMobile, void(const std::string& device_id, const std::string& application_id)); diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h index 27cdc27c4b..4ca0c3ccec 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h @@ -210,7 +210,7 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed)); MOCK_METHOD0(OnAppsSearchStarted, void()); MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu)); - MOCK_METHOD1(OnChangeApplicationCount, void(const uint32_t new_app_count)); + MOCK_METHOD1(UpdatePTUReadyAppsCount, void(const uint32_t new_app_count)); MOCK_METHOD2(OnAppRegisteredOnMobile, void(const std::string& device_id, const std::string& application_id)); diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index e110ff375d..4cf21c3373 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -608,7 +608,7 @@ class PolicyManagerImpl : public PolicyManager { */ void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE; - void OnChangeApplicationCount(const uint32_t new_app_count) OVERRIDE; + void UpdatePTUReadyAppsCount(const uint32_t new_app_count) OVERRIDE; /** * @brief Get state of request types for given application diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 9619872eb4..d241ca4a39 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -778,7 +778,7 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { } } -void PolicyManagerImpl::OnChangeApplicationCount(const uint32_t new_app_count) { +void PolicyManagerImpl::UpdatePTUReadyAppsCount(const uint32_t new_app_count) { applications_pending_ptu_count_ = new_app_count; } diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index 1793ce2f72..aa69cd6769 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -624,7 +624,7 @@ class PolicyManagerImpl : public PolicyManager { */ void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE; - void OnChangeApplicationCount(const uint32_t new_app_count) OVERRIDE; + void UpdatePTUReadyAppsCount(const uint32_t new_app_count) OVERRIDE; /** * @brief Get state of request types for given application diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager.h b/src/components/policy/policy_regular/include/policy/update_status_manager.h index fc96c8bbef..c799f5b83b 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager.h @@ -213,7 +213,7 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { UpdateEvent last_processed_event_; bool apps_search_in_progress_; bool app_registered_from_non_consented_device_; - bool last_update_was_failed_; + bool last_update_failed_; sync_primitives::Lock apps_search_in_progress_lock_; }; } // namespace policy diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 0d97ab69b8..d662a3b8b9 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -80,7 +80,7 @@ PolicyManagerImpl::PolicyManagerImpl() , send_on_update_sent_out_(false) , trigger_ptu_(false) , ptu_requested_(false) - , last_registered_policy_app_id_("") {} + , last_registered_policy_app_id_(std::string()) {} void PolicyManagerImpl::set_listener(PolicyListener* listener) { listener_ = listener; @@ -685,7 +685,7 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { } } -void PolicyManagerImpl::OnChangeApplicationCount(const uint32_t new_app_count) { +void PolicyManagerImpl::UpdatePTUReadyAppsCount(const uint32_t new_app_count) { LOG4CXX_AUTO_TRACE(logger_); applications_pending_ptu_count_ = new_app_count; } diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc index 6ca5318f96..88d953555f 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -44,7 +44,7 @@ UpdateStatusManager::UpdateStatusManager() , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) - , last_update_was_failed_(false) {} + , last_update_failed_(false) {} UpdateStatusManager::~UpdateStatusManager() {} @@ -98,7 +98,7 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { void UpdateStatusManager::OnResetRetrySequence() { LOG4CXX_AUTO_TRACE(logger_); - last_update_was_failed_ = true; + last_update_failed_ = true; ProcessEvent(kOnResetRetrySequence); } @@ -118,8 +118,8 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { return; } app_registered_from_non_consented_device_ = false; - if (last_update_was_failed_) { - last_update_was_failed_ = false; + if (last_update_failed_) { + last_update_failed_ = false; ProcessEvent(kUpdateForNextInQueue); } ProcessEvent(kOnNewAppRegistered); |