From 551e1f7bd9fbf99d45be20b7c01b5ff995bbd3b7 Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Wed, 20 Jun 2018 17:04:52 -0700 Subject: [PATCH] Allow libhardware to be used in recovery The default boot ctrl implementation depends on libhardware. Bug: 78793464 Test: Compiles, can load bootctrl in recovery Change-Id: I9c8aa8b00b9b81f11736de13c85973e113056e69 --- Android.bp | 16 ++++++++++++++++ hardware.c | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/Android.bp b/Android.bp index 4766b71d..ce4214eb 100644 --- a/Android.bp +++ b/Android.bp @@ -16,7 +16,17 @@ cc_library_headers { ], export_include_dirs: ["include"], + recovery_available: true, vendor_available: true, + target: { + recovery: { + exclude_header_libs: [ + "libaudio_system_headers", + "libbluetooth-types-header", + ], + }, + }, + } cc_library_shared { @@ -38,9 +48,15 @@ cc_library_shared { header_libs: ["libhardware_headers"], export_header_lib_headers: ["libhardware_headers"], + recovery_available: true, vendor_available: true, vndk: { enabled: true, support_system_process: true, }, + target: { + recovery: { + exclude_shared_libs: ["libvndksupport"], + }, + }, } diff --git a/hardware.c b/hardware.c index bd55087b..40ae1d13 100644 --- a/hardware.c +++ b/hardware.c @@ -29,7 +29,9 @@ #define LOG_TAG "HAL" #include +#if !defined(__ANDROID_RECOVERY__) #include +#endif /** Base path of the hal modules */ #if defined(__LP64__) @@ -94,7 +96,11 @@ static int load(const char *id, */ handle = dlopen(path, RTLD_NOW); } else { +#if defined(__ANDROID_RECOVERY__) + handle = dlopen(path, RTLD_NOW); +#else handle = android_load_sphal_library(path, RTLD_NOW); +#endif } if (handle == NULL) { char const *err_str = dlerror();