Move hardware and boot_control implementation to libupdate_engine.

The implementations of the BootControlInterface and HardwareInterface
are specific to the platform and use case. The delta_generator uses the
DeltaPerformer in the libpayload_consumer to apply a payload to a set
of partitions defined as local files, for example.

This patch move the platform implementations, not available when
building for the host back to the libupdate_engine.

Bug: 24619596
TEST=mma

Change-Id: I16ab06c2e53dfd046e693bdb7310ec26a2d69054
diff --git a/Android.mk b/Android.mk
index db195d8..265ed23 100644
--- a/Android.mk
+++ b/Android.mk
@@ -125,14 +125,11 @@
     update_metadata-protos \
     libxz \
     libbz \
-    libfs_mgr \
     $(ue_update_metadata_protos_exported_static_libraries)
 ue_libpayload_consumer_exported_shared_libraries := \
     libcrypto \
     libcurl \
     libssl \
-    libhardware \
-    libcutils \
     $(ue_update_metadata_protos_exported_shared_libraries)
 
 include $(CLEAR_VARS)
@@ -157,12 +154,10 @@
     $(ue_update_metadata_protos_exported_shared_libraries)
 LOCAL_SRC_FILES := \
     common/action_processor.cc \
-    common/boot_control_android.cc \
     common/boot_control_stub.cc \
     common/certificate_checker.cc \
     common/clock.cc \
     common/constants.cc \
-    common/hardware_android.cc \
     common/hash_calculator.cc \
     common/http_common.cc \
     common/http_fetcher.cc \
@@ -246,10 +241,12 @@
     $(ue_libpayload_consumer_exported_shared_libraries) \
     $(ue_update_metadata_protos_exported_shared_libraries)
 LOCAL_SRC_FILES := \
+    boot_control_android.cc \
     chrome_browser_proxy_resolver.cc \
     connection_manager.cc \
     daemon.cc \
     dbus_service.cc \
+    hardware_android.cc \
     image_properties_android.cc \
     libcros_proxy.cc \
     metrics.cc \
diff --git a/common/boot_control_android.cc b/boot_control_android.cc
similarity index 98%
rename from common/boot_control_android.cc
rename to boot_control_android.cc
index a00fcf4..275d2aa 100644
--- a/common/boot_control_android.cc
+++ b/boot_control_android.cc
@@ -14,7 +14,7 @@
 // limitations under the License.
 //
 
-#include "update_engine/common/boot_control_android.h"
+#include "update_engine/boot_control_android.h"
 
 #include <base/bind.h>
 #include <base/files/file_util.h>
diff --git a/common/boot_control_android.h b/boot_control_android.h
similarity index 92%
rename from common/boot_control_android.h
rename to boot_control_android.h
index c857e04..a5a6255 100644
--- a/common/boot_control_android.h
+++ b/boot_control_android.h
@@ -14,8 +14,8 @@
 // limitations under the License.
 //
 
-#ifndef UPDATE_ENGINE_COMMON_BOOT_CONTROL_ANDROID_H_
-#define UPDATE_ENGINE_COMMON_BOOT_CONTROL_ANDROID_H_
+#ifndef UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
+#define UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
 
 #include <string>
 
@@ -58,4 +58,4 @@
 
 }  // namespace chromeos_update_engine
 
-#endif  // UPDATE_ENGINE_COMMON_BOOT_CONTROL_ANDROID_H_
+#endif  // UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
diff --git a/common/boot_control_chromeos.cc b/boot_control_chromeos.cc
similarity index 98%
rename from common/boot_control_chromeos.cc
rename to boot_control_chromeos.cc
index d053b68..fd248ab 100644
--- a/common/boot_control_chromeos.cc
+++ b/boot_control_chromeos.cc
@@ -14,7 +14,7 @@
 // limitations under the License.
 //
 
-#include "update_engine/common/boot_control_chromeos.h"
+#include "update_engine/boot_control_chromeos.h"
 
 #include <string>
 
diff --git a/common/boot_control_chromeos.h b/boot_control_chromeos.h
similarity index 94%
rename from common/boot_control_chromeos.h
rename to boot_control_chromeos.h
index be661e8..a1d57fe 100644
--- a/common/boot_control_chromeos.h
+++ b/boot_control_chromeos.h
@@ -14,8 +14,8 @@
 // limitations under the License.
 //
 
