Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30e791fa authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "libvndksupport: do not use functions from android/dlext.h" am: 865f9c2f am: 9dbbfdc1

am: 13e202c5

Change-Id: Ibd768abc912c943118e044dc425cc2c3d943fcfb
parents 41dee1e2 13e202c5
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@
#define LOG_TAG "vndksupport"
#include <log/log.h>

extern struct android_namespace_t* android_get_exported_namespace(const char*);
__attribute__((weak)) extern struct android_namespace_t* android_get_exported_namespace(const char*);
__attribute__((weak)) extern void* android_dlopen_ext(const char*, int, const android_dlextinfo*);

static const char* namespace_name = NULL;

@@ -31,7 +32,9 @@ static struct android_namespace_t* get_vendor_namespace() {
    if (vendor_namespace == NULL) {
        int name_idx = 0;
        while (namespace_names[name_idx] != NULL) {
            if (android_get_exported_namespace != NULL) {
                vendor_namespace = android_get_exported_namespace(namespace_names[name_idx]);
            }
            if (vendor_namespace != NULL) {
                namespace_name = namespace_names[name_idx];
                break;
@@ -48,7 +51,10 @@ void* android_load_sphal_library(const char* name, int flag) {
        const android_dlextinfo dlextinfo = {
            .flags = ANDROID_DLEXT_USE_NAMESPACE, .library_namespace = vendor_namespace,
        };
        void* handle = android_dlopen_ext(name, flag, &dlextinfo);
        void* handle = NULL;
        if (android_dlopen_ext != NULL) {
            handle = android_dlopen_ext(name, flag, &dlextinfo);
        }
        if (!handle) {
            ALOGE("Could not load %s from %s namespace: %s.", name, namespace_name, dlerror());
        }