Refactor boot_control into a separate library.

This extracts the implementation of boot_control into a new library,
libboot_control. The bootctrl.default module now wraps this library.
This refactoring will allow us to re-use the same implementation in
HIDL.

Bug: 138861550
Test: mm bootctrl.default
Change-Id: Ic0558da3c2d8e6f5ebec63a497825c24b51623b7
diff --git a/boot_control/Android.bp b/boot_control/Android.bp
index 7720ead..0ebce85 100644
--- a/boot_control/Android.bp
+++ b/boot_control/Android.bp
@@ -14,13 +14,11 @@
 // limitations under the License.
 //
 
-cc_library_shared {
-    name: "bootctrl.default",
+cc_defaults {
+    name: "libboot_control_defaults",
     recovery_available: true,
     relative_install_path: "hw",
 
-    srcs: ["boot_control.cpp"],
-
     cflags: [
         "-D_FILE_OFFSET_BITS=64",
         "-Werror",
@@ -31,7 +29,31 @@
     shared_libs: [
         "libbase",
         "libbootloader_message",
-        "libfs_mgr",
         "liblog",
     ],
+    static_libs: [
+        "libfstab",
+    ],
+}
+
+cc_library_static {
+    name: "libboot_control",
+    defaults: ["libboot_control_defaults"],
+    export_include_dirs: ["include"],
+
+    srcs: ["libboot_control.cpp"],
+}
+
+cc_library_shared {
+    name: "bootctrl.default",
+    defaults: ["libboot_control_defaults"],
+
+    srcs: ["legacy_boot_control.cpp"],
+
+    static_libs: [
+        "libboot_control",
+    ],
+    shared_libs: [
+        "libhardware",
+    ],
 }