Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adda6254 authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "Use more inclusive terms inside GraphicsEnvironment." into rvc-dev-plus-aosp

parents 31457aeb b967a4c3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -426,7 +426,7 @@ java_library {
        "apex_aidl_interface-java",
        "suspend_control_aidl_interface-java",
        "framework-protos",
        "game-driver-protos",
        "updatable-driver-protos",
        "android.hidl.base-V1.0-java",
        "android.hardware.cas-V1.0-java",
        "android.hardware.cas-V1.1-java",
+24 −24
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class GraphicsEnvironment {
    private static final String ACTION_ANGLE_FOR_ANDROID_TOAST_MESSAGE =
            "android.app.action.ANGLE_FOR_ANDROID_TOAST_MESSAGE";
    private static final String INTENT_KEY_A4A_TOAST_MESSAGE = "A4A Toast Message";
    private static final String GAME_DRIVER_WHITELIST_ALL = "*";
    private static final String GAME_DRIVER_ALLOWLIST_ALL = "*";
    private static final String GAME_DRIVER_SPHAL_LIBRARIES_FILENAME = "sphal_libraries.txt";
    private static final int VULKAN_1_0 = 0x00400000;
    private static final int VULKAN_1_1 = 0x00401000;
@@ -142,19 +142,19 @@ public class GraphicsEnvironment {
                    + "set to: '" + devOptIn + "'");
        }

        // We only want to use ANGLE if the app is whitelisted or the developer has
        // We only want to use ANGLE if the app is allowlisted or the developer has
        // explicitly chosen something other than default driver.
        // The whitelist will be generated by the ANGLE APK at both boot time and
        // The allowlist will be generated by the ANGLE APK at both boot time and
        // ANGLE update time. It will only include apps mentioned in the rules file.
        final boolean whitelisted = checkAngleWhitelist(context, coreSettings, packageName);
        final boolean allowlisted = checkAngleAllowlist(context, coreSettings, packageName);
        final boolean requested = devOptIn.equals(sDriverMap.get(OpenGlDriverChoice.ANGLE));
        final boolean useAngle = (whitelisted || requested);
        final boolean useAngle = (allowlisted || requested);
        if (!useAngle) {
            return false;
        }

        if (whitelisted) {
            Log.v(TAG, "ANGLE whitelist includes " + packageName);
        if (allowlisted) {
            Log.v(TAG, "ANGLE allowlist includes " + packageName);
        }
        if (requested) {
            Log.v(TAG, "ANGLE developer option for " + packageName + ": " + devOptIn);
@@ -564,17 +564,17 @@ public class GraphicsEnvironment {
    }

    /**
     * Pull ANGLE whitelist from GlobalSettings and compare against current package
     * Pull ANGLE allowlist from GlobalSettings and compare against current package
     */
    private static boolean checkAngleWhitelist(Context context, Bundle bundle, String packageName) {
    private static boolean checkAngleAllowlist(Context context, Bundle bundle, String packageName) {
        final ContentResolver contentResolver = context.getContentResolver();
        final List<String> angleWhitelist =
        final List<String> angleAllowlist =
                getGlobalSettingsString(contentResolver, bundle,
                    Settings.Global.GLOBAL_SETTINGS_ANGLE_WHITELIST);

        if (DEBUG) Log.v(TAG, "ANGLE whitelist: " + angleWhitelist);
        if (DEBUG) Log.v(TAG, "ANGLE allowlist: " + angleAllowlist);

        return angleWhitelist.contains(packageName);
        return angleAllowlist.contains(packageName);
    }

    /**
@@ -584,7 +584,7 @@ public class GraphicsEnvironment {
     * @param bundle
     * @param packageName
     * @return true: ANGLE setup successfully
     *         false: ANGLE not setup (not on whitelist, ANGLE not present, etc.)
     *         false: ANGLE not setup (not on allowlist, ANGLE not present, etc.)
     */
    public boolean setupAngle(Context context, Bundle bundle, PackageManager pm,
            String packageName) {
@@ -750,8 +750,8 @@ public class GraphicsEnvironment {
        // 2. GAME_DRIVER_OPT_OUT_APPS
        // 3. GAME_DRIVER_PRERELEASE_OPT_IN_APPS
        // 4. GAME_DRIVER_OPT_IN_APPS
        // 5. GAME_DRIVER_BLACKLIST
        // 6. GAME_DRIVER_WHITELIST
        // 5. GAME_DRIVER_DENYLIST
        // 6. GAME_DRIVER_ALLOWLIST
        switch (coreSettings.getInt(Settings.Global.GAME_DRIVER_ALL_APPS, 0)) {
            case GAME_DRIVER_GLOBAL_OPT_IN_OFF:
                if (DEBUG) Log.v(TAG, "Game Driver is turned off on this device.");
@@ -790,21 +790,21 @@ public class GraphicsEnvironment {
        final boolean isOptIn =
                getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_OPT_IN_APPS)
                        .contains(appPackageName);
        final List<String> whitelist =
                getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_WHITELIST);
        if (!isOptIn && whitelist.indexOf(GAME_DRIVER_WHITELIST_ALL) != 0
                && !whitelist.contains(appPackageName)) {
            if (DEBUG) Log.v(TAG, "App is not on the whitelist for Game Driver.");
        final List<String> allowlist =
                getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_ALLOWLIST);
        if (!isOptIn && allowlist.indexOf(GAME_DRIVER_ALLOWLIST_ALL) != 0
                && !allowlist.contains(appPackageName)) {
            if (DEBUG) Log.v(TAG, "App is not on the allowlist for Game Driver.");
            return null;
        }

        // If the application is not opted-in, then check whether it's on the blacklist,
        // terminate early if it's on the blacklist and fallback to system driver.
        // If the application is not opted-in, then check whether it's on the denylist,
        // terminate early if it's on the denylist and fallback to system driver.
        if (!isOptIn
                && getGlobalSettingsString(
                        null, coreSettings, Settings.Global.GAME_DRIVER_BLACKLIST)
                        null, coreSettings, Settings.Global.GAME_DRIVER_DENYLIST)
                           .contains(appPackageName)) {
            if (DEBUG) Log.v(TAG, "App is on the blacklist for Game Driver.");
            if (DEBUG) Log.v(TAG, "App is on the denylist for Game Driver.");
            return null;
        }

+6 −6
Original line number Diff line number Diff line
@@ -12322,24 +12322,24 @@ public final class Settings {
        public static final String GAME_DRIVER_OPT_OUT_APPS = "game_driver_opt_out_apps";
        /**
         * Apps on the blacklist that are forbidden to use Game Driver.
         * Apps on the denylist that are forbidden to use Game Driver.
         * @hide
         */
        public static final String GAME_DRIVER_BLACKLIST = "game_driver_blacklist";
        public static final String GAME_DRIVER_DENYLIST = "game_driver_denylist";
        /**
         * List of blacklists, each blacklist is a blacklist for a specific version of Game Driver.
         * List of denylists, each denylist is a denylist for a specific version of Game Driver.
         * @hide
         */
        public static final String GAME_DRIVER_BLACKLISTS = "game_driver_blacklists";
        public static final String GAME_DRIVER_DENYLISTS = "game_driver_denylists";
        /**
         * Apps on the whitelist that are allowed to use Game Driver.
         * Apps on the allowlist that are allowed to use Game Driver.
         * The string is a list of application package names, seperated by comma.
         * i.e. <apk1>,<apk2>,...,<apkN>
         * @hide
         */
        public static final String GAME_DRIVER_WHITELIST = "game_driver_whitelist";
        public static final String GAME_DRIVER_ALLOWLIST = "game_driver_allowlist";
        /**
         * List of libraries in sphal accessible by Game Driver
+4 −4
Original line number Diff line number Diff line
@@ -445,14 +445,14 @@ message GlobalSettingsProto {
        // i.e. <pkg1>,<pkg2>,...,<pkgN>
        optional SettingProto game_driver_opt_out_apps = 10;
        // Game Driver - List of Apps that are forbidden to use Game Driver
        optional SettingProto game_driver_blacklist = 11;
        optional SettingProto game_driver_denylist = 11;
        // Game Driver - List of Apps that are allowed to use Game Driver
        optional SettingProto game_driver_whitelist = 12;
        optional SettingProto game_driver_allowlist = 12;
        // ANGLE - List of Apps that can check ANGLE rules
        optional SettingProto angle_whitelist = 13;
        // Game Driver - List of blacklists, each blacklist is a blacklist for
        // Game Driver - List of denylists, each denylist is a denylist for
        // a specific Game Driver version
        optional SettingProto game_driver_blacklists = 14;
        optional SettingProto game_driver_denylists = 14;
        // ANGLE - Show a dialog box when ANGLE is selected for the currently running PKG
        optional SettingProto show_angle_in_use_dialog = 15;
        // Game Driver - List of libraries in sphal accessible by Game Driver
+3 −3
Original line number Diff line number Diff line
java_library_static {
    name: "game-driver-protos",
    name: "updatable-driver-protos",
    host_supported: true,
    proto: {
        type: "lite",
    },
    srcs: ["game_driver.proto"],
    srcs: ["updatable_driver.proto"],
    jarjar_rules: "jarjar-rules.txt",
    sdk_version: "28",
    sdk_version: "30",
}
Loading