Compile libupdate_engine without DBus.
Test: mma with and without BRILLO_USE_DBUS=1
Test: adb shell /data/nativetest/update_engine_unittests/update_engine_unittests
Bug: 28800946
Change-Id: If3b05e7bc7a123d3d9b0dcc4597d915249a2de33
diff --git a/update_attempter.cc b/update_attempter.cc
index 11c736e..49f00a2 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -50,7 +50,9 @@
#include "update_engine/common/prefs_interface.h"
#include "update_engine/common/subprocess.h"
#include "update_engine/common/utils.h"
+#if USE_DBUS
#include "update_engine/dbus_connection.h"
+#endif // USE_DBUS
#include "update_engine/metrics.h"
#include "update_engine/omaha_request_action.h"
#include "update_engine/omaha_request_params.h"
@@ -163,10 +165,12 @@
chrome_proxy_resolver_.Init();
#endif // USE_LIBCROS
+#if USE_DBUS
// unittest can set this to a mock before calling Init().
if (!debugd_proxy_)
debugd_proxy_.reset(
new org::chromium::debugdProxy(DBusConnection::Get()->GetDBus()));
+#endif // USE_DBUS
}
void UpdateAttempter::ScheduleUpdates() {
@@ -1086,7 +1090,11 @@
channel, false /* powerwash_allowed */, &error_message)) {
brillo::Error::AddTo(error,
FROM_HERE,
+#if USE_DBUS
brillo::errors::dbus::kDomain,
+#else
+ "dbus",
+#endif // USE_DBUS
"set_target_error",
error_message);
return false;
@@ -1591,6 +1599,7 @@
return false;
}
+#if USE_DBUS
// Official images in devmode are allowed a custom update source iff the
// debugd dev tools are enabled.
if (!debugd_proxy_)
@@ -1605,6 +1614,7 @@
LOG(INFO) << "Debugd dev tools enabled; allowing any update source.";
return true;
}
+#endif // USE_DBUS
LOG(INFO) << "Debugd dev tools disabled; disallowing custom update sources.";
return false;
}