From 02b74b9420f0b4adbec6997b950e244ad0dff56c Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Fri, 19 Feb 2016 19:33:26 -0800 Subject: [PATCH] Fix leaking animation Clear animation when destroying window surface. Because we are not stepping in animations for windows if they don't have a surface, we can't use it as a detached wallpaper target animation. When the surface was destroyed while animating, winAnimator.mAnimating was still true, and never got false, because we didn't call stepAnimation on the WindowAnimator anymore. Thus, we were constantly animating, using a lot of battery (surface flinger was constantly pushing frames) and impacting overall system performance. Bug: 27276043 Change-Id: I8b0943da0908c85740dc1113aedb573fb440f162 --- services/core/java/com/android/server/wm/WindowAnimator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java index 38d0711e42b33..85bddee5e1dc0 100644 --- a/services/core/java/com/android/server/wm/WindowAnimator.java +++ b/services/core/java/com/android/server/wm/WindowAnimator.java @@ -530,7 +530,7 @@ public class WindowAnimator { for (int i = windows.size() - 1; i >= 0; i--) { final WindowState win = windows.get(i); WindowStateAnimator winAnimator = win.mWinAnimator; - if (winAnimator.mSurfaceController == null) { + if (winAnimator.mSurfaceController == null || !winAnimator.hasSurface()) { continue; }