Don't send metrics on update_engine restart without reboot.
Certain operations are performed on update_engine start that are
intended to be performed only right after boot. For example, when
an update is applied, a few metrics are sent during the next reboot
when update_engine starts. If the update is applied and
update_engine crashes before reboot, the new update_engine will send
the metrics as if the machine was rebooted.
This patch avoids this problem checking the
SystemState::system_rebooted() method.
BUG=chromium:260990
TEST=unittests
Change-Id: Ib360b1886db38e3abd926455edfa1eb657b2d621
Reviewed-on: https://gerrit.chromium.org/gerrit/63227
Reviewed-by: Gilad Arnold <[email protected]>
Tested-by: Alex Deymo <[email protected]>
Commit-Queue: Alex Deymo <[email protected]>
diff --git a/payload_state.cc b/payload_state.cc
index c519b4f..f7c75da 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -1090,6 +1090,11 @@
}
void PayloadState::UpdateEngineStarted() {
+ // Avoid the UpdateEngineStarted actions if this is not the first time we
+ // run the update engine since reboot.
+ if (!system_state_->system_rebooted())
+ return;
+
// Figure out if we just booted into a new update
if (prefs_->Exists(kPrefsSystemUpdatedMarker)) {
int64_t stored_value;