Merge "Use "com.android.runtime" for its link namespace"

This commit is contained in:
Treehugger Robot 2020-02-11 19:00:40 +00:00 committed by Gerrit Code Review
commit 65cbad1ffa

View file

@ -293,12 +293,12 @@ void* LoadSharedLibrary(const char* shared_lib, const char* prefix, MallocDispat
// //
// The libraries are packaged in the runtime APEX together with libc.so. // The libraries are packaged in the runtime APEX together with libc.so.
// However, since the libc.so is searched via the symlink in the system // However, since the libc.so is searched via the symlink in the system
// partition (/system/lib/libc.so -> /apex/com.android.runtime/bionic.libc.so) // partition (/system/lib/libc.so -> /apex/com.android.runtime/bionic/libc.so)
// libc.so is loaded into the default namespace. If we just dlopen() here, the // libc.so is loaded into the default namespace. If we just dlopen() here, the
// linker will load the libs found in /system/lib which might be incompatible // linker will load the libs found in /system/lib which might be incompatible
// with libc.so in the runtime APEX. Use android_dlopen_ext to explicitly load // with libc.so in the runtime APEX. Use android_dlopen_ext to explicitly load
// the ones in the runtime APEX. // the ones in the runtime APEX.
struct android_namespace_t* runtime_ns = android_get_exported_namespace("runtime"); struct android_namespace_t* runtime_ns = android_get_exported_namespace("com.android.runtime");
if (runtime_ns != nullptr) { if (runtime_ns != nullptr) {
const android_dlextinfo dlextinfo = { const android_dlextinfo dlextinfo = {
.flags = ANDROID_DLEXT_USE_NAMESPACE, .flags = ANDROID_DLEXT_USE_NAMESPACE,