Fix NPE in overridePlayingAppAnimations
It's not guaranteed that findMainWindow() is non-null, which can happen
if the window was just added, so we should not crash in that case.
Change-Id: I1f04876ef48bfc7636320124b7f60d6dfa0b24a2
Fixes: 31767124
(cherry picked from commit 6e5f3d2e9fc130cd4118296a50a88f3cddb21fda)
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index a8a0b0e..b1d2edf 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -846,6 +846,9 @@
void overridePlayingAppAnimations(Animation a) {
if (mAppAnimator.isAnimating()) {
final WindowState win = findMainWindow();
+ if (win == null) {
+ return;
+ }
final int width = win.mContainingFrame.width();
final int height = win.mContainingFrame.height();
mAppAnimator.setAnimation(a, width, height, false, STACK_CLIP_NONE);