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

Commit f9d37003 authored by Huihong Luo's avatar Huihong Luo Committed by Automerger Merge Worker
Browse files

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

Merge "Add a sys prop to control WebView Overlays support" into sc-dev am: faa7a438 am: f94d22e8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15158764

Change-Id: I36b37b3139deb5919e34afcfd6cc10a5101660e6
parents 618433e2 f94d22e8
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -1457,8 +1457,10 @@ public final class ViewRootImpl implements ViewParent,
                    if (mHardwareRendererObserver != null) {
                    if (mHardwareRendererObserver != null) {
                        mAttachInfo.mThreadedRenderer.addObserver(mHardwareRendererObserver);
                        mAttachInfo.mThreadedRenderer.addObserver(mHardwareRendererObserver);
                    }
                    }
                    if (HardwareRenderer.isWebViewOverlaysEnabled()) {
                        addPrepareSurfaceControlForWebviewCallback();
                        addPrepareSurfaceControlForWebviewCallback();
                        addASurfaceTransactionCallback();
                        addASurfaceTransactionCallback();
                    }
                    mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
                    mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
                }
                }
            }
            }
@@ -7792,8 +7794,10 @@ public final class ViewRootImpl implements ViewParent,
                }
                }
            }
            }
            if (mAttachInfo.mThreadedRenderer != null) {
            if (mAttachInfo.mThreadedRenderer != null) {
                if (HardwareRenderer.isWebViewOverlaysEnabled()) {
                    addPrepareSurfaceControlForWebviewCallback();
                    addPrepareSurfaceControlForWebviewCallback();
                    addASurfaceTransactionCallback();
                    addASurfaceTransactionCallback();
                }
                mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
                mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
            }
            }
        } else {
        } else {
+5 −0
Original line number Original line Diff line number Diff line
@@ -1304,6 +1304,11 @@ public class HardwareRenderer {
     */
     */
    public static native void preload();
    public static native void preload();


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

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


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


bool Properties::enableWebViewOverlays = false;

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


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


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

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


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


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

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


    static bool enableWebViewOverlays;

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


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