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

Commit faa7a438 authored by Huihong Luo's avatar Huihong Luo Committed by Android (Google) Code Review
Browse files

Merge "Add a sys prop to control WebView Overlays support" into sc-dev

parents 98b57c30 eb93107b
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -1442,8 +1442,10 @@ public final class ViewRootImpl implements ViewParent,
                    if (mHardwareRendererObserver != null) {
                        mAttachInfo.mThreadedRenderer.addObserver(mHardwareRendererObserver);
                    }
                    if (HardwareRenderer.isWebViewOverlaysEnabled()) {
                        addPrepareSurfaceControlForWebviewCallback();
                        addASurfaceTransactionCallback();
                    }
                    mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
                }
            }
@@ -7777,8 +7779,10 @@ public final class ViewRootImpl implements ViewParent,
                }
            }
            if (mAttachInfo.mThreadedRenderer != null) {
                if (HardwareRenderer.isWebViewOverlaysEnabled()) {
                    addPrepareSurfaceControlForWebviewCallback();
                    addASurfaceTransactionCallback();
                }
                mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
            }
        } else {
+5 −0
Original line number Diff line number Diff line
@@ -1304,6 +1304,11 @@ public class HardwareRenderer {
     */
    public static native void preload();

    /**
     * @hide
     */
    public static native boolean isWebViewOverlaysEnabled();

    /** @hide */
    protected static native void setupShadersDiskCache(String cacheFile, String skiaCacheFile);

+4 −0
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ float Properties::defaultSdrWhitePoint = 200.f;
bool Properties::useHintManager = true;
int Properties::targetCpuTimePercentage = 70;

bool Properties::enableWebViewOverlays = false;

StretchEffectBehavior Properties::stretchEffectBehavior = StretchEffectBehavior::ShaderHWUI;

bool Properties::load() {
@@ -137,6 +139,8 @@ bool Properties::load() {
    targetCpuTimePercentage = base::GetIntProperty(PROPERTY_TARGET_CPU_TIME_PERCENTAGE, 70);
    if (targetCpuTimePercentage <= 0 || targetCpuTimePercentage > 100) targetCpuTimePercentage = 70;

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

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

+7 −0
Original line number Diff line number Diff line
@@ -182,6 +182,11 @@ enum DebugLevel {
 */
#define PROPERTY_REDUCE_OPS_TASK_SPLITTING "renderthread.skia.reduceopstasksplitting"

/**
 * Enable WebView Overlays feature.
 */
#define PROPERTY_WEBVIEW_OVERLAYS_ENABLED "debug.hwui.webview_overlays_enabled"

///////////////////////////////////////////////////////////////////////////////
// Misc
///////////////////////////////////////////////////////////////////////////////
@@ -276,6 +281,8 @@ public:
    static bool useHintManager;
    static int targetCpuTimePercentage;

    static bool enableWebViewOverlays;

    static StretchEffectBehavior getStretchEffectBehavior() {
        return stretchEffectBehavior;
    }
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ void WebViewFunctor::drawGl(const DrawGlInfo& drawInfo) {
            .mergeTransaction = currentFunctor.mergeTransaction,
    };

    if (!drawInfo.isLayer) {
    if (Properties::enableWebViewOverlays && !drawInfo.isLayer) {
        renderthread::CanvasContext* activeContext =
                renderthread::CanvasContext::getActiveContext();
        if (activeContext != nullptr) {
Loading