Merge "Make libhardware host_supported" am: 65d6174bbc

Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2305002

Change-Id: If245768b5cfe2dc69b2abc744443d464e2728bce
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Devin Moore 2022-11-22 18:16:02 +00:00 committed by Automerger Merge Worker
commit 32acb4a0c2
2 changed files with 11 additions and 2 deletions

View file

@ -86,6 +86,7 @@ cc_library_shared {
header_libs: ["libhardware_headers"], header_libs: ["libhardware_headers"],
export_header_lib_headers: ["libhardware_headers"], export_header_lib_headers: ["libhardware_headers"],
host_supported: true,
recovery_available: true, recovery_available: true,
vendor_available: true, vendor_available: true,
vndk: { vndk: {
@ -93,6 +94,9 @@ cc_library_shared {
support_system_process: true, support_system_process: true,
}, },
target: { target: {
host: {
exclude_shared_libs: ["libvndksupport"],
},
recovery: { recovery: {
exclude_shared_libs: ["libvndksupport"], exclude_shared_libs: ["libvndksupport"],
}, },

View file

@ -30,7 +30,7 @@
#define LOG_TAG "HAL" #define LOG_TAG "HAL"
#include <log/log.h> #include <log/log.h>
#if !defined(__ANDROID_RECOVERY__) #if !defined(__ANDROID_RECOVERY__) && defined(__ANDROID__)
#include <vndksupport/linker.h> #include <vndksupport/linker.h>
#endif #endif
@ -97,7 +97,7 @@ static int load(const char *id,
*/ */
handle = dlopen(path, RTLD_NOW); handle = dlopen(path, RTLD_NOW);
} else { } else {
#if defined(__ANDROID_RECOVERY__) #if defined(__ANDROID_RECOVERY__) || !defined(__ANDROID__)
handle = dlopen(path, RTLD_NOW); handle = dlopen(path, RTLD_NOW);
#else #else
handle = android_load_sphal_library(path, RTLD_NOW); handle = android_load_sphal_library(path, RTLD_NOW);
@ -206,8 +206,13 @@ int hw_get_module_by_class(const char *class_id, const char *inst,
if (inst) if (inst)
snprintf(name, PATH_MAX, "%s.%s", class_id, inst); snprintf(name, PATH_MAX, "%s.%s", class_id, inst);
#if defined(__ANDROID__)
else else
strlcpy(name, class_id, PATH_MAX); strlcpy(name, class_id, PATH_MAX);
#else
else
snprintf(name, PATH_MAX, "%s", class_id);
#endif
/* /*
* Here we rely on the fact that calling dlopen multiple times on * Here we rely on the fact that calling dlopen multiple times on