Merge "Add new API to toggle ANGLE as the default system GLES driver" into udc-dev

This commit is contained in:
Yuxin Hu
2023-04-20 18:05:47 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 0 deletions

View File

@@ -212,6 +212,13 @@ public class GraphicsEnvironment {
Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS);
}
/**
* 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.
*/
@@ -992,6 +999,7 @@ public class GraphicsEnvironment {
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.

View File

@@ -122,6 +122,10 @@ void hintActivityLaunch_native(JNIEnv* env, jobject clazz) {
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 @@ const JNINativeMethod g_methods[] = {
{"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";

View File

@@ -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