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

Commit fec057a6 authored by mattsziklay's avatar mattsziklay
Browse files

Use ValueAnimator#end instead of manually setting frame.

Removes update listeners and calls ValueAnimator#end when we want to
finish the veil fade prematurely. This avoids a crash that was caused by
setting the end frame manually.

Bug: 300145351
Test: Manual
Change-Id: I4a3e05417aec66cd7a038df94a39e47986e2ba0c
parent 1ade2aac
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -132,6 +132,13 @@ public class ResizeVeil {
                t.setAlpha(mVeilSurface, mVeilAnimator.getAnimatedFraction());
                t.apply();
            });
            mVeilAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    t.setAlpha(mVeilSurface, 1);
                    t.apply();
                }
            });

            final ValueAnimator iconAnimator = new ValueAnimator();
            iconAnimator.setFloatValues(0f, 1f);
@@ -192,8 +199,8 @@ public class ResizeVeil {
     */
    public void updateResizeVeil(SurfaceControl.Transaction t, Rect newBounds) {
        if (mVeilAnimator != null && mVeilAnimator.isStarted()) {
            // TODO(b/300145351): Investigate why ValueAnimator#end does not work here.
            mVeilAnimator.setCurrentPlayTime(RESIZE_ALPHA_DURATION);
            mVeilAnimator.removeAllUpdateListeners();
            mVeilAnimator.end();
        }
        relayout(newBounds, t);
        mViewHost.getView().getViewRootImpl().applyTransactionOnDraw(t);