Allow specifying ANGLE in manifest via meta-data
This CL allows the application's manifest to specify whether
to use ANGLE or native drivers for GLES via meta-data.
To enable, place the following within <application> and it
will be detected by the platform:
<meta-data
android:name:"com.android.angle.GLES_MODE"
android:value:"angle" />
The manifest can also specify "native" to opt-out of
ANGLE, but native will be the default for Q release.
This method is in service of the tech preview of
ANGLE for Android. For Q release, we should move this
to the Android API.
Test: Manual, verified manifest can specify angle/native/foo
Change-Id: Iedc081a3700e05b8c391016704d0c9d623a4e76d
(cherry picked from commit e1cff35269c19020de5bf15028f0c4051ee508c5)
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 282b468..2a7d76e 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -57,7 +57,7 @@
}
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 @@
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 @@
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 @@
bool android_getAngleDeveloperOptIn() {
return android::GraphicsEnv::getInstance().getAngleDeveloperOptIn();
}
+const char* android_getAngleAppPref() {
+ return android::GraphicsEnv::getInstance().getAngleAppPref();
+}
}