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

Commit 236b283b authored by Cody Northrop's avatar Cody Northrop Committed by Android (Google) Code Review
Browse files

Merge "ANGLE: Allow libs from debug package"

parents 0c682d04 dc2fd946
Loading
Loading
Loading
Loading
+36 −5
Original line number Diff line number Diff line
@@ -336,6 +336,25 @@ public class GraphicsEnvironment {
        return resolveInfos.get(0).activityInfo.packageName;
    }

    /**
     * Check for ANGLE debug package, but only for apps that can load them (dumpable)
     */
    private String getAngleDebugPackage(Context context, Bundle coreSettings) {
        final boolean appIsDebuggable = isDebuggable(context);
        final boolean appIsProfileable = isProfileable(context);
        final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
        if (appIsDebuggable || appIsProfileable || deviceIsDebuggable) {

            String debugPackage =
                    coreSettings.getString(Settings.Global.GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE);

            if ((debugPackage != null) && (!debugPackage.isEmpty())) {
                return debugPackage;
            }
        }
        return "";
    }

    /**
     * Attempt to setup ANGLE with a temporary rules file.
     * True: Temporary rules file was loaded.
@@ -502,12 +521,24 @@ public class GraphicsEnvironment {
        }

        final ApplicationInfo angleInfo;
        String angleDebugPackage = getAngleDebugPackage(context, bundle);
        if (!angleDebugPackage.isEmpty()) {
            Log.i(TAG, "ANGLE debug package enabled: " + angleDebugPackage);
            try {
                // Note the debug package does not have to be pre-installed
                angleInfo = pm.getApplicationInfo(angleDebugPackage, 0);
            } catch (PackageManager.NameNotFoundException e) {
                Log.w(TAG, "ANGLE debug package '" + angleDebugPackage + "' not installed");
                return false;
            }
        } else {
            try {
                angleInfo = pm.getApplicationInfo(anglePkgName, PackageManager.MATCH_SYSTEM_ONLY);
            } catch (PackageManager.NameNotFoundException e) {
                Log.w(TAG, "ANGLE package '" + anglePkgName + "' not installed");
                return false;
            }
        }

        final String abi = chooseAbi(angleInfo);

+8 −0
Original line number Diff line number Diff line
@@ -12450,6 +12450,14 @@ public final class Settings {
         */
        public static final String GPU_DEBUG_APP = "gpu_debug_app";
        /**
         * Package containing ANGLE libraries other than system, which are only available
         * to dumpable apps that opt-in.
         * @hide
         */
        public static final String GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE =
                "angle_debug_package";
        /**
         * Force all PKGs to use ANGLE, regardless of any other settings
         * The value is a boolean (1 or 0).
+2 −0
Original line number Diff line number Diff line
@@ -455,6 +455,8 @@ message GlobalSettingsProto {
        optional SettingProto show_angle_in_use_dialog = 15;
        // Game Driver - List of libraries in sphal accessible by Game Driver
        optional SettingProto game_driver_sphal_libraries = 16;
        // ANGLE - External package containing ANGLE libraries
        optional SettingProto angle_debug_package = 17;
    }
    optional Gpu gpu = 59;

+1 −0
Original line number Diff line number Diff line
@@ -487,6 +487,7 @@ public class SettingsBackupTest {
                    Settings.Global.GPU_DEBUG_APP,
                    Settings.Global.GPU_DEBUG_LAYERS,
                    Settings.Global.GPU_DEBUG_LAYERS_GLES,
                    Settings.Global.GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE,
                    Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_ALL_ANGLE,
                    Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_PKGS,
                    Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_VALUES,
+3 −0
Original line number Diff line number Diff line
@@ -685,6 +685,9 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
                Settings.Global.GPU_DEBUG_LAYERS,
                GlobalSettingsProto.Gpu.DEBUG_LAYERS);
        dumpSetting(s, p,
                Settings.Global.GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE,
                GlobalSettingsProto.Gpu.ANGLE_DEBUG_PACKAGE);
        dumpSetting(s, p,
                Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_ALL_ANGLE,
                GlobalSettingsProto.Gpu.ANGLE_GL_DRIVER_ALL_ANGLE);
Loading