From 6e830364a6053e73465fafc43554cbd13265deb3 Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Mon, 12 Dec 2022 11:09:07 -0500 Subject: [PATCH] Switch to "quiet" screenshot success when window destroyed Currently, if the screenshot UI is dismissed before the screenshot finishes saving, we'll get a spurious "SCREENSHOT_INTERACTION_TIMEOUT" log. This is because the screenshot saving triggers "showUiOnActionsReady", which updates the UI and resets the timeout. Updating the UI is a no-op in this situation since the window/view are no longer attached, but the timeout is reset, causing a timeout log six seconds later. It doesn't make any sense to try to show UI after dismissal, so we should just do the same thing we do for the "old" screenshot during successive screenshots and save silently. Bug: 262242456 Fix: 262242456 Test: make statsd_testdrive && $ANDROID_HOST_OUT/bin/statsd_testdrive 90 Change-Id: I0de70d839502c7799da8a8b31e69cfbca0955bd4 --- .../com/android/systemui/screenshot/ScreenshotController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java index a6447a5bf5006..5716a1d7260c8 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java @@ -448,6 +448,10 @@ public class ScreenshotController { // Any cleanup needed when the service is being destroyed. void onDestroy() { + if (mSaveInBgTask != null) { + // just log success/failure for the pre-existing screenshot + mSaveInBgTask.setActionsReadyListener(this::logSuccessOnActionsReady); + } removeWindow(); releaseMediaPlayer(); releaseContext();