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/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index f5e0ad9..90721b8 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -486,12 +486,15 @@
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);
}
}