update_engine: Breaks the use of libcros into two dbus proxies.
This CL breaks USE_LIBCROS into two defines:
USE_CHROME_NETWORK_PROXY
USE_CHROME_KIOSK_APP
and changes all related build artifacts for both chrome and android.
Breaks USE_libcros into USE_chrome_network_proxy and USE_chrome_kiosk_app.
Removes BRILL_USE_LIBCROS.
Replaces __BRILLO__ with USE_OMAHA.
BUG=chromium:717306
TEST=Ran test 'cros_workon_make --board=amd64-generic --test update_engine'
for all four conditions of the newly introduced two flags.
Change-Id: I9ca5b35c22a17c45a861db6a434239096a896127
Reviewed-on: https://chromium-review.googlesource.com/596802
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Tested-by: Sen Jiang <senj@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/real_system_state.cc b/real_system_state.cc
index 5cbf723..b3ec06d 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -24,9 +24,9 @@
#include <base/time/time.h>
#include <brillo/make_unique_ptr.h>
#include <brillo/message_loops/message_loop.h>
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP || USE_CHROME_NETWORK_PROXY
#include <chromeos/dbus/service_constants.h>
-#endif // USE_LIBCROS
+#endif // USE_CHROME_KIOSK_APP || USE_CHROME_NETWORK_PROXY
#include "update_engine/common/boot_control.h"
#include "update_engine/common/boot_control_stub.h"
@@ -65,14 +65,16 @@
return false;
}
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
libcros_proxy_.reset(new org::chromium::LibCrosServiceInterfaceProxy(
DBusConnection::Get()->GetDBus(), chromeos::kLibCrosServiceName));
+#endif // USE_CHROME_KIOSK_APP
+#if USE_CHROME_NETWORK_PROXY
network_proxy_service_proxy_.reset(
new org::chromium::NetworkProxyServiceInterfaceProxy(
DBusConnection::Get()->GetDBus(),
chromeos::kNetworkProxyServiceName));
-#endif // USE_LIBCROS
+#endif // USE_CHROME_NETWORK_PROXY
LOG_IF(INFO, !hardware_->IsNormalBootMode()) << "Booted in dev mode.";
LOG_IF(INFO, !hardware_->IsOfficialBuild()) << "Booted non-official build.";
@@ -143,27 +145,28 @@
new CertificateChecker(prefs_.get(), &openssl_wrapper_));
certificate_checker_->Init();
-#if USE_LIBCROS
- org::chromium::NetworkProxyServiceInterfaceProxyInterface* net_proxy =
- network_proxy_service_proxy_.get();
- org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy =
- libcros_proxy_.get();
+ update_attempter_.reset(
+ new UpdateAttempter(this,
+ certificate_checker_.get(),
+#if USE_CHROME_NETWORK_PROXY
+ network_proxy_service_proxy_.get()));
#else
- org::chromium::NetworkProxyServiceInterfaceProxyInterface* net_proxy =
- nullptr;
- org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy =
- nullptr;
-#endif // USE_LIBCROS
+ nullptr)));
+#endif // USE_CHROME_NETWORK_PROXY
// Initialize the UpdateAttempter before the UpdateManager.
- update_attempter_.reset(new UpdateAttempter(this, certificate_checker_.get(),
- net_proxy));
update_attempter_->Init();
// Initialize the Update Manager using the default state factory.
chromeos_update_manager::State* um_state =
- chromeos_update_manager::DefaultStateFactory(
- &policy_provider_, libcros_proxy, this);
+ chromeos_update_manager::DefaultStateFactory(&policy_provider_,
+#if USE_CHROME_KIOSK_APP
+ libcros_proxy_.get(),
+#else
+ nullptr,
+#endif // USE_CHROME_KIOSK_APP
+ this);
+
if (!um_state) {
LOG(ERROR) << "Failed to initialize the Update Manager.";
return false;