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

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

Merge "Allow specifying ANGLE in manifest via meta-data"

parents bb24b00f 49d51992
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ void GraphicsEnv::setDriverPath(const std::string path) {
}

void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName,
                               bool developerOptIn) {
                               const std::string appPref, bool developerOptIn) {
    if (!mAnglePath.empty()) {
        ALOGV("ignoring attempt to change ANGLE path from '%s' to '%s'", mAnglePath.c_str(),
              path.c_str());
@@ -74,6 +74,14 @@ void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName
        mAngleAppName = appName;
    }

    if (!mAngleAppPref.empty()) {
        ALOGV("ignoring attempt to change ANGLE application opt-in from '%s' to '%s'",
              mAngleAppPref.c_str(), appPref.c_str());
    } else {
        ALOGV("setting ANGLE application opt-in to '%s'", appPref.c_str());
        mAngleAppPref = appPref;
    }

    mAngleDeveloperOptIn = developerOptIn;
}

@@ -100,6 +108,11 @@ bool GraphicsEnv::getAngleDeveloperOptIn() {
    return mAngleDeveloperOptIn;
}

const char* GraphicsEnv::getAngleAppPref() {
    if (mAngleAppPref.empty()) return nullptr;
    return mAngleAppPref.c_str();
}

const std::string GraphicsEnv::getLayerPaths(){
    return mLayerPaths;
}
@@ -165,4 +178,7 @@ const char* android_getAngleAppName() {
bool android_getAngleDeveloperOptIn() {
    return android::GraphicsEnv::getInstance().getAngleDeveloperOptIn();
}
const char* android_getAngleAppPref() {
    return android::GraphicsEnv::getInstance().getAngleAppPref();
}
}
+5 −1
Original line number Diff line number Diff line
@@ -42,9 +42,11 @@ public:
    // (libraries must be stored uncompressed and page aligned); such elements
    // in the search path must have a '!' after the zip filename, e.g.
    //     /system/app/ANGLEPrebuilt/ANGLEPrebuilt.apk!/lib/arm64-v8a
    void setAngleInfo(const std::string path, const std::string appName, const bool optIn);
    void setAngleInfo(const std::string path, const std::string appName, const std::string appPref,
                      bool devOptIn);
    android_namespace_t* getAngleNamespace();
    const char* getAngleAppName();
    const char* getAngleAppPref();
    bool getAngleDeveloperOptIn();

    void setLayerPaths(NativeLoaderNamespace* appNamespace, const std::string layerPaths);
@@ -60,6 +62,7 @@ private:
    std::string mDriverPath;
    std::string mAnglePath;
    std::string mAngleAppName;
    std::string mAngleAppPref;
    bool mAngleDeveloperOptIn;
    std::string mDebugLayers;
    std::string mLayerPaths;
@@ -85,6 +88,7 @@ extern "C" {
android_namespace_t* android_getDriverNamespace();
android_namespace_t* android_getAngleNamespace();
const char* android_getAngleAppName();
const char* android_getAngleAppPref();
bool android_getAngleDeveloperOptIn();
}

+4 −1
Original line number Diff line number Diff line
@@ -486,12 +486,15 @@ static void* load_angle(const char* kind, egl_connection_t* cnx) {

    android_namespace_t* ns = android_getAngleNamespace();
    const char* app_name = android_getAngleAppName();
    const char* app_pref = android_getAngleAppPref();
    bool developer_opt_in = android_getAngleDeveloperOptIn();

    if (ns) {
        // If we got a namespce for ANGLE, check any other conditions
        // before loading from it.
        if (developer_opt_in) {
        // TODO: Call opt-in logic rather than use pref directly
        //       app_pref will be "angle", "native", or "dontcare"
        if ((developer_opt_in || !strcmp(app_pref, "angle"))) {
            so = load_angle_from_namespace(kind, ns);
        }
    }