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

Commit 8bd24e96 authored by Tim Van Patten's avatar Tim Van Patten
Browse files

ANGLE In Use Dialog Box

When ANGLE is enabled for an app, show a dialog box to the user to
indicate that ANGLE is in use.   This is useful because there are
not (or at least shouldn't be) any visual indication that a different
OpenGL driver is in use.

Bug: 120489005
Test: atest CtsAngleIntegrationHostTestCases
Test: Load an app with ANGLE enabled and verify dialog box is shown.
Test: Load an app without ANGLE and verify dialog box is not shown.
Change-Id: I5d667707841458b4ef63c9f4a5bc07e30cb7c786
parent 1603cc25
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -316,28 +316,28 @@ bool GraphicsEnv::shouldUseAngle() {
        return false;
    }

    return mUseAngle;
    return (mUseAngle == YES) ? true : false;
}

void GraphicsEnv::updateUseAngle() {
    mUseAngle = false;
    mUseAngle = NO;

    const char* ANGLE_PREFER_ANGLE = "angle";
    const char* ANGLE_PREFER_NATIVE = "native";

    if (mAngleDeveloperOptIn == ANGLE_PREFER_ANGLE) {
        ALOGV("User set \"Developer Options\" to force the use of ANGLE");
        mUseAngle = true;
        mUseAngle = YES;
    } else if (mAngleDeveloperOptIn == ANGLE_PREFER_NATIVE) {
        ALOGV("User set \"Developer Options\" to force the use of Native");
        mUseAngle = false;
        mUseAngle = NO;
    } else {
        // The "Developer Options" value wasn't set to force the use of ANGLE.  Need to temporarily
        // load ANGLE and call the updatable opt-in/out logic:
        void* featureSo = loadLibrary("feature_support");
        if (featureSo) {
            ALOGV("loaded ANGLE's opt-in/out logic from namespace");
            mUseAngle = checkAngleRules(featureSo);
            mUseAngle = checkAngleRules(featureSo) ? YES : NO;
            dlclose(featureSo);
            featureSo = nullptr;
        } else {
@@ -349,6 +349,13 @@ void GraphicsEnv::updateUseAngle() {
void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName,
                               const std::string developerOptIn, const int rulesFd,
                               const long rulesOffset, const long rulesLength) {
    if (mUseAngle != UNKNOWN) {
        // We've already figured out an answer for this app, so just return.
        ALOGV("Already evaluated the rules file for '%s': use ANGLE = %s", appName.c_str(),
              (mUseAngle == YES) ? "true" : "false");
        return;
    }

    ALOGV("setting ANGLE path to '%s'", path.c_str());
    mAnglePath = path;
    ALOGV("setting ANGLE app name to '%s'", appName.c_str());
+3 −1
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ public:
    const std::string& getDebugLayersGLES();

private:
    enum UseAngle { UNKNOWN, YES, NO };

    void* loadLibrary(std::string name);
    bool checkAngleRules(void* so);
    void updateUseAngle();
@@ -85,7 +87,7 @@ private:
    std::string mAngleAppName;
    std::string mAngleDeveloperOptIn;
    std::vector<char> mRulesBuffer;
    bool mUseAngle;
    UseAngle mUseAngle = UNKNOWN;
    std::string mDebugLayers;
    std::string mDebugLayersGLES;
    std::string mLayerPaths;