New BootControlInterface implementation for Android.
This patch hides the platform-specific construction of a
BootControlInterface in a factory method shared by both Android and
Chromium OS. This also include a stub implementation for Android.
Bug: 23754584,23084776
TEST=emerge-link update_engine; `mma -i` builds these files without problem.
Change-Id: I43532e5cff1dc474453160f418ddd3c448f31938
diff --git a/boot_control_chromeos.cc b/boot_control_chromeos.cc
index ad82401..03e1c26 100644
--- a/boot_control_chromeos.cc
+++ b/boot_control_chromeos.cc
@@ -21,12 +21,14 @@
#include <base/files/file_path.h>
#include <base/files/file_util.h>
#include <base/strings/string_util.h>
+#include <chromeos/make_unique_ptr.h>
#include <rootdev/rootdev.h>
extern "C" {
#include <vboot/vboot_host.h>
}
+#include "update_engine/boot_control.h"
#include "update_engine/utils.h"
using std::string;
@@ -59,6 +61,20 @@
namespace chromeos_update_engine {
+namespace boot_control {
+
+// Factory defined in boot_control.h.
+std::unique_ptr<BootControlInterface> CreateBootControl() {
+ std::unique_ptr<BootControlChromeOS> boot_control_chromeos(
+ new BootControlChromeOS());
+ if (!boot_control_chromeos->Init()) {
+ LOG(ERROR) << "Ignoring BootControlChromeOS failure. We won't run updates.";
+ }
+ return chromeos::make_unique_ptr(boot_control_chromeos.release());
+}
+
+} // namespace boot_control
+
bool BootControlChromeOS::Init() {
string boot_device = GetBootDevice();
if (boot_device.empty())