Make Hardware class platform specific.
The Hardware class abstracts the interaction with the actual hardware
which is inherently platform-specific. This patch implementes a stub
version for Android and moves the Chromium OS implementation, handling
both with the same public factory method.
Bug: 23084776
TEST=emerge-link update_engine; `mma -i` builds the stubs.
Change-Id: I19c791a2e3fa22f0ac38bbe68a9c47838bcf019a
diff --git a/real_system_state.cc b/real_system_state.cc
index c89f297..7dfa012 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -21,6 +21,7 @@
#include "update_engine/boot_control_chromeos.h"
#include "update_engine/constants.h"
+#include "update_engine/hardware.h"
#include "update_engine/update_manager/state_factory.h"
#include "update_engine/utils.h"
@@ -44,6 +45,12 @@
LOG(ERROR) << "Ignoring BootControlChromeOS failure. We won't run updates.";
}
+ hardware_ = hardware::CreateHardware();
+ if (!hardware_) {
+ LOG(ERROR) << "Error intializing the HardwareInterface.";
+ return false;
+ }
+
if (!shill_proxy_.Init()) {
LOG(ERROR) << "Failed to initialize shill proxy.";
return false;