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

Commit 7d266d60 authored by Nicolas Geoffray's avatar Nicolas Geoffray Committed by android-build-merger
Browse files

Merge "Move to C API of libnativeloader." am: c9a388a1

am: 7f0a185f

Change-Id: I4ff8270af27825d2ecd9c23e272c7f717b167627
parents f3fd643d 7f0a185f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ struct android_namespace_t;

namespace android {

class NativeLoaderNamespace;
struct NativeLoaderNamespace;

class GraphicsEnv {
public:
+7 −6
Original line number Diff line number Diff line
@@ -139,12 +139,12 @@ bool LayerLibrary::Open() {
        auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace();
        if (app_namespace &&
            !android::base::StartsWith(path_, kSystemLayerLibraryDir)) {
            std::string error_msg;
            dlhandle_ = OpenNativeLibrary(
            char* error_msg = nullptr;
            dlhandle_ = OpenNativeLibraryInNamespace(
                app_namespace, path_.c_str(), &native_bridge_, &error_msg);
            if (!dlhandle_) {
                ALOGE("failed to load layer library '%s': %s", path_.c_str(),
                      error_msg.c_str());
                ALOGE("failed to load layer library '%s': %s", path_.c_str(), error_msg);
                android::NativeLoaderFreeErrorMessage(error_msg);
                refcount_ = 0;
                return false;
            }
@@ -165,9 +165,10 @@ void LayerLibrary::Close() {
    std::lock_guard<std::mutex> lock(mutex_);
    if (--refcount_ == 0) {
        ALOGV("closing layer library '%s'", path_.c_str());
        std::string error_msg;
        char* error_msg = nullptr;
        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_++;
        } else {
           dlhandle_ = nullptr;