-#ifndef UPDATE_ENGINE_COMMON_BOOT_CONTROL_CHROMEOS_H_
-#define UPDATE_ENGINE_COMMON_BOOT_CONTROL_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
+#define UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
 
 #include <string>
 
@@ -82,4 +82,4 @@
 
 }  // namespace chromeos_update_engine
 
-#endif  // UPDATE_ENGINE_COMMON_BOOT_CONTROL_CHROMEOS_H_
+#endif  // UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
diff --git a/common/hardware_android.cc b/hardware_android.cc
similarity index 98%
rename from common/hardware_android.cc
rename to hardware_android.cc
index abfca44..a20fe6f 100644
--- a/common/hardware_android.cc
+++ b/hardware_android.cc
@@ -14,7 +14,7 @@
 // limitations under the License.
 //
 
-#include "update_engine/common/hardware_android.h"
+#include "update_engine/hardware_android.h"
 
 #include <base/files/file_util.h>
 #include <brillo/make_unique_ptr.h>
diff --git a/common/hardware_android.h b/hardware_android.h
similarity index 91%
rename from common/hardware_android.h
rename to hardware_android.h
index 071f7d5..1b03661 100644
--- a/common/hardware_android.h
+++ b/hardware_android.h
@@ -14,8 +14,8 @@
 // limitations under the License.
 //
 
-#ifndef UPDATE_ENGINE_COMMON_HARDWARE_ANDROID_H_
-#define UPDATE_ENGINE_COMMON_HARDWARE_ANDROID_H_
+#ifndef UPDATE_ENGINE_HARDWARE_ANDROID_H_
+#define UPDATE_ENGINE_HARDWARE_ANDROID_H_
 
 #include <string>
 
@@ -50,4 +50,4 @@
 
 }  // namespace chromeos_update_engine
 
-#endif  // UPDATE_ENGINE_COMMON_HARDWARE_ANDROID_H_
+#endif  // UPDATE_ENGINE_HARDWARE_ANDROID_H_
diff --git a/common/hardware_chromeos.cc b/hardware_chromeos.cc
similarity index 98%
rename from common/hardware_chromeos.cc
rename to hardware_chromeos.cc
index f93685d..ccb3978 100644
--- a/common/hardware_chromeos.cc
+++ b/hardware_chromeos.cc
@@ -14,7 +14,7 @@
 // limitations under the License.
 //
 
-#include "update_engine/common/hardware_chromeos.h"
+#include "update_engine/hardware_chromeos.h"
 
 #include <base/files/file_util.h>
 #include <base/logging.h>
diff --git a/common/hardware_chromeos.h b/hardware_chromeos.h
similarity index 91%
rename from common/hardware_chromeos.h
rename to hardware_chromeos.h
index 8ac17e8..80888ab 100644
--- a/common/hardware_chromeos.h
+++ b/hardware_chromeos.h
@@ -14,8 +14,8 @@
 // limitations under the License.
 //
 
-#ifndef UPDATE_ENGINE_COMMON_HARDWARE_CHROMEOS_H_
-#define UPDATE_ENGINE_COMMON_HARDWARE_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
+#define UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
 
 #include <string>
 #include <vector>
@@ -51,4 +51,4 @@
 
 }  // namespace chromeos_update_engine
 
-#endif  // UPDATE_ENGINE_COMMON_HARDWARE_CHROMEOS_H_
+#endif  // UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
diff --git a/update_engine.gyp b/update_engine.gyp
index c21edc2..2fa6ae8 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -146,19 +146,15 @@
         },
         'libraries': [
           '-lbz2',
-          '-lrootdev',
           '-lrt',
-          '-lvboot_host',
         ],
       },
       'sources': [
         'common/action_processor.cc',
-        'common/boot_control_chromeos.cc',
         'common/boot_control_stub.cc',
         'common/certificate_checker.cc',
         'common/clock.cc',
         'common/constants.cc',
-        'common/hardware_chromeos.cc',
         'common/hash_calculator.cc',
         'common/http_common.cc',
         'common/http_fetcher.cc',
@@ -242,10 +238,12 @@
         ],
       },
       'sources': [
+        'boot_control_chromeos.cc',
         'chrome_browser_proxy_resolver.cc',
         'connection_manager.cc',
         'daemon.cc',
         'dbus_service.cc',
+        'hardware_chromeos.cc',
         'image_properties_chromeos.cc',
         'libcros_proxy.cc',
         'metrics.cc',