AU: Announce the update engine status on startup.
This is to ensure that the system is in a consistent state in case update-engine
crashes.
BUG=chromium-os:15069
TEST=press "Check for update" in Chrome, restart update-engine while downloading
an update, see the status go back to 'up to date' (rather than get stuck in
'Downloading')
Change-Id: I1e89502a9fa134ec3a81e50a9036ce20b46eb9b0
Reviewed-on: http://gerrit.chromium.org/gerrit/1144
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 474f24c..e0e3b60 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -510,13 +510,10 @@
reinterpret_cast<UpdateAttempter*>(p)->CompleteUpdateBootFlags(return_code);
}
-void UpdateAttempter::SetStatusAndNotify(UpdateStatus status) {
- status_ = status;
- if (update_check_scheduler_) {
- update_check_scheduler_->SetUpdateStatus(status_);
- }
- if (!dbus_service_)
+void UpdateAttempter::BroadcastStatus() {
+ if (!dbus_service_) {
return;
+ }
last_notify_time_ = TimeTicks::Now();
update_engine_service_emit_status_update(
dbus_service_,
@@ -527,6 +524,14 @@
new_size_);
}
+void UpdateAttempter::SetStatusAndNotify(UpdateStatus status) {
+ status_ = status;
+ if (update_check_scheduler_) {
+ update_check_scheduler_->SetUpdateStatus(status_);
+ }
+ BroadcastStatus();
+}
+
void UpdateAttempter::CreatePendingErrorEvent(AbstractAction* action,
ActionExitCode code) {
if (error_event_.get()) {