Move shared end pending anim logic for reusability

Some of the logic in endAnimations and endAnimation is shared and should
be moved to a common helper method.

Test: Builds and functions as before
Change-Id: I4973d50ad8778bb397938b5d65d9f95f48ff145b
1 file changed