summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/os/GraphicsEnvironment.java84
-rw-r--r--core/res/res/values/config.xml5
-rw-r--r--core/res/res/values/symbols.xml1
3 files changed, 57 insertions, 33 deletions
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index 2d3dd1b9383b..94768d111ca4 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -32,6 +32,8 @@ import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
+import com.android.internal.R;
+
import dalvik.system.VMRuntime;
import java.io.BufferedReader;
@@ -174,19 +176,6 @@ public class GraphicsEnvironment {
nativeToggleAngleAsSystemDriver(enabled);
}
- /**
- * Query to determine the ANGLE driver choice.
- */
- private String queryAngleChoice(Context context, Bundle coreSettings,
- String packageName) {
- if (TextUtils.isEmpty(packageName)) {
- Log.v(TAG, "No package name specified; use the system driver");
- return ANGLE_GL_DRIVER_CHOICE_DEFAULT;
- }
-
- return queryAngleChoiceInternal(context, coreSettings, packageName);
- }
-
private int getVulkanVersion(PackageManager pm) {
// PackageManager doesn't have an API to retrieve the version of a specific feature, and we
// need to avoid retrieving all system features here and looping through them.
@@ -403,11 +392,13 @@ public class GraphicsEnvironment {
* Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES; which corresponds to the
* “angle_gl_driver_selection_pkgs” and “angle_gl_driver_selection_values” settings); if it
* forces a choice.
+ * 3) The per-application ANGLE allowlist contained in the platform. This is an array of
+ * strings containing package names that should use ANGLE.
*/
- private String queryAngleChoiceInternal(Context context, Bundle bundle,
- String packageName) {
+ private String queryAngleChoice(Context context, Bundle bundle, String packageName) {
// Make sure we have a good package name
if (TextUtils.isEmpty(packageName)) {
+ Log.v(TAG, "No package name specified; use the system driver");
return ANGLE_GL_DRIVER_CHOICE_DEFAULT;
}
@@ -436,8 +427,8 @@ public class GraphicsEnvironment {
Log.v(TAG, " angle_gl_driver_selection_pkgs=" + optInPackages);
Log.v(TAG, " angle_gl_driver_selection_values=" + optInValues);
- // Make sure we have good settings to use
- if (optInPackages.size() == 0 || optInPackages.size() != optInValues.size()) {
+ // Make sure we have valid settings, if any provided
+ if (optInPackages.size() != optInValues.size()) {
Log.v(TAG,
"Global.Settings values are invalid: "
+ "number of packages: "
@@ -449,24 +440,53 @@ public class GraphicsEnvironment {
// See if this application is listed in the per-application settings list
final int pkgIndex = getPackageIndex(packageName, optInPackages);
-
- if (pkgIndex < 0) {
- Log.v(TAG, packageName + " is not listed in per-application setting");
- return ANGLE_GL_DRIVER_CHOICE_DEFAULT;
+ if (pkgIndex >= 0) {
+ mAngleOptInIndex = pkgIndex;
+
+ // The application IS listed in the per-application settings list; and so use the
+ // setting--choosing the current system driver if the setting is "default"
+ String optInValue = optInValues.get(pkgIndex);
+ Log.v(
+ TAG,
+ "ANGLE Developer option for '"
+ + packageName
+ + "' "
+ + "set to: '"
+ + optInValue
+ + "'");
+ if (optInValue.equals(ANGLE_GL_DRIVER_CHOICE_ANGLE)) {
+ return ANGLE_GL_DRIVER_CHOICE_ANGLE;
+ } else if (optInValue.equals(ANGLE_GL_DRIVER_CHOICE_NATIVE)) {
+ return ANGLE_GL_DRIVER_CHOICE_NATIVE;
+ }
}
- mAngleOptInIndex = pkgIndex;
- // The application IS listed in the per-application settings list; and so use the
- // setting--choosing the current system driver if the setting is "default"
- String optInValue = optInValues.get(pkgIndex);
- Log.v(TAG,
- "ANGLE Developer option for '" + packageName + "' "
- + "set to: '" + optInValue + "'");
- if (optInValue.equals(ANGLE_GL_DRIVER_CHOICE_ANGLE)) {
- return ANGLE_GL_DRIVER_CHOICE_ANGLE;
- } else if (optInValue.equals(ANGLE_GL_DRIVER_CHOICE_NATIVE)) {
- return ANGLE_GL_DRIVER_CHOICE_NATIVE;
+ Log.v(TAG, packageName + " is not listed in per-application setting");
+
+ // Check the per-device allowlist shipped in the platform
+ if (android.os.Flags.enableAngleAllowList()) {
+ String[] angleAllowListPackages =
+ context.getResources().getStringArray(R.array.config_angleAllowList);
+
+ String allowListPackageList = String.join(" ", angleAllowListPackages);
+ Log.v(TAG, "ANGLE allowlist from config: " + allowListPackageList);
+
+ for (String allowedPackage : angleAllowListPackages) {
+ if (allowedPackage.equals(packageName)) {
+ Log.v(
+ TAG,
+ "Package name "
+ + packageName
+ + " is listed in config_angleAllowList, enabling ANGLE");
+ return ANGLE_GL_DRIVER_CHOICE_ANGLE;
+ }
+ }
+ Log.v(
+ TAG,
+ packageName
+ + " is not listed in ANGLE allowlist or settings, returning default");
}
+
// The user either chose default or an invalid value; go with the default driver.
return ANGLE_GL_DRIVER_CHOICE_DEFAULT;
}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index b90ee2b7e57f..c9755602292f 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4857,7 +4857,7 @@
See android.credentials.CredentialManager
-->
<string name="config_defaultCredentialManagerHybridService" translatable="false"></string>
-
+
<!-- The component name, flattened to a string, for the system's credential manager
autofill service. This service allows interceding autofill requests and routing
them to credential manager.
@@ -5770,6 +5770,9 @@
of known compatibility issues. -->
<string-array name="config_highRefreshRateBlacklist"></string-array>
+ <!-- The list of packages that will use ANGLE as the GLES driver -->
+ <string-array name="config_angleAllowList"></string-array>
+
<!-- The list of packages to automatically opt in to refresh rate suppressing by small area
detection. Format of this array should be packageName:threshold and threshold value should
be between 0 to 1-->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index b7c876545f05..eb8f78a0b011 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -4446,6 +4446,7 @@
<java-symbol type="string" name="config_factoryResetPackage" />
<java-symbol type="array" name="config_highRefreshRateBlacklist" />
+ <java-symbol type="array" name="config_angleAllowList" />
<java-symbol type="array" name="config_forceSlowJpegModeList" />
<java-symbol type="array" name="pause_wallpaper_render_when_state_change" />
<java-symbol type="bool" name="config_pauseWallpaperRenderWhenStateChangeEnabled" />