From 88f2924225b303f84f9da00f917471a9406b3ac2 Mon Sep 17 00:00:00 2001 From: Matt Casey Date: Wed, 7 Jul 2021 16:43:22 -0400 Subject: [PATCH] Don't try to load a long screenshot image more than once If the preview already has a drawable onStart, there's nothing else to do. Previously we'd always try to load an image onStart which would break if onStart wasn't caused by either an initial load or a state restoration. Bug: 193045988 Test: When cropping long screenshot, swipe up to overview, then return. Previously, the activity would disappear, now it continues undisturbed. Change-Id: Ief1f10ce621e7f25bf3acbcf04ad3b6c04a28577 --- .../android/systemui/screenshot/LongScreenshotActivity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java b/packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java index af0141c81d589..d1b01853c1b41 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java @@ -164,6 +164,11 @@ public class LongScreenshotActivity extends Activity { Log.d(TAG, "onStart"); super.onStart(); + if (mPreview.getDrawable() != null) { + // We already have an image, so no need to try to load again. + return; + } + if (mCacheLoadFuture != null) { Log.d(TAG, "mCacheLoadFuture != null"); final ListenableFuture future = mCacheLoadFuture;