diff options
author | Peiyong Lin <lpy@google.com> | 2023-05-18 23:58:48 +0000 |
---|---|---|
committer | Peiyong Lin <lpy@google.com> | 2023-05-19 09:56:13 +0000 |
commit | 539b15038ed52fa68fd4dbb9bcfe78a42bb2580c (patch) | |
tree | d30fedb12fe3a2fe63e1d4efa2ed608f1f0f4b0b | |
parent | 9eabe9ebd85e49d9dd9ecb8deca4796383e3c1aa (diff) | |
download | angle-android14-dev.tar.gz |
Revert "Enable Developer Options GUI & add deferlist"android14-dev
This reverts commit a4e417321681ca7c002467c9a1dd30ebb4b76c06.
Reason for revert: Remove deferred list functionality now that the shape
of ANGLE shipping form is binaries. Applications on the list are broken
with ANGLE due to the lack of YUV support, this is currently being
worked on.
Bug: 280450222
Change-Id: I126df1e34ce763e01d7327803947fcd84e901461
Test: atest CtsAngleIntegrationHostTestCases
5 files changed, 49 insertions, 177 deletions
diff --git a/src/android_system_settings/assets/a4a_rules.json b/src/android_system_settings/assets/a4a_rules.json index f3ac039ee9..f0735d358b 100644 --- a/src/android_system_settings/assets/a4a_rules.json +++ b/src/android_system_settings/assets/a4a_rules.json @@ -1,38 +1,25 @@ { - "Rules": [ - { - "Rule": "Default Rule (i.e. use native driver)", - "UseANGLE": true - }, - { - "Rule": "Do not use ANGLE for application(s) currently known to have issues", - "UseANGLE": false, - "Applications": [ - { - "AppName": "com.google.android.GoogleCamera" - }, - { - "AppName": "com.google.android.videos" - }, - { - "AppName": "com.google.android.youtube" - }, - { - "AppName": "com.disney.disneyplus" - }, - { - "AppName": "com.hbo.hbonow" - }, - { - "AppName": "com.netflix.mediaclient" - }, - { - "AppName": "com.snapchat.android" - }, - { - "AppName": "com.ss.android.ugc.trill" - } - ] - } - ] + "Rules":[ + { + "Rule":"Default Rule (i.e. use native driver)", + "UseANGLE":false + }, + { + "Rule":"Supported application(s) (e.g. Maps on Google devices)", + "UseANGLE":true, + "Applications":[ + { + "AppName":"com.android.angle" + }, + { + "AppName":"com.google.android.angle" + } + ], + "Devices":[ + { + "Manufacturer":"Google" + } + ] + } + ] } diff --git a/src/android_system_settings/res/values/global_settings.xml b/src/android_system_settings/res/values/global_settings.xml index caa1c8b588..259406bdb8 100644 --- a/src/android_system_settings/res/values/global_settings.xml +++ b/src/android_system_settings/res/values/global_settings.xml @@ -21,6 +21,5 @@ <string name="global_settings_driver_selection_pkgs">angle_gl_driver_selection_pkgs</string> <string name="global_settings_driver_selection_values">angle_gl_driver_selection_values</string> <string name="global_settings_angle_debug_package">angle_debug_package</string> - <string name="global_settings_angle_deferlist">angle_deferlist</string> - <string name="global_settings_angle_deferlist_mode">angle_deferlist_mode</string> + <string name="global_settings_angle_allowlist">angle_allowlist</string> </resources> diff --git a/src/android_system_settings/src/com/android/angle/common/GlobalSettings.java b/src/android_system_settings/src/com/android/angle/common/GlobalSettings.java index 70a8a70b4b..269a847313 100644 --- a/src/android_system_settings/src/com/android/angle/common/GlobalSettings.java +++ b/src/android_system_settings/src/com/android/angle/common/GlobalSettings.java @@ -34,26 +34,6 @@ class GlobalSettings private List<PackageInfo> mInstalledPkgs = new ArrayList<>(); private List<String> mGlobalSettingsDriverPkgs = new ArrayList<>(); private List<String> mGlobalSettingsDriverValues = new ArrayList<>(); - private List<String> mGlobalDeferlist = new ArrayList<>(); - - /* - * Modes of applying the deferlist to the per-application switch (i.e. the - * "angle_gl_driver_selection_*" settings). Most devices will not do anything - * (i.e. DEFERLIST_MODE_NA). While a device is transitioning from using a legacy driver to - * using ANGLE, the following modes can be used to defer the use of ANGLE until bugs are fixed. - * - * NOTE: the set of modes can grow over time, as we identify new needs. - */ - // ANGLE deferlist not applicable. For devices where ANGLE is either: 1) not installed; 2) is - // not the system driver; 3) is the system driver and there is no legacy driver - private static final int DEFERLIST_MODE_NA = 0; - // ANGLE deferlist replaces the existing settings at first boot, and then doesn't change them - private static final int DEFERLIST_MODE_REPLACE = 1; - // ANGLE deferlist is merged into the existing settings at first boot, and then doesn't change - // them - private static final int DEFERLIST_MODE_MERGE = 2; - - private static final int kDesiredDeferlistMode = DEFERLIST_MODE_REPLACE; GlobalSettings(Context context, List<PackageInfo> installedPkgs) { @@ -80,7 +60,7 @@ class GlobalSettings Settings.Global.putString(contentResolver, context.getString(R.string.global_settings_angle_debug_package), ""); - // Skip angle_deferlist; not updatable via Developer Options + // Skip angle_allowlist; not updatable via Developer Options } Boolean getAllUseAngle() @@ -128,56 +108,11 @@ class GlobalSettings showAngleInUseDialog ? 1 : 0); } - static void updateAngleDeferlist(Context context, String packageNames, String driverNames) + static void updateAngleAllowlist(Context context, String packageNames) { - // Write the deferlist to a setting so that it survives reboots ContentResolver contentResolver = context.getContentResolver(); Settings.Global.putString(contentResolver, - context.getString(R.string.global_settings_angle_deferlist), packageNames); - - // Depending on the device's current and desired deferlist mode, potentially transition to - // the desired mode, which may involve changing the "angle_gl_driver_selection_*" settings, - // based on the deferlist packages coming from the packageNames and driverNames parameters. - int currentDeferlistMode = DEFERLIST_MODE_NA; - try - { - currentDeferlistMode = Settings.Global.getInt( - contentResolver, - context.getString(R.string.global_settings_angle_deferlist_mode)); - } - catch (Settings.SettingNotFoundException e) - { - // This is likely a newly-flashed system, with a non-existent setting; assume NA - currentDeferlistMode = DEFERLIST_MODE_NA; - } - switch (kDesiredDeferlistMode) - { - case DEFERLIST_MODE_NA: - // Do nothing - break; - case DEFERLIST_MODE_REPLACE: - // Replace the existing per-application switch settings - if (currentDeferlistMode != kDesiredDeferlistMode) - { - Settings.Global.putString(contentResolver, - context.getString(R.string.global_settings_driver_selection_pkgs), - packageNames); - Settings.Global.putString(contentResolver, - context.getString(R.string.global_settings_driver_selection_values), - driverNames); - } - break; - case DEFERLIST_MODE_MERGE: - // TODO: implement this when needed (b/224558229) - break; - default: - // Do nothing - break; - } - // Set the device's current mode to the desired mode - Settings.Global.putInt(contentResolver, - context.getString(R.string.global_settings_angle_deferlist_mode), - kDesiredDeferlistMode); + context.getString(R.string.global_settings_angle_allowlist), packageNames); } void updatePkg(String pkgName, String driver) @@ -250,8 +185,6 @@ class GlobalSettings mContext.getString(R.string.global_settings_driver_selection_pkgs)); mGlobalSettingsDriverValues = getGlobalSettingsString( mContext.getString(R.string.global_settings_driver_selection_values)); - mGlobalDeferlist = getGlobalSettingsString( - mContext.getString(R.string.global_settings_angle_deferlist)); } private List<String> getGlobalSettingsString(String globalSetting) @@ -301,7 +234,7 @@ class GlobalSettings for (String pkgName : globalSettingsDriverPkgs) { // Remove any uninstalled packages. - if (!isPkgInstalled(pkgName) && !isPkgInDeferlist(pkgName)) + if (!isPkgInstalled(pkgName)) { removePkgFromGlobalSettings(pkgName); } @@ -352,20 +285,6 @@ class GlobalSettings return false; } - private Boolean isPkgInDeferlist(String pkgName) - { - List<String> globalSettingsDeferlist = new ArrayList<>(mGlobalDeferlist); - for (String pkg : globalSettingsDeferlist) - { - if (pkg.equals(pkgName)) - { - return true; - } - } - - return false; - } - private Boolean isValidDiverValue(String driverValue) { CharSequence[] drivers = mContext.getResources().getStringArray(R.array.driver_values); diff --git a/src/android_system_settings/src/com/android/angle/common/MainFragment.java b/src/android_system_settings/src/com/android/angle/common/MainFragment.java index a446134042..d60acb5947 100644 --- a/src/android_system_settings/src/com/android/angle/common/MainFragment.java +++ b/src/android_system_settings/src/com/android/angle/common/MainFragment.java @@ -209,22 +209,15 @@ public class MainFragment extends PreferenceFragment implements OnSharedPreferen for (PackageInfo packageInfo : pkgs) { - // We need to be able to see the following system applications until ANGLE supports YUV - // b/232149402 - if (!(packageInfo.packageName.equals("com.google.android.GoogleCamera") || - packageInfo.packageName.equals("com.google.android.videos") || - packageInfo.packageName.equals("com.google.android.youtube"))) + if (packageInfo.applicationInfo.uid == Process.SYSTEM_UID) { - if (packageInfo.applicationInfo.uid == Process.SYSTEM_UID) - { - continue; - } + continue; + } - // Filter out apps that are system apps - if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) - { - continue; - } + // Filter out apps that are system apps + if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) + { + continue; } mInstalledPkgs.add(packageInfo); diff --git a/src/android_system_settings/src/com/android/angle/common/Receiver.java b/src/android_system_settings/src/com/android/angle/common/Receiver.java index f8cbb9b904..03fbf8d1ed 100644 --- a/src/android_system_settings/src/com/android/angle/common/Receiver.java +++ b/src/android_system_settings/src/com/android/angle/common/Receiver.java @@ -22,7 +22,6 @@ import android.content.SharedPreferences; import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; -import android.os.SystemProperties; import android.os.Handler; import android.provider.Settings; import android.util.Log; @@ -42,11 +41,6 @@ public class Receiver extends BroadcastReceiver private static final String TAG = "AngleReceiver"; private static final String ANGLE_RULES_FILE = "a4a_rules.json"; - // System properties related to ANGLE and legacy GLES graphics drivers. - private static final String PROPERTY_EGL_SYSTEM_DRIVER = "ro.hardware.egl"; - private static final String PROPERTY_EGL_LEGACY_DRIVER = "ro.hardware.egl_legacy"; - private static final String ANGLE_DRIVER_NAME = "angle"; - @Override public void onReceive(Context context, Intent intent) { @@ -61,22 +55,15 @@ public class Receiver extends BroadcastReceiver } else { - // Process the deferlist only if both: 1) ANGLE is the system driver; 2) there is also a - // legacy driver: - final String eglSystemDriver = SystemProperties.get(PROPERTY_EGL_SYSTEM_DRIVER); - if (!eglSystemDriver.equals(ANGLE_DRIVER_NAME)) - { - return; - } - final String eglLegacyDriver = SystemProperties.get(PROPERTY_EGL_LEGACY_DRIVER); - if (eglLegacyDriver.isEmpty() || eglSystemDriver.equals(eglLegacyDriver)) + String jsonStr = loadRules(context); + String packageNames = parsePackageNames(jsonStr); + + // Update the ANGLE allowlist + if (packageNames != null) { - return; + GlobalSettings.updateAngleAllowlist(context, packageNames); } - String jsonStr = loadRules(context); - parseDeferlist(context, jsonStr); - updateDeveloperOptionsWatcher(context); } } @@ -106,15 +93,11 @@ public class Receiver extends BroadcastReceiver } /* - * Parse the default deferlist from a json file, and convert it into the following - * comma-separated settings: - * - "angle_gl_driver_selection_pkgs" - * - "angle_gl_driver_selection_values" + * Extract all app package names from the json file and return them comma separated */ - public void parseDeferlist(Context context, String rulesJSON) + private String parsePackageNames(String rulesJSON) { StringBuilder packageNames = new StringBuilder(); - StringBuilder driverNames = new StringBuilder(); try { @@ -123,7 +106,7 @@ public class Receiver extends BroadcastReceiver if (rules == null) { Log.e(TAG, "No Rules in " + ANGLE_RULES_FILE); - return; + return null; } for (int i = 0; i < rules.length(); i++) { @@ -145,23 +128,20 @@ public class Receiver extends BroadcastReceiver if (!packageNames.toString().isEmpty()) { packageNames.append(","); - driverNames.append(","); } packageNames.append(appName); - driverNames.append("native"); } } - Log.v(TAG, "Parsed the following deferlist package names from " + ANGLE_RULES_FILE - + ": " + packageNames); + Log.v(TAG, "Parsed the following package names from " + ANGLE_RULES_FILE + ": " + + packageNames); } catch (JSONException je) { - Log.e(TAG, "Error when parsing angle deferlist JSON: ", je); - return; + Log.e(TAG, "Error when parsing angle JSON: ", je); + return null; } - GlobalSettings.updateAngleDeferlist(context, packageNames.toString(), - driverNames.toString()); + return packageNames.toString(); } static void updateAllUseAngle(Context context) @@ -208,11 +188,6 @@ public class Receiver extends BroadcastReceiver Log.v(TAG, "Developer Options enabled value changed: " + "developerOptionsEnabled = " + developerOptionsEnabled); - /* - * NOTE: We DO NOT want to clear these when ANGLE is system driver - * - * TODO: We need to be able to query the service to known when to do this - * if (!developerOptionsEnabled) { // Reset the necessary settings to their defaults. @@ -222,7 +197,6 @@ public class Receiver extends BroadcastReceiver editor.apply(); GlobalSettings.clearAllGlobalSettings(context); } - */ } }; |