Fix race condition

 Bug: 17372309

 AnimationContext::startFrame() happens both with and without
 the UI thread lock. Pass the TraversalMode into it so
 that ThreadedRenderer's subclass can correctly decide
 when it is safe to push over mPendingAnimatingRenderNodes, as doing
 so outside of the lock is Very Bad.

Change-Id: Ife5dd3a2b46b0a207cd9234c159a674afdbf5efd
diff --git a/libs/hwui/AnimationContext.cpp b/libs/hwui/AnimationContext.cpp
index 716dcf5..a20bdae 100644
--- a/libs/hwui/AnimationContext.cpp
+++ b/libs/hwui/AnimationContext.cpp
@@ -17,7 +17,6 @@
 
 #include "Animator.h"
 #include "RenderNode.h"
-#include "TreeInfo.h"
 #include "renderthread/TimeLord.h"
 
 namespace android {
@@ -34,7 +33,7 @@
 }
 
 void AnimationContext::destroy() {
-    startFrame();
+    startFrame(TreeInfo::MODE_RT_ONLY);
     while (mCurrentFrameAnimations.mNextHandle) {
         AnimationHandle* current = mCurrentFrameAnimations.mNextHandle;
         AnimatorManager& animators = current->mRenderNode->animators();
@@ -55,7 +54,7 @@
     handle->insertAfter(&mNextFrameAnimations);
 }
 
-void AnimationContext::startFrame() {
+void AnimationContext::startFrame(TreeInfo::TraversalMode mode) {
     LOG_ALWAYS_FATAL_IF(mCurrentFrameAnimations.mNextHandle,
             "Missed running animations last frame!");
     AnimationHandle* head = mNextFrameAnimations.mNextHandle;