From 8bd24e969e831a5c86458d33f10eb8981c850842 Mon Sep 17 00:00:00 2001 From: Tim Van Patten Date: Fri, 8 Feb 2019 10:16:40 -0700 Subject: 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 --- libs/graphicsenv/GraphicsEnv.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'libs/graphicsenv/GraphicsEnv.cpp') diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp index c20d54b7f2..3b42f8093b 100644 --- a/libs/graphicsenv/GraphicsEnv.cpp +++ b/libs/graphicsenv/GraphicsEnv.cpp @@ -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()); -- cgit v1.2.3-59-g8ed1b