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

Commit 9589585f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Resolve merge conflicts of c2810b93 to...

Merge "Resolve merge conflicts of c2810b93 to sc-qpr1-dev-plus-aosp" into sc-qpr1-dev-plus-aosp
parents 99b8269a a501875e
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -5082,4 +5082,7 @@


    <!-- the number of the max cached processes in the system. -->
    <!-- the number of the max cached processes in the system. -->
    <integer name="config_customizedMaxCachedProcesses">32</integer>
    <integer name="config_customizedMaxCachedProcesses">32</integer>

    <!-- Whether this device should support taking app snapshots on closure -->
    <bool name="config_disableTaskSnapshots">false</bool>
</resources>
</resources>
+3 −0
Original line number Original line Diff line number Diff line
@@ -4441,4 +4441,7 @@
  <java-symbol type="integer" name="config_customizedMaxCachedProcesses" />
  <java-symbol type="integer" name="config_customizedMaxCachedProcesses" />


  <java-symbol type="color" name="overview_background"/>
  <java-symbol type="color" name="overview_background"/>

  <java-symbol type="bool" name="config_disableTaskSnapshots" />

</resources>
</resources>
+52 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.app.Activity;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Configuration;
@@ -1075,6 +1076,53 @@ public class HardwareRenderer {
        ProcessInitializer.sInstance.setContext(context);
        ProcessInitializer.sInstance.setContext(context);
    }
    }


    /**
     * Returns true if HardwareRender will produce output.
     *
     * This value is global to the process and affects all uses of HardwareRenderer,
     * including
     * those created by the system such as those used by the View tree when using hardware
     * accelerated rendering.
     *
     * Default is true in all production environments, but may be false in testing-focused
     * emulators or if {@link #setDrawingEnabled(boolean)} is used.
     *
     * Backported from android T.
     *
     * @hide
     */
    @UnsupportedAppUsage
    public static boolean isDrawingEnabled() {
        return nIsDrawingEnabled();
    }

    /**
     * Toggles whether or not HardwareRenderer will produce drawing output globally in the current
     * process.
     *
     * This applies to all HardwareRenderer instances, including those created by the platform such
     * as those used by the system for hardware accelerated View rendering.
     *
     * The capability to disable drawing output is intended for test environments, primarily
     * headless ones. By setting this to false, tests that launch activities or interact with Views
     * can be quicker with less RAM usage by skipping the final step of View drawing. All View
     * lifecycle events will occur as normal, only the final step of rendering on the GPU to the
     * display will be skipped.
     *
     * This can be toggled on and off at will, so screenshot tests can also run in this same
     * environment by toggling drawing back on and forcing a frame to be drawn such as by calling
     * view#invalidate(). Once drawn and the screenshot captured, this can then be turned back off.
     *
     * Backported from android T.
     *
     * @hide
     */
    // TODO: Add link to androidx's Screenshot library for help with this
    @UnsupportedAppUsage
    public static void setDrawingEnabled(boolean drawingEnabled) {
        nSetDrawingEnabled(drawingEnabled);
    }

    private static final class DestroyContextRunnable implements Runnable {
    private static final class DestroyContextRunnable implements Runnable {
        private final long mNativeInstance;
        private final long mNativeInstance;


@@ -1393,4 +1441,8 @@ public class HardwareRenderer {


    private static native void nInitDisplayInfo(int width, int height, float refreshRate,
    private static native void nInitDisplayInfo(int width, int height, float refreshRate,
            int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos);
            int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos);

    private static native void nSetDrawingEnabled(boolean drawingEnabled);

    private static native boolean nIsDrawingEnabled();
}
}
+21 −0
Original line number Original line Diff line number Diff line
@@ -89,6 +89,9 @@ bool Properties::enableWebViewOverlays = true;


StretchEffectBehavior Properties::stretchEffectBehavior = StretchEffectBehavior::ShaderHWUI;
StretchEffectBehavior Properties::stretchEffectBehavior = StretchEffectBehavior::ShaderHWUI;


bool Properties::drawingEnabled = true;
OverrideDrawingEnabled Properties::overrideDrawingEnabled = OverrideDrawingEnabled::Default;

bool Properties::load() {
bool Properties::load() {
    bool prevDebugLayersUpdates = debugLayersUpdates;
    bool prevDebugLayersUpdates = debugLayersUpdates;
    bool prevDebugOverdraw = debugOverdraw;
    bool prevDebugOverdraw = debugOverdraw;
@@ -142,6 +145,11 @@ bool Properties::load() {


    enableWebViewOverlays = base::GetBoolProperty(PROPERTY_WEBVIEW_OVERLAYS_ENABLED, true);
    enableWebViewOverlays = base::GetBoolProperty(PROPERTY_WEBVIEW_OVERLAYS_ENABLED, true);


    drawingEnabled = base::GetBoolProperty(PROPERTY_DRAWING_ENABLED, true);
    if (!drawingEnabled) {
        enableRTAnimations = false;
    }

    return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
    return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
}
}


@@ -211,5 +219,18 @@ void Properties::overrideRenderPipelineType(RenderPipelineType type, bool inUnit
    sRenderPipelineType = type;
    sRenderPipelineType = type;
}
}


void Properties::setDrawingEnabled(bool newDrawingEnabled) {
    overrideDrawingEnabled =
            newDrawingEnabled ? OverrideDrawingEnabled::On : OverrideDrawingEnabled::Off;
    enableRTAnimations = newDrawingEnabled;
}

bool Properties::isDrawingEnabled() {
    if (overrideDrawingEnabled == OverrideDrawingEnabled::Default) {
        return drawingEnabled;
    }
    return overrideDrawingEnabled == OverrideDrawingEnabled::On;
}

}  // namespace uirenderer
}  // namespace uirenderer
}  // namespace android
}  // namespace android
+14 −0
Original line number Original line Diff line number Diff line
@@ -187,6 +187,12 @@ enum DebugLevel {
 */
 */
#define PROPERTY_WEBVIEW_OVERLAYS_ENABLED "debug.hwui.webview_overlays_enabled"
#define PROPERTY_WEBVIEW_OVERLAYS_ENABLED "debug.hwui.webview_overlays_enabled"


/**
 * Property for globally GL drawing state. Can be overridden per process with
 * setDrawingEnabled.
 */
#define PROPERTY_DRAWING_ENABLED "debug.hwui.drawing_enabled"

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Misc
// Misc
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@@ -208,6 +214,8 @@ enum class StretchEffectBehavior {
    UniformScale  // Uniform scale stretch everywhere
    UniformScale  // Uniform scale stretch everywhere
};
};


enum class OverrideDrawingEnabled { Default, On, Off };

/**
/**
 * Renderthread-only singleton which manages several static rendering properties. Most of these
 * Renderthread-only singleton which manages several static rendering properties. Most of these
 * are driven by system properties which are queried once at initialization, and again if init()
 * are driven by system properties which are queried once at initialization, and again if init()
@@ -302,6 +310,12 @@ public:
        stretchEffectBehavior = behavior;
        stretchEffectBehavior = behavior;
    }
    }


    // Represents if GL drawing is enabled. Should only be false in headless testing environments
    static bool drawingEnabled;
    static OverrideDrawingEnabled overrideDrawingEnabled;
    static bool isDrawingEnabled();
    static void setDrawingEnabled(bool enable);

private:
private:
    static StretchEffectBehavior stretchEffectBehavior;
    static StretchEffectBehavior stretchEffectBehavior;
    static ProfileType sProfileType;
    static ProfileType sProfileType;
Loading