diff options
author | 2024-02-03 03:56:59 +0900 | |
---|---|---|
committer | 2024-02-06 10:47:17 +0900 | |
commit | 75fc06f26b18631d9d079ffed7c73f68201a43c3 (patch) | |
tree | bbf3542b690b3f76026a1de8155792799e735dba /libs/ui/Gralloc5.cpp | |
parent | 0e8add7c20e83af68429ca7c76cec33b4820a5c0 (diff) |
binder: add openDeclaredPassthroughHal()
It handles dlopen()ing a declared native hal. This can replace
android_load_sphal_library to load declared native instance. The new API
also supports when instances are from APEX.
Bug: 316051788
Test: atest servicemanager_test
Test: atest vts_treble_vintf_vendor_test
Change-Id: I95b752253e0b550d38f0543ff56134d38d838855
Diffstat (limited to 'libs/ui/Gralloc5.cpp')
-rw-r--r-- | libs/ui/Gralloc5.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/ui/Gralloc5.cpp b/libs/ui/Gralloc5.cpp index c3b2d3d808..123bef4a4f 100644 --- a/libs/ui/Gralloc5.cpp +++ b/libs/ui/Gralloc5.cpp @@ -83,10 +83,18 @@ static void *loadIMapperLibrary() { return nullptr; } - std::string lib_name = "mapper." + mapperSuffix + ".so"; - void *so = android_load_sphal_library(lib_name.c_str(), RTLD_LOCAL | RTLD_NOW); + void* so = nullptr; + // TODO(b/322384429) switch this to __ANDROID_API_V__ when V is finalized + // TODO(b/302113279) use __ANDROID_VENDOR_API__ for vendor variant + if (__builtin_available(android __ANDROID_API_FUTURE__, *)) { + so = AServiceManager_openDeclaredPassthroughHal("mapper", mapperSuffix.c_str(), + RTLD_LOCAL | RTLD_NOW); + } else { + std::string lib_name = "mapper." + mapperSuffix + ".so"; + so = android_load_sphal_library(lib_name.c_str(), RTLD_LOCAL | RTLD_NOW); + } if (!so) { - ALOGE("Failed to load %s", lib_name.c_str()); + ALOGE("Failed to load mapper.%s.so", mapperSuffix.c_str()); } return so; }(); |