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

Commit 7fb80f7d authored by Philip Quinn's avatar Philip Quinn
Browse files

Update the mTotalDuration for each animation in an AnimatorSet.

A cache was introduced in I677bc289f2ba430466f2d90ebc14368cb7b75118 to
optimise calls to createDependencyGraph(), but the update was removed in
If1dc6e8dbc93a4bf5ade8c5b0dcf43d3ee6ba7b5. This patch reintroduces the
update when calculating child animation start/end times to re-enable the
optimisation.

Test: cts-tradefed run cts-dev --module CtsAnimationTestCases
Change-Id: Ie9dad4049c07a151889b57809bf844ab854ff482
parent de56e8e6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1651,6 +1651,8 @@ public final class AnimatorSet extends Animator implements AnimationHandler.Anim
        int childrenSize = parent.mChildNodes.size();
        for (int i = 0; i < childrenSize; i++) {
            Node child = parent.mChildNodes.get(i);
            child.mTotalDuration = child.mAnimation.getTotalDuration();  // Update cached duration.

            int index = visited.indexOf(child);
            if (index >= 0) {
                // Child has been visited, cycle found. Mark all the nodes in the cycle.
@@ -1677,9 +1679,8 @@ public final class AnimatorSet extends Animator implements AnimationHandler.Anim
                        child.mStartTime = parent.mEndTime;
                    }

                    long duration = child.mAnimation.getTotalDuration();
                    child.mEndTime = duration == DURATION_INFINITE ?
                            DURATION_INFINITE : child.mStartTime + duration;
                    child.mEndTime = child.mTotalDuration == DURATION_INFINITE
                            ? DURATION_INFINITE : child.mStartTime + child.mTotalDuration;
                }
            }
            updatePlayTime(child, visited);