diff options
author | 2016-08-02 18:24:42 +0000 | |
---|---|---|
committer | 2016-08-02 18:24:42 +0000 | |
commit | 4ec05be5352620daba384252c569248c96a6ca05 (patch) | |
tree | 673cc56f5cfc5495d12b50d0ab52966269ba0b87 | |
parent | a1dee422fdfa168a28d42876a462e3587fbcb069 (diff) | |
parent | 70b6080cd7eabe7a30bf2d4e2eca2325dc1ff4f0 (diff) |
Put VD animators on paused list when RT stops drawing am: c82e879e56
am: 70b6080cd7
Change-Id: I2ad721d1e9a20e5a1946a779ac0e84118b017505
-rw-r--r-- | core/jni/android_view_ThreadedRenderer.cpp | 16 | ||||
-rw-r--r-- | libs/hwui/AnimationContext.h | 2 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp index f9223f05c601..9c0a65a60606 100644 --- a/core/jni/android_view_ThreadedRenderer.cpp +++ b/core/jni/android_view_ThreadedRenderer.cpp @@ -242,6 +242,16 @@ public: mPausedVDAnimators.clear(); } + // Move all the animators to the paused list, and send a delayed message to notify the finished + // listener. + void pauseAnimators() { + mPausedVDAnimators.insert(mRunningVDAnimators.begin(), mRunningVDAnimators.end()); + for (auto& anim : mRunningVDAnimators) { + detachVectorDrawableAnimator(anim.get()); + } + mRunningVDAnimators.clear(); + } + void doAttachAnimatingNodes(AnimationContext* context) { for (size_t i = 0; i < mPendingAnimatingRenderNodes.size(); i++) { RenderNode* node = mPendingAnimatingRenderNodes[i].get(); @@ -415,8 +425,8 @@ public: postOnFinishedEvents(); } - virtual void detachAnimators() override { - mRootNode->detachAnimators(); + virtual void pauseAnimators() override { + mRootNode->pauseAnimators(); } virtual void callOnFinished(BaseRenderNodeAnimator* animator, AnimationListener* listener) { @@ -426,7 +436,7 @@ public: virtual void destroy() { AnimationContext::destroy(); - detachAnimators(); + mRootNode->detachAnimators(); postOnFinishedEvents(); } diff --git a/libs/hwui/AnimationContext.h b/libs/hwui/AnimationContext.h index 97b53b044a1b..71ee8602a29f 100644 --- a/libs/hwui/AnimationContext.h +++ b/libs/hwui/AnimationContext.h @@ -100,7 +100,7 @@ public: ANDROID_API virtual void destroy(); - ANDROID_API virtual void detachAnimators() {} + ANDROID_API virtual void pauseAnimators() {} private: friend class AnimationHandle; diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index c6b258b5287b..dafe1d11bbc9 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -326,7 +326,7 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo, void CanvasContext::stopDrawing() { mRenderThread.removeFrameCallback(this); - mAnimationContext->detachAnimators(); + mAnimationContext->pauseAnimators(); } void CanvasContext::notifyFramePending() { |