Skip to content
Commit c42b28dd authored by Jeff Brown's avatar Jeff Brown
Browse files

Fix animation start jank due to expensive layout operations.

The Choreographer carefully schedules animation updates to occur
after input but before traversals occur.  This ensures that the
effects of animations are perceived immediately in the next frame.
The start time of animation is usually set the moment the animator
first runs.  The start time serves as a reference for timing the
remainder of the animation.

Setting the start time during the animation callback works well except
when traversals take a long time to complete.  In that case, we may
end up drawing the initial frame of the animation then skipping several
following frames (because a lot of time has already passed since the
animation start time was set), effectively shortening the duration
of the animation.

To resolve this issue, we introduce a new COMMIT phase within the
Choreographer.  The COMMIT callback runs after traversals complete
and may provide an updated frame time that more accurately reflects
the time when the frame finished drawing.

In the case where an animation is just starting, we note the fact
that its initial start time has not yet been committed (the user
hasn't actually seen anything on screen yet).  Then, during the
COMMIT phase, we adjust the animation start time to better reflect
the time when the animation's first frame was drawn, effectively
causing the animation actually start after the expensive traversal
operations occurred such that no frames will be skipped.

Bug: 17258911
Change-Id: I279603d01fd4ed1de8f51a77c62f4fec5e9b746a
parent b9223015
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment