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

Commit 3892cfa4 authored by Cody Northrop's avatar Cody Northrop
Browse files

Update ANGLE namespace creation

Stop using a lambda function to create the namespace,
since not all C++11 features appear to be working.
This allows the Android emulator to support ANGLE.

Bug: 80239516
Test: atest CtsAngleIntegrationHostTestCases (on emulator)
Test: atest CtsAngleIntegrationHostTestCases (on real device)
Change-Id: Ibb8066fedff8935b4c0c18e73412315fc99a4174
parent 684ee529
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;