Send "success reboot" only after an update.
The <event> message sent to omaha after we reboot into a new version
was originally sent only on the first updatecheck after rebooting into
the new installed version, and included the old version number. A bug
introduced in 2013 removed the check for the empty previous version
making the update_engine send this message on *every* updatecheck. This
patch inserts back the check for the empty previous version to send the
"success reboot" event only after.
While there are still discussions about what's the right event message
to send on that case, this fixes the regression.
Bug: 24867646
Test: FEATURES=test emerge-link update_engine; second <updatecheck> didn't include the <event>
Change-Id: Icd00364aae15c8bf420f1f89ae7b526999b3a124
diff --git a/update_attempter.cc b/update_attempter.cc
index 1610ec4..09dd108 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -1083,6 +1083,12 @@
// Notify the PayloadState that the successful payload was canceled.
system_state_->payload_state()->ResetUpdateStatus();
+ // The previous version is used to report back to omaha after reboot that
+ // we actually rebooted into the new version from this "prev-version". We
+ // need to clear out this value now to prevent it being sent on the next
+ // updatecheck request.
+ ret_value = prefs_->SetString(kPrefsPreviousVersion, "") && ret_value;
+
LOG(INFO) << "Reset status " << (ret_value ? "successful" : "failed");
return ret_value;
}