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

Commit 52ee6754 authored by Nicolas Geoffray's avatar Nicolas Geoffray Committed by android-build-merger
Browse files

Merge "Pass the Java caller's location to OpenNativeLibrary."

am: ad6a5c56

Change-Id: I98285f658fe9ccef8c7b58051bac54bf1869eb6d
parents 19bb1540 ad6a5c56
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -109,19 +109,6 @@ extern bool android_link_namespaces(struct android_namespace_t* from,
                                    struct android_namespace_t* to,
                                    const char* shared_libs_sonames);

/*
 * Get the default library search path.
 * The path will be copied into buffer, which must have space for at least
 * buffer_size chars. Elements are separated with ':', and the path will always
 * be null-terminated.
 *
 * If buffer_size is too small to hold the entire default search path and the
 * null terminator, this function will abort. There is currently no way to find
 * out what the required buffer size is. At the time of this writing, PATH_MAX
 * is sufficient and used by all callers of this function.
 */
extern void android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size);

extern struct android_namespace_t* android_get_exported_namespace(const char* name);

__END_DECLS
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ jstring CreateClassLoaderNamespace(JNIEnv* env,

__attribute__((visibility("default"))) void* OpenNativeLibrary(
    JNIEnv* env, int32_t target_sdk_version, const char* path, jobject class_loader,
    jstring library_path, bool* needs_native_bridge, char** error_msg);
    const char* caller_location, jstring library_path, bool* needs_native_bridge, char** error_msg);

__attribute__((visibility("default"))) bool CloseNativeLibrary(void* handle,
                                                               const bool needs_native_bridge,
+4 −3
Original line number Diff line number Diff line
@@ -624,10 +624,11 @@ jstring CreateClassLoaderNamespace(JNIEnv* env,
}

void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* path,
                        jobject class_loader, jstring library_path, bool* needs_native_bridge,
                        char** error_msg) {
                        jobject class_loader, const char* caller_location, jstring library_path,
                        bool* needs_native_bridge, char** error_msg) {
#if defined(__ANDROID__)
  UNUSED(target_sdk_version);
  UNUSED(caller_location);
  if (class_loader == nullptr) {
    *needs_native_bridge = false;
    void* handle = dlopen(path, RTLD_NOW);
@@ -654,7 +655,7 @@ void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* pat

  return OpenNativeLibraryInNamespace(ns, path, needs_native_bridge, error_msg);
#else
  UNUSED(env, target_sdk_version, class_loader);
  UNUSED(env, target_sdk_version, class_loader, caller_location);

  // Do some best effort to emulate library-path support. It will not
  // work for dependencies.