From 771d8f8fbbf58fbd1038a64c7779a469083c6178 Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Thu, 3 Sep 2020 16:13:01 -0400 Subject: [PATCH] Fix NPE in GlobalScreenshot Bug: 167655989 Fix: 167655989 Test: take screenshot, take another while first is still up, observe that NPE occurs. add null check, repeat, verify that NPE does not occur. Change-Id: I1290f3a556aba5182e3f96ce524efb86364bc3e1 --- .../src/com/android/systemui/screenshot/GlobalScreenshot.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 853897fc54aea..c3c947bc40a88 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -566,7 +566,8 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset private void saveScreenshot(Bitmap screenshot, Consumer finisher, Rect screenRect, Insets screenInsets, boolean showFlash) { if (mScreenshotLayout.isAttachedToWindow()) { - if (!mDismissAnimation.isRunning()) { // if we didn't already dismiss for another reason + // if we didn't already dismiss for another reason + if (mDismissAnimation == null || !mDismissAnimation.isRunning()) { mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_REENTERED); } dismissScreenshot("new screenshot requested", true);