Fix the crash in AnimatorManager.

If we have >1 mAnimators and also the animator target changes,
`onAnimatorTargetChanged` function will erase mAnimators vector, while
in AnimatorManager::pushStaging, the process still does the loop for
mAnimators. Thus the crash happens.

Bug: 327666562
Test: n/a
Change-Id: I928185a2654b49660e226dcc89a2bc116cec870f
diff --git a/libs/hwui/AnimatorManager.cpp b/libs/hwui/AnimatorManager.cpp
index 0780414..8645995 100644
--- a/libs/hwui/AnimatorManager.cpp
+++ b/libs/hwui/AnimatorManager.cpp
@@ -90,7 +90,13 @@
         }
         mCancelAllAnimators = false;
     } else {
-        for (auto& animator : mAnimators) {
+        // create a copy of mAnimators as onAnimatorTargetChanged can erase mAnimators.
+        FatVector<sp<BaseRenderNodeAnimator>> animators;
+        animators.reserve(mAnimators.size());
+        for (const auto& animator : mAnimators) {
+            animators.push_back(animator);
+        }
+        for (auto& animator : animators) {
             animator->pushStaging(mAnimationHandle->context());
         }
     }