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

Commit f7917e65 authored by Chet Haase's avatar Chet Haase
Browse files

Fix AnimationDrawable double-start bug

AnimationDrawable.setVisible(true, true) was not correctly recording
the fact that it had started the animation, so it was possible to call
start(0 immediately afterwards and have two animations running on the
drawable in parallel, resulting in incorrect frame ordering.

Issue #5782773

Change-Id: Ifc328f755a51d10ab76b84006d1999df03d2dca1
parent 01583ef7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import android.util.AttributeSet;
 * <p>spin_animation.xml file in res/drawable/ folder:</p>
 * <pre>&lt;!-- Animation frames are wheel0.png -- wheel5.png files inside the
 * res/drawable/ folder --&gt;
 * &lt;animation-list android:id=&quot;selected&quot; android:oneshot=&quot;false&quot;&gt;
 * &lt;animation-list android:id=&quot;@+id/selected&quot; android:oneshot=&quot;false&quot;&gt;
 *    &lt;item android:drawable=&quot;@drawable/wheel0&quot; android:duration=&quot;50&quot; /&gt;
 *    &lt;item android:drawable=&quot;@drawable/wheel1&quot; android:duration=&quot;50&quot; /&gt;
 *    &lt;item android:drawable=&quot;@drawable/wheel2&quot; android:duration=&quot;50&quot; /&gt;
@@ -216,6 +216,8 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An
            unscheduleSelf(this);
        }
        if (animate) {
            // Unscheduling may have clobbered this value; restore it to record that we're animating
            mCurFrame = frame;
            scheduleSelf(this, SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]);
        }
    }