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

Commit f8b88cd8 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Fix 1-frame delay when rendering NSSL inside Flexiglass

Fixes: 325467496
Test: manual flexi testing
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: I406828960b18075c0021740e353ff5a901f1397c
parent b693882e
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -316,6 +316,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            = new ViewTreeObserver.OnPreDrawListener() {
        @Override
        public boolean onPreDraw() {
            if (SceneContainerFlag.isEnabled() && !mChildrenUpdateRequested) {
                getViewTreeObserver().removeOnPreDrawListener(this);
                return true;
            }
            updateForcedScroll();
            updateChildren();
            mChildrenUpdateRequested = false;
@@ -677,7 +681,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                res.getBoolean(R.bool.config_drawNotificationBackground);
        setOutlineProvider(mOutlineProvider);

        boolean willDraw = mShouldDrawNotificationBackground || mDebugLines;
        // We could set this whenever we 'requestChildUpdate' much like the viewTreeObserver, but
        // that adds a bunch of complexity, and drawing nothing isn't *that* expensive.
        boolean willDraw = SceneContainerFlag.isEnabled()
                || mShouldDrawNotificationBackground || mDebugLines;
        setWillNotDraw(!willDraw);
        mBackgroundPaint.setAntiAlias(true);
        if (mDebugLines) {
@@ -813,7 +820,18 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        }
    }

    private void onJustBeforeDraw() {
        if (SceneContainerFlag.isEnabled()) {
            if (mChildrenUpdateRequested) {
                updateForcedScroll();
                updateChildren();
                mChildrenUpdateRequested = false;
            }
        }
    }

    protected void onDraw(Canvas canvas) {
        onJustBeforeDraw();
        if (mShouldDrawNotificationBackground
                && (mSections[0].getCurrentBounds().top
                < mSections[mSections.length - 1].getCurrentBounds().bottom