Additional null-checks for animations in case child views are removed at an inopportune time.
Bug: 159765493
Test: manual
Change-Id: Id3856cbf73aa855cb44035656d7c86e20594d84f
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java
index 98a7cc2..6e6f82b 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java
@@ -441,7 +441,10 @@
// Cancel physics animations on the view.
for (DynamicAnimation.ViewProperty property : mController.getAnimatedProperties()) {
- getAnimationFromView(property, view).cancel();
+ final DynamicAnimation animationFromView = getAnimationFromView(property, view);
+ if (animationFromView != null) {
+ animationFromView.cancel();
+ }
}
}
@@ -499,13 +502,13 @@
* Retrieves the animation of the given property from the view at the given index via the view
* tag system.
*/
- private SpringAnimation getAnimationAtIndex(
+ @Nullable private SpringAnimation getAnimationAtIndex(
DynamicAnimation.ViewProperty property, int index) {
return getAnimationFromView(property, getChildAt(index));
}
/** Retrieves the animation of the given property from the view via the view tag system. */
- private SpringAnimation getAnimationFromView(
+ @Nullable private SpringAnimation getAnimationFromView(
DynamicAnimation.ViewProperty property, View view) {
return (SpringAnimation) view.getTag(getTagIdForProperty(property));
}
@@ -536,8 +539,10 @@
final float offset = mController.getOffsetForChainedPropertyAnimation(property);
if (nextAnimInChain < getChildCount()) {
- getAnimationAtIndex(property, nextAnimInChain)
- .animateToFinalPosition(value + offset);
+ final SpringAnimation nextAnim = getAnimationAtIndex(property, nextAnimInChain);
+ if (nextAnim != null) {
+ nextAnim.animateToFinalPosition(value + offset);
+ }
}
});