Loading libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,7 @@ struct android_namespace_t; namespace android { namespace android { class NativeLoaderNamespace; struct NativeLoaderNamespace; class GraphicsEnv { class GraphicsEnv { public: public: Loading opengl/libs/EGL/egl_layers.cpp +5 −4 Original line number Original line Diff line number Diff line Loading @@ -375,12 +375,13 @@ void LayerLoader::LoadLayers() { auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); if (app_namespace && !android::base::StartsWith(layer, kSystemLayerLibraryDir)) { if (app_namespace && !android::base::StartsWith(layer, kSystemLayerLibraryDir)) { bool native_bridge = false; bool native_bridge = false; std::string error_message; char* error_message = nullptr; handle = OpenNativeLibrary(app_namespace, layer.c_str(), &native_bridge, handle = OpenNativeLibraryInNamespace( &error_message); app_namespace, layer.c_str(), &native_bridge, &error_message); if (!handle) { if (!handle) { ALOGE("Failed to load layer %s with error: %s", layer.c_str(), ALOGE("Failed to load layer %s with error: %s", layer.c_str(), error_message.c_str()); error_message); android::NativeLoaderFreeErrorMessage(error_message); return; return; } } Loading vulkan/libvulkan/layers_extensions.cpp +7 −6 Original line number Original line Diff line number Diff line Loading @@ -139,12 +139,12 @@ bool LayerLibrary::Open() { auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); if (app_namespace && if (app_namespace && !android::base::StartsWith(path_, kSystemLayerLibraryDir)) { !android::base::StartsWith(path_, kSystemLayerLibraryDir)) { std::string error_msg; char* error_msg = nullptr; dlhandle_ = OpenNativeLibrary( dlhandle_ = OpenNativeLibraryInNamespace( app_namespace, path_.c_str(), &native_bridge_, &error_msg); app_namespace, path_.c_str(), &native_bridge_, &error_msg); if (!dlhandle_) { if (!dlhandle_) { ALOGE("failed to load layer library '%s': %s", path_.c_str(), ALOGE("failed to load layer library '%s': %s", path_.c_str(), error_msg); error_msg.c_str()); android::NativeLoaderFreeErrorMessage(error_msg); refcount_ = 0; refcount_ = 0; return false; return false; } } Loading @@ -165,9 +165,10 @@ void LayerLibrary::Close() { std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_); if (--refcount_ == 0) { if (--refcount_ == 0) { ALOGV("closing layer library '%s'", path_.c_str()); ALOGV("closing layer library '%s'", path_.c_str()); std::string error_msg; char* error_msg = nullptr; if (!android::CloseNativeLibrary(dlhandle_, native_bridge_, &error_msg)) { if (!android::CloseNativeLibrary(dlhandle_, native_bridge_, &error_msg)) { ALOGE("failed to unload library '%s': %s", path_.c_str(), error_msg.c_str()); ALOGE("failed to unload library '%s': %s", path_.c_str(), error_msg); android::NativeLoaderFreeErrorMessage(error_msg); refcount_++; refcount_++; } else { } else { dlhandle_ = nullptr; dlhandle_ = nullptr; Loading Loading
libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,7 @@ struct android_namespace_t; namespace android { namespace android { class NativeLoaderNamespace; struct NativeLoaderNamespace; class GraphicsEnv { class GraphicsEnv { public: public: Loading
opengl/libs/EGL/egl_layers.cpp +5 −4 Original line number Original line Diff line number Diff line Loading @@ -375,12 +375,13 @@ void LayerLoader::LoadLayers() { auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); if (app_namespace && !android::base::StartsWith(layer, kSystemLayerLibraryDir)) { if (app_namespace && !android::base::StartsWith(layer, kSystemLayerLibraryDir)) { bool native_bridge = false; bool native_bridge = false; std::string error_message; char* error_message = nullptr; handle = OpenNativeLibrary(app_namespace, layer.c_str(), &native_bridge, handle = OpenNativeLibraryInNamespace( &error_message); app_namespace, layer.c_str(), &native_bridge, &error_message); if (!handle) { if (!handle) { ALOGE("Failed to load layer %s with error: %s", layer.c_str(), ALOGE("Failed to load layer %s with error: %s", layer.c_str(), error_message.c_str()); error_message); android::NativeLoaderFreeErrorMessage(error_message); return; return; } } Loading
vulkan/libvulkan/layers_extensions.cpp +7 −6 Original line number Original line Diff line number Diff line Loading @@ -139,12 +139,12 @@ bool LayerLibrary::Open() { auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace(); if (app_namespace && if (app_namespace && !android::base::StartsWith(path_, kSystemLayerLibraryDir)) { !android::base::StartsWith(path_, kSystemLayerLibraryDir)) { std::string error_msg; char* error_msg = nullptr; dlhandle_ = OpenNativeLibrary( dlhandle_ = OpenNativeLibraryInNamespace( app_namespace, path_.c_str(), &native_bridge_, &error_msg); app_namespace, path_.c_str(), &native_bridge_, &error_msg); if (!dlhandle_) { if (!dlhandle_) { ALOGE("failed to load layer library '%s': %s", path_.c_str(), ALOGE("failed to load layer library '%s': %s", path_.c_str(), error_msg); error_msg.c_str()); android::NativeLoaderFreeErrorMessage(error_msg); refcount_ = 0; refcount_ = 0; return false; return false; } } Loading @@ -165,9 +165,10 @@ void LayerLibrary::Close() { std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_); if (--refcount_ == 0) { if (--refcount_ == 0) { ALOGV("closing layer library '%s'", path_.c_str()); ALOGV("closing layer library '%s'", path_.c_str()); std::string error_msg; char* error_msg = nullptr; if (!android::CloseNativeLibrary(dlhandle_, native_bridge_, &error_msg)) { if (!android::CloseNativeLibrary(dlhandle_, native_bridge_, &error_msg)) { ALOGE("failed to unload library '%s': %s", path_.c_str(), error_msg.c_str()); ALOGE("failed to unload library '%s': %s", path_.c_str(), error_msg); android::NativeLoaderFreeErrorMessage(error_msg); refcount_++; refcount_++; } else { } else { dlhandle_ = nullptr; dlhandle_ = nullptr; Loading