diff options
| author | Tiger Huang <tigerhuang@google.com> | 2020-02-13 16:07:01 +0800 |
|---|---|---|
| committer | Jorim Jaggi <jjaggi@google.com> | 2020-02-13 18:19:38 +0000 |
| commit | f0ef89a522fb62f0cb22fb75a41b2f4a8873b023 (patch) | |
| tree | 8e04bd9c7af44caa027e5934e217902b9aba4228 /core/java | |
| parent | a00008934115e91bb0a41b67c16268763f35ee6e (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.java | 4 |
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 |
