summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2024-02-02 02:19:54 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-02-02 02:19:54 +0000
commit6959a887b5a57c6aa9730e15d0b09554f9b26a9f (patch)
tree2045d9e14747aa44f854670cc4fa7c5cf322484a
parent191d41f5c8f251e98e8c75fe4fce6b0413f7748b (diff)
parentbce3918b3dfb67f25f927ff35d36c4d37f2d31ca (diff)
downloadlibhardware-6959a887b5a57c6aa9730e15d0b09554f9b26a9f.tar.gz
Merge "Use LLNDK guard instead of builtin_available" into main am: bce3918b3d
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2943126 Change-Id: I70f28f80245f4864fd05e611e9e0c80126221687 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--hardware.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/hardware.c b/hardware.c
index 79073312..94b5d5d3 100644
--- a/hardware.c
+++ b/hardware.c
@@ -179,20 +179,20 @@ static int hw_module_exists(char *path, size_t path_len, const char *name,
const char *subname)
{
#ifdef __ANDROID_APEX__
- // When used in APEX, it should look only into the same APEX because
+ // When used in VAPEX, it should look only into the same APEX because
// libhardware modules don't provide ABI stability.
- if (__builtin_available(android AAPEXSUPPORT_API, *)) {
- AApexInfo *apex_info;
- if (AApexInfo_create(&apex_info) == AAPEXINFO_OK) {
- snprintf(path, path_len, "/apex/%s/%s/%s.%s.so",
- AApexInfo_getName(apex_info), HAL_LIBRARY_SUBDIR, name, subname);
- AApexInfo_destroy(apex_info);
- if (access(path, R_OK) == 0)
- return 0;
- }
- } else {
- ALOGE("hw_module_exists: libapexsupport is not supported in %d.", __ANDROID_API__);
+#if __ANDROID_VENDOR_API__ >= 202404
+ AApexInfo *apex_info;
+ if (AApexInfo_create(&apex_info) == AAPEXINFO_OK) {
+ snprintf(path, path_len, "/apex/%s/%s/%s.%s.so",
+ AApexInfo_getName(apex_info), HAL_LIBRARY_SUBDIR, name, subname);
+ AApexInfo_destroy(apex_info);
+ if (access(path, R_OK) == 0)
+ return 0;
}
+#else // __ANDROID_VENDOR_API__
+ ALOGE("hw_module_exists: libapexsupport is not supported in %d.", __ANDROID_VENDOR_API__);
+#endif // __ANDROID_VENDOR_API__
#else // __ANDROID_APEX__
snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH3, name, subname);