summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTiger Huang <tigerhuang@google.com>2020-02-13 16:07:01 +0800
committerJorim Jaggi <jjaggi@google.com>2020-02-13 18:19:38 +0000
commitf0ef89a522fb62f0cb22fb75a41b2f4a8873b023 (patch)
tree8e04bd9c7af44caa027e5934e217902b9aba4228 /core/java
parenta00008934115e91bb0a41b67c16268763f35ee6e (diff)
Abort dispatching animation callbacks if the root view is gone
This CL prevents possible NullPointerExceptions. Bug: 118118435 Bug: 149479853 Test: atest AnimatedVectorDrawableParameterizedTest Change-Id: I966a15c0886b80317a34541fb315b2886981af16
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/InsetsController.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 54de1bb3739d..943572f56a1b 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -39,7 +39,6 @@ import android.util.Log;
import android.util.Pair;
import android.util.Property;
import android.util.SparseArray;
-import android.view.InputDevice.MotionRange;
import android.view.InsetsSourceConsumer.ShowResult;
import android.view.InsetsState.InternalInsetsType;
import android.view.SurfaceControl.Transaction;
@@ -855,6 +854,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
} else {
hideDirectly(types);
}
+ if (mViewRoot.mView == null) {
+ return;
+ }
mViewRoot.mView.dispatchWindowInsetsAnimationPrepare(animation);
mViewRoot.mView.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
@Override