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

Commit 3832aa99 authored by Cody Northrop's avatar Cody Northrop
Browse files

GraphicsEnvironment: Allow profileable apps to load layers

Apps that allow themselves to be profiled locally are also eligible
to load layers, since they are set dumpable. They can opt in by
setting the following in AndroidManifest.xml:

    <!-- App opts-in to being profiled by the shell -->
    <application>
        ...
        <profileable shell=”true”/>
    </application>

Bug: 128637647
Test: atest CtsGpuToolsHostTestCases
Test: Modify CtsGpuToolsHostTestCases to use profileable="true"
      and ensure loading from external works.

Change-Id: Ib072d07408c2abd8fee7179fec3a0d28d72d6398
parent 4d7990f4
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -103,6 +103,13 @@ public class GraphicsEnvironment {
        return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) > 0;
    }

    /**
     * Check whether application is profileable
     */
    private static boolean isProfileable(Context context) {
        return context.getApplicationInfo().isProfileableByShell();
    }

    /**
     * Store the layer paths available to the loader.
     */
@@ -153,11 +160,11 @@ public class GraphicsEnvironment {
        String layerPaths = "";

        // Only enable additional debug functionality if the following conditions are met:
        // 1. App is debuggable or device is rooted
        // 1. App is debuggable, profileable, or device is rooted
        // 2. ENABLE_GPU_DEBUG_LAYERS is true
        // 3. Package name is equal to GPU_DEBUG_APP

        if (isDebuggable(context) || (getCanLoadSystemLibraries() == 1)) {
        if (isDebuggable(context) || isProfileable(context) || (getCanLoadSystemLibraries() == 1)) {

            final int enable = coreSettings.getInt(Settings.Global.ENABLE_GPU_DEBUG_LAYERS, 0);