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

Commit 0c07fe50 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Recompute scrim alpha when enabling expansion" into rvc-dev

parents 74b6caa2 30c7d961
Loading
Loading
Loading
Loading
+25 −18
Original line number Diff line number Diff line
@@ -440,24 +440,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
            if (!(relevantState && mExpansionAffectsAlpha)) {
                return;
            }
            applyExpansionToAlpha();
            if (mUpdatePending) {
                return;
            }
            setOrAdaptCurrentAnimation(mScrimBehind);
            setOrAdaptCurrentAnimation(mScrimInFront);
            setOrAdaptCurrentAnimation(mScrimForBubble);
            dispatchScrimState(mScrimBehind.getViewAlpha());

            // Reset wallpaper timeout if it's already timeout like expanding panel while PULSING
            // and docking.
            if (mWallpaperVisibilityTimedOut) {
                mWallpaperVisibilityTimedOut = false;
                DejankUtils.postAfterTraversal(() -> {
                    mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(),
                            AlarmTimeout.MODE_IGNORE_IF_SCHEDULED);
                });
            }
            applyAndDispatchExpansion();
        }
    }

@@ -513,6 +496,27 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
        }
    }

    private void applyAndDispatchExpansion() {
        applyExpansionToAlpha();
        if (mUpdatePending) {
            return;
        }
        setOrAdaptCurrentAnimation(mScrimBehind);
        setOrAdaptCurrentAnimation(mScrimInFront);
        setOrAdaptCurrentAnimation(mScrimForBubble);
        dispatchScrimState(mScrimBehind.getViewAlpha());

        // Reset wallpaper timeout if it's already timeout like expanding panel while PULSING
        // and docking.
        if (mWallpaperVisibilityTimedOut) {
            mWallpaperVisibilityTimedOut = false;
            DejankUtils.postAfterTraversal(() -> {
                mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(),
                        AlarmTimeout.MODE_IGNORE_IF_SCHEDULED);
            });
        }
    }

    /**
     * Sets the given drawable as the background of the scrim that shows up behind the
     * notifications.
@@ -1006,6 +1010,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo

    public void setExpansionAffectsAlpha(boolean expansionAffectsAlpha) {
        mExpansionAffectsAlpha = expansionAffectsAlpha;
        if (expansionAffectsAlpha) {
            applyAndDispatchExpansion();
        }
    }

    public void setKeyguardOccluded(boolean keyguardOccluded) {