Fix RuntimeException in LauncherViewPropertyAnimator
Bug #5869237
Change-Id: Ib1466ea7aaabc1c42626789d7c8ef48134b49bfd
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 45a9e31..33ca887 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2312,13 +2312,18 @@
}
if (delayAnim) {
+ final AnimatorSet stateAnimation = mStateAnimation;
final OnGlobalLayoutListener delayedStart = new OnGlobalLayoutListener() {
public void onGlobalLayout() {
mWorkspace.post(new Runnable() {
public void run() {
- // Need to update pivots for zoom if layout changed
- setPivotsForZoom(toView, scale);
- mStateAnimation.start();
+ // Check that mStateAnimation hasn't changed while
+ // we waited for a layout pass
+ if (mStateAnimation == stateAnimation) {
+ // Need to update pivots for zoom if layout changed
+ setPivotsForZoom(toView, scale);
+ mStateAnimation.start();
+ }
}
});
observer.removeGlobalOnLayoutListener(this);