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

Commit 4701f467 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update ANGLE namespace creation"

parents 131d815b 3892cfa4
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include <sys/prctl.h>

#include <memory>
#include <mutex>
#include <string>

#include <dlfcn.h>
@@ -406,9 +405,16 @@ android_namespace_t* GraphicsEnv::getDriverNamespace() {
}

android_namespace_t* GraphicsEnv::getAngleNamespace() {
    static std::once_flag once;
    std::call_once(once, [this]() {
        if (mAnglePath.empty()) return;
    std::lock_guard<std::mutex> lock(mNamespaceMutex);

    if (mAngleNamespace) {
        return mAngleNamespace;
    }

    if (mAnglePath.empty()) {
        ALOGV("mAnglePath is empty, not creating ANGLE namespace");
        return nullptr;
    }

    mAngleNamespace = android_create_namespace("ANGLE",
                                               nullptr,            // ld_library_path
@@ -417,8 +423,8 @@ android_namespace_t* GraphicsEnv::getAngleNamespace() {
                                                       ANDROID_NAMESPACE_TYPE_ISOLATED,
                                               nullptr, // permitted_when_isolated_path
                                               nullptr);
        if (!mAngleNamespace) ALOGD("Could not create ANGLE namespace from default");
    });

    ALOGD_IF(!mAngleNamespace, "Could not create ANGLE namespace from default");

    return mAngleNamespace;
}
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#ifndef ANDROID_UI_GRAPHICS_ENV_H
#define ANDROID_UI_GRAPHICS_ENV_H 1

#include <mutex>
#include <string>
#include <vector>

@@ -77,6 +78,7 @@ private:
    std::string mDebugLayers;
    std::string mDebugLayersGLES;
    std::string mLayerPaths;
    std::mutex mNamespaceMutex;
    android_namespace_t* mDriverNamespace = nullptr;
    android_namespace_t* mAngleNamespace = nullptr;
    NativeLoaderNamespace* mAppNamespace = nullptr;