Build `recovery` with Soong.

Fixes: 110380063
Test: `mmma -j bootable/recovery` with aosp_taimen-userdebug
Test: Build and boot into recovery on taimen. Check the basic
      functionalities (`Apply update from ADB`, `View recovery logs`,
      `Run graphics test`).
Test: Run recovery_unit_test and recovery_component_test on marlin.
Test: Modify `recovery.cpp` locally to trigger the call to
      is_battery_ok(). Check that the battery info is reported
      correctly.
Test: `build/soong/build_test.bash --dist`
Change-Id: I391eb201d57c760e457ba2bf2410ceb72596795c
diff --git a/Android.bp b/Android.bp
index 97126f5..99e8b65 100644
--- a/Android.bp
+++ b/Android.bp
@@ -26,6 +26,34 @@
     ],
 }
 
+cc_library {
+    name: "librecovery_ui",
+    recovery_available: true,
+
+    defaults: [
+        "recovery_defaults",
+    ],
+
+    srcs: [
+        "device.cpp",
+        "screen_ui.cpp",
+        "ui.cpp",
+        "vr_ui.cpp",
+        "wear_ui.cpp"
+    ],
+
+    static_libs: [
+        "libminui",
+        "libotautil",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libpng",
+        "libz",
+    ],
+}
+
 // Generic device that uses ScreenRecoveryUI.
 cc_library_static {
     name: "librecovery_ui_default",
@@ -68,6 +96,78 @@
     ],
 }
 
+cc_defaults {
+    name: "librecovery_defaults",
+
+    defaults: [
+        "recovery_defaults",
+    ],
+
+    shared_libs: [
+        "libasyncio",
+        "libbase",
+        "libbootloader_message",
+        "libcrypto",
+        "libcrypto_utils",
+        "libcutils",
+        "libext4_utils",
+        "libfs_mgr",
+        "libfusesideload",
+        "libhidl-gen-utils",
+        "liblog",
+        "libpng",
+        "libselinux",
+        "libsparse",
+        "libtinyxml2",
+        "libutils",
+        "libz",
+        "libziparchive",
+    ],
+
+    static_libs: [
+        "libminadbd",
+        "libminui",
+        "libverifier",
+        "libotautil",
+        "libvintf_recovery",
+        "libvintf",
+
+        // TODO(b/80132328): Remove the dependency on static health HAL.
+        "libhealthd.default",
+        "android.hardware.health@2.0-impl",
+        "android.hardware.health@2.0",
+        "android.hardware.health@1.0",
+        "android.hardware.health@1.0-convert",
+        "libhealthstoragedefault",
+        "libhidltransport",
+        "libhidlbase",
+        "libhwbinder_noltopgo",
+        "libbatterymonitor",
+    ],
+}
+
+cc_library_static {
+    name: "librecovery",
+    recovery_available: true,
+
+    defaults: [
+        "librecovery_defaults",
+    ],
+
+    srcs: [
+        "adb_install.cpp",
+        "fsck_unshare_blocks.cpp",
+        "fuse_sdcard_provider.cpp",
+        "install.cpp",
+        "recovery.cpp",
+        "roots.cpp",
+    ],
+
+    include_dirs: [
+        "system/vold",
+    ],
+}
+
 cc_library_static {
     name: "libverifier",
     recovery_available: true,
@@ -92,6 +192,37 @@
     ],
 }
 
+cc_binary {
+    name: "recovery",
+    recovery: true,
+
+    defaults: [
+        "librecovery_defaults",
+    ],
+
+    srcs: [
+        "logging.cpp",
+        "recovery_main.cpp",
+    ],
+
+    shared_libs: [
+        "librecovery_ui",
+    ],
+
+    static_libs: [
+        "librecovery",
+        "librecovery_ui_default",
+    ],
+
+    required: [
+        "e2fsdroid.recovery",
+        "librecovery_ui_ext",
+        "mke2fs.conf",
+        "mke2fs.recovery",
+        "recovery_deps",
+    ],
+}
+
 // The dynamic executable that runs after /data mounts.
 cc_binary {
     name: "recovery-persist",