update_engine: Switch to chrome-dbus for client requests in update_engine
update_engine daemon acts as DBus client to send DBus calls to shill,
power_manager and chrome, and to listen for signals from shill, chrome
and login_manager. This patch migrates these calls and signals to use
chrome-dbus framework instead of dbus-glib.
All references to dbus-glib code are removed.
BUG=chromium:419827
TEST=Updated unittest. Deployed on a link device and tested interactions with shill and chromium.
Change-Id: I31b389e0d1690cccb115ff3b6539c876ba81bd0e
Reviewed-on: https://chromium-review.googlesource.com/290990
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
diff --git a/real_system_state.cc b/real_system_state.cc
index f16f2f8..861a702 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -6,6 +6,7 @@
#include <base/files/file_util.h>
#include <base/time/time.h>
+#include <chromeos/dbus/service_constants.h>
#include "update_engine/constants.h"
#include "update_engine/update_manager/state_factory.h"
@@ -13,16 +14,22 @@
namespace chromeos_update_engine {
-RealSystemState::RealSystemState()
- : device_policy_(nullptr),
- connection_manager_(this),
- update_attempter_(this, &dbus_),
- request_params_(this),
- system_rebooted_(false) {}
+RealSystemState::RealSystemState(const scoped_refptr<dbus::Bus>& bus)
+ : debugd_proxy_(bus, debugd::kDebugdServiceName),
+ power_manager_proxy_(bus, power_manager::kPowerManagerServiceName),
+ session_manager_proxy_(bus, login_manager::kSessionManagerServiceName),
+ shill_proxy_(bus),
+ libcros_proxy_(bus) {
+}
bool RealSystemState::Initialize() {
metrics_lib_.Init();
+ if (!shill_proxy_.Init()) {
+ LOG(ERROR) << "Failed to initialize shill proxy.";
+ return false;
+ }
+
if (!prefs_.Init(base::FilePath(kPrefsDirectory))) {
LOG(ERROR) << "Failed to initialize preferences.";
return false;
@@ -44,7 +51,7 @@
// Initialize the Update Manager using the default state factory.
chromeos_update_manager::State* um_state =
chromeos_update_manager::DefaultStateFactory(
- &policy_provider_, &dbus_, this);
+ &policy_provider_, &shill_proxy_, &session_manager_proxy_, this);
if (!um_state) {
LOG(ERROR) << "Failed to initialize the Update Manager.";
return false;