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

Commit b5d6687c authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed a bug where the scrim could flash black when snoozing huns

Because of an underflow the alpha could actually become 0xff instead
off 0 which would be visible as a black scrim. This was because of
our local updating of animators.

Change-Id: I4201a4bbfbc7cbf32819f4814c165d0e11adaadb
Fixes: 28840532
parent c2c0b043
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -322,6 +322,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        if (scrim instanceof ScrimView) {
            float alpha2 = getDozeAlpha(scrim);
            float alpha = 1 - (1 - alpha1) * (1 - alpha2);
            alpha = Math.max(0, Math.min(1.0f, alpha));
            ((ScrimView) scrim).setScrimColor(Color.argb((int) (alpha * 255), 0, 0, 0));
        } else {
            scrim.setAlpha(alpha1);
@@ -468,6 +469,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
                    PropertyValuesHolder[] values = previousAnimator.getValues();
                    float relativeDiff = alpha - previousEndValue;
                    float newStartValue = previousStartValue + relativeDiff;
                    newStartValue = Math.max(0, Math.min(1.0f, newStartValue));
                    values[0].setFloatValues(newStartValue, alpha);
                    scrim.setTag(TAG_START_ALPHA, newStartValue);
                    scrim.setTag(TAG_END_ALPHA, alpha);