Skip to content

Commit

Permalink
Remove redundant UPDATE_NEEDED notifications and add this notificatio…
Browse files Browse the repository at this point in the history
…n in right place
  • Loading branch information
sniukalov authored and Yevhenii Dementieiev (GitHub) committed Feb 10, 2020
1 parent 6a2c298 commit ec86a40
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ class UpdateStatusManager {
UpdateEvent last_processed_event_;
bool apps_search_in_progress_;
bool app_registered_from_non_consented_device_;
bool last_update_was_failed_;
sync_primitives::Lock apps_search_in_progress_lock_;

class UpdateThreadDelegate : public threads::ThreadDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,7 @@ void PolicyManagerImpl::RetrySequenceFailed() {
StartPTExchange();
}
is_ptu_in_progress_ = false;
ptu_requested_ = false;
}

void PolicyManagerImpl::ResetTimeout() {
Expand Down
6 changes: 0 additions & 6 deletions src/components/policy/policy_external/src/status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ void policy::UpdateNeededStatus::ProcessEvent(
case kOnResetPolicyTableNoUpdate:
manager->SetNextStatus(std::make_shared<UpToDateStatus>());
break;
case kOnNewAppRegistered:
manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
break;
case kPendingUpdate:
manager->SetNextStatus(std::make_shared<UpdatePendingStatus>());
break;
Expand Down Expand Up @@ -127,9 +124,6 @@ void policy::UpdatingStatus::ProcessEvent(policy::UpdateStatusManager* manager,
case kOnResetPolicyTableNoUpdate:
manager->SetNextStatus(std::make_shared<UpToDateStatus>());
break;
case kOnNewAppRegistered:
manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
break;
case kOnWrongUpdateReceived:
case kOnUpdateTimeout:
manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ UpdateStatusManager::UpdateStatusManager()
, current_status_(std::make_shared<UpToDateStatus>())
, last_processed_event_(kNoEvent)
, apps_search_in_progress_(false)
, app_registered_from_non_consented_device_(true) {
, app_registered_from_non_consented_device_(true)
, last_update_was_failed_(false) {
update_status_thread_delegate_ = new UpdateThreadDelegate(this);
thread_ = threads::CreateThread("UpdateStatusThread",
update_status_thread_delegate_);
Expand Down Expand Up @@ -136,6 +137,7 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) {

void UpdateStatusManager::OnResetRetrySequence() {
LOG4CXX_AUTO_TRACE(logger_);
last_update_was_failed_ = true;
ProcessEvent(kOnResetRetrySequence);
}

Expand All @@ -157,6 +159,10 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
}
LOG4CXX_DEBUG(logger_, "Application registered from consented device");
app_registered_from_non_consented_device_ = false;
if (last_update_was_failed_) {
last_update_was_failed_ = false;
ProcessEvent(kUpdateForNextInQueue);
}
ProcessEvent(kOnNewAppRegistered);
}

Expand Down

0 comments on commit ec86a40

Please sign in to comment.