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

Commit a4fef026 authored by Romain Guy's avatar Romain Guy
Browse files

Update profiling properties

This change merges debug.hwui.profiling and profiling_visualize.
Now only the first property exists and accepts the values true, false
and visual. This enables setting the property from Settings.

Change-Id: I16a11fe23ac1a6bb907a1a826e418d6b3994b56c
parent 98e4a52c
Loading
Loading
Loading
Loading
+24 −20
Original line number Diff line number Diff line
@@ -88,26 +88,22 @@ public abstract class HardwareRenderer {
     *
     * Possible values:
     * "true", to enable profiling
     * "visual", to enable profiling and visualize the results on screen
     * "false", to disable profiling
     *
     * @see #PROFILE_PROPERTY_VISUALIZE
     *
     * @hide
     */
    public static final String PROFILE_PROPERTY = "debug.hwui.profile";

    /**
     * System property used to enable or disable hardware rendering profiling
     * visualization. The default value of this property is assumed to be false.
     *
     * This property is only taken into account when {@link #PROFILE_PROPERTY} is
     * turned on.
     *
     * Possible values:
     * "true", to enable on screen profiling
     * "false", to disable on screen profiling
     * Value for {@link #PROFILE_PROPERTY}. When the property is set to this
     * value, profiling data will be visualized on screen.
     *
     * @hide
     */
    public static final String PROFILE_VISUALIZER_PROPERTY = "debug.hwui.profile_visualizer";
    public static final String PROFILE_PROPERTY_VISUALIZE = "visual";

    /**
     * System property used to specify the number of frames to be used
@@ -694,9 +690,26 @@ public abstract class HardwareRenderer {

        @Override
        boolean loadSystemProperties(Surface surface) {
            boolean value;
            boolean changed = false;

            boolean value = SystemProperties.getBoolean(PROFILE_PROPERTY, false);
            String profiling = SystemProperties.get(PROFILE_PROPERTY);
            value = PROFILE_PROPERTY_VISUALIZE.equalsIgnoreCase(profiling);

            if (value != mProfileVisualizerEnabled) {
                changed = true;
                mProfileVisualizerEnabled = value;

                mProfileRects = null;
                mProfilePaint = null;
            }

            // If on-screen profiling is not enabled, we need to check whether
            // console profiling only is enabled
            if (!value) {
                value = Boolean.parseBoolean(profiling);
            }

            if (value != mProfileEnabled) {
                changed = true;
                mProfileEnabled = value;
@@ -723,15 +736,6 @@ public abstract class HardwareRenderer {
                mProfilePaint = null;
            }

            value = SystemProperties.getBoolean(PROFILE_VISUALIZER_PROPERTY, false);
            if (value != mProfileVisualizerEnabled) {
                changed = true;
                mProfileVisualizerEnabled = value;

                mProfileRects = null;
                mProfilePaint = null;
            }

            value = SystemProperties.getBoolean(DEBUG_DIRTY_REGIONS_PROPERTY, false);
            if (value != mDebugDirtyRegions) {
                changed = true;