update_engine: Move DaemonStateInterface implementation to UpdateAttempter
It seems like UpdateAttempter is the best option for implementation of
DaemonStateInterface. SystemState should only be doing state keeping not
doing these startup logics.
BUG=b:171829801
TEST=unittests
TEST=CQ passes
Change-Id: I47ec50107ffbeb544e061f39c900a1559f2cdcab
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2519843
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/cros/daemon_chromeos.cc b/cros/daemon_chromeos.cc
index a7cad8c..1e0e6d6 100644
--- a/cros/daemon_chromeos.cc
+++ b/cros/daemon_chromeos.cc
@@ -46,13 +46,13 @@
// avoiding the explicit re-usage of the |bus| instance, shared between
// D-Bus service and D-Bus client calls.
RealSystemState* real_system_state = new RealSystemState();
- daemon_state_.reset(real_system_state);
LOG_IF(ERROR, !real_system_state->Initialize())
<< "Failed to initialize system state.";
+ system_state_.reset(real_system_state);
// Create the DBus service.
dbus_adaptor_.reset(new UpdateEngineAdaptor(real_system_state));
- daemon_state_->AddObserver(dbus_adaptor_.get());
+ system_state_->update_attempter()->AddObserver(dbus_adaptor_.get());
dbus_adaptor_->RegisterAsync(
base::Bind(&DaemonChromeOS::OnDBusRegistered, base::Unretained(this)));
@@ -76,7 +76,7 @@
QuitWithExitCode(1);
return;
}
- daemon_state_->StartUpdater();
+ system_state_->update_attempter()->StartUpdater();
}
} // namespace chromeos_update_engine