Merge "Add new API to toggle ANGLE as the default system GLES driver" into udc-dev
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index a52e3d49..2c31e32 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -213,6 +213,13 @@
}
/**
+ * Switch the system to use ANGLE as the default GLES driver.
+ */
+ public void toggleAngleAsSystemDriver(boolean enabled) {
+ nativeToggleAngleAsSystemDriver(enabled);
+ }
+
+ /**
* Query to determine if the Game Mode has enabled ANGLE.
*/
private boolean isAngleEnabledByGameMode(Context context, String packageName) {
@@ -992,6 +999,7 @@
String appPackage, boolean angleIsSystemDriver, String legacyDriverName);
private static native boolean getShouldUseAngle(String packageName);
private static native boolean setInjectLayersPrSetDumpable();
+ private static native void nativeToggleAngleAsSystemDriver(boolean enabled);
/**
* Hint for GraphicsEnvironment that an activity is launching on the process.
diff --git a/core/jni/android_os_GraphicsEnvironment.cpp b/core/jni/android_os_GraphicsEnvironment.cpp
index 78e2d31..d9152d6 100644
--- a/core/jni/android_os_GraphicsEnvironment.cpp
+++ b/core/jni/android_os_GraphicsEnvironment.cpp
@@ -122,6 +122,10 @@
android::GraphicsEnv::getInstance().hintActivityLaunch();
}
+void nativeToggleAngleAsSystemDriver_native(JNIEnv* env, jobject clazz, jboolean enabled) {
+ android::GraphicsEnv::getInstance().nativeToggleAngleAsSystemDriver(enabled);
+}
+
const JNINativeMethod g_methods[] = {
{"isDebuggable", "()Z", reinterpret_cast<void*>(isDebuggable_native)},
{"setDriverPathAndSphalLibraries", "(Ljava/lang/String;Ljava/lang/String;)V",
@@ -143,6 +147,8 @@
{"setDebugLayersGLES", "(Ljava/lang/String;)V",
reinterpret_cast<void*>(setDebugLayersGLES_native)},
{"hintActivityLaunch", "()V", reinterpret_cast<void*>(hintActivityLaunch_native)},
+ {"nativeToggleAngleAsSystemDriver", "(Z)V",
+ reinterpret_cast<void*>(nativeToggleAngleAsSystemDriver_native)},
};
const char* const kGraphicsEnvironmentName = "android/os/GraphicsEnvironment";
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index e216f88..11fcd1e 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -7629,6 +7629,13 @@
<permission android:name="android.permission.LOG_FOREGROUND_RESOURCE_USE"
android:protectionLevel="signature|module" />
+ <!-- @hide Allows the settings app to access GPU service APIs".
+ <p>Not for use by third-party applications.
+ <p>Protection level: signature
+ -->
+ <permission android:name="android.permission.ACCESS_GPU_SERVICE"
+ android:protectionLevel="signature" />
+
<!-- @hide Allows an application to get type of any provider uri.
<p>Not for use by third-party applications.
<p>Protection level: signature