Merge "`recovery` uses more shared libraries."
am: 3c5e2c1c7e

Change-Id: If4070036031ba754c2686ff6dc6d52f7cebd4044
diff --git a/Android.bp b/Android.bp
index 22c90bd..97126f5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -16,6 +16,11 @@
     name: "recovery_defaults",
 
     cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+
+        // Must be the same as RECOVERY_API_VERSION.
+        "-DRECOVERY_API_VERSION=3",
+
         "-Wall",
         "-Werror",
     ],
@@ -24,6 +29,7 @@
 // Generic device that uses ScreenRecoveryUI.
 cc_library_static {
     name: "librecovery_ui_default",
+    recovery_available: true,
 
     defaults: [
         "recovery_defaults",
@@ -37,6 +43,7 @@
 // The default wear device that uses WearRecoveryUI.
 cc_library_static {
     name: "librecovery_ui_wear",
+    recovery_available: true,
 
     defaults: [
         "recovery_defaults",
@@ -50,6 +57,7 @@
 // The default VR device that uses VrRecoveryUI.
 cc_library_static {
     name: "librecovery_ui_vr",
+    recovery_available: true,
 
     defaults: [
         "recovery_defaults",
@@ -62,6 +70,7 @@
 
 cc_library_static {
     name: "libverifier",
+    recovery_available: true,
 
     defaults: [
         "recovery_defaults",
@@ -72,10 +81,13 @@
         "verifier.cpp",
     ],
 
-    static_libs: [
+    shared_libs: [
         "libbase",
         "libcrypto",
         "libcrypto_utils",
+    ],
+
+    static_libs: [
         "libotautil",
     ],
 }
diff --git a/Android.mk b/Android.mk
index b25c1f0..3c34099 100644
--- a/Android.mk
+++ b/Android.mk
@@ -125,31 +125,32 @@
     libbatterymonitor
 
 librecovery_static_libraries := \
-    libbootloader_message \
     libfusesideload \
     libminadbd \
     libminui \
     libverifier \
     libotautil \
     $(health_hal_static_libraries) \
-    libasyncio \
-    libcrypto_utils \
-    libcrypto \
-    libext4_utils \
-    libfs_mgr \
-    libpng \
-    libsparse \
     libvintf_recovery \
     libvintf \
-    libhidl-gen-utils \
-    libtinyxml2 \
-    libziparchive \
+
+librecovery_shared_libraries := \
+    libasyncio \
     libbase \
-    libutils \
+    libbootloader_message \
+    libcrypto \
+    libcrypto_utils \
     libcutils \
+    libext4_utils \
+    libfs_mgr \
+    libhidl-gen-utils \
     liblog \
+    libpng \
     libselinux \
+    libtinyxml2 \
+    libutils \
     libz \
+    libziparchive \
 
 # librecovery (static library)
 # ===============================
@@ -173,6 +174,9 @@
 LOCAL_STATIC_LIBRARIES := \
     $(librecovery_static_libraries)
 
+LOCAL_SHARED_LIBRARIES := \
+    $(librecovery_shared_libraries)
+
 include $(BUILD_STATIC_LIBRARY)
 
 # recovery (static executable)
@@ -200,6 +204,7 @@
 
 LOCAL_SHARED_LIBRARIES := \
     librecovery_ui \
+    $(librecovery_shared_libraries)
 
 LOCAL_HAL_STATIC_LIBRARIES := libhealthd
 
@@ -219,7 +224,8 @@
 # e2fsck is needed for adb remount -R.
 ifeq ($(BOARD_EXT4_SHARE_DUP_BLOCKS),true)
 ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-LOCAL_REQUIRED_MODULES += e2fsck_static
+LOCAL_REQUIRED_MODULES += \
+    e2fsck_static
 endif
 endif
 
@@ -235,10 +241,23 @@
 # TODO(b/110380063): Explicitly install the following shared libraries to recovery, until `recovery`
 # module is built with Soong (with `recovery: true` flag).
 LOCAL_REQUIRED_MODULES += \
+    libasyncio.recovery \
     libbase.recovery \
+    libbootloader_message.recovery \
+    libcrypto.recovery \
+    libcrypto_utils.recovery \
+    libcutils.recovery \
+    libext4_utils.recovery \
+    libfs_mgr.recovery \
+    libhidl-gen-utils.recovery \
     liblog.recovery \
     libpng.recovery \
+    libselinux.recovery \
+    libsparse.recovery \
+    libtinyxml2.recovery \
+    libutils.recovery \
     libz.recovery \
+    libziparchive.recovery \
 
 include $(BUILD_EXECUTABLE)
 
diff --git a/fuse_sideload/Android.bp b/fuse_sideload/Android.bp
index 76bc16d..b7f9c03 100644
--- a/fuse_sideload/Android.bp
+++ b/fuse_sideload/Android.bp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-cc_library_static {
+cc_library {
     name: "libfusesideload",
 
     cflags: [
diff --git a/minui/Android.bp b/minui/Android.bp
index 31022e1..fff3a8e 100644
--- a/minui/Android.bp
+++ b/minui/Android.bp
@@ -14,6 +14,7 @@
 
 cc_library {
     name: "libminui",
+    recovery_available: true,
 
     defaults: [
         "recovery_defaults",
diff --git a/otautil/Android.bp b/otautil/Android.bp
index b058f7b..56c7c9e 100644
--- a/otautil/Android.bp
+++ b/otautil/Android.bp
@@ -16,6 +16,11 @@
     name: "libotautil",
 
     host_supported: true,
+    recovery_available: true,
+
+    defaults: [
+        "recovery_defaults",
+    ],
 
     // Minimal set of files to support host build.
     srcs: [
@@ -23,16 +28,10 @@
         "rangeset.cpp",
     ],
 
-    static_libs: [
+    shared_libs: [
         "libbase",
     ],
 
-    cflags: [
-        "-D_FILE_OFFSET_BITS=64",
-        "-Werror",
-        "-Wall",
-    ],
-
     export_include_dirs: [
         "include",
     ],
@@ -46,9 +45,9 @@
                 "thermalutil.cpp",
             ],
 
-            static_libs: [
-                "libselinux",
+            shared_libs: [
                 "libcutils",
+                "libselinux",
             ],
         },
     },