From 17ed4e74ec786f15432b09fe435fbec7fbc6f441 Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Tue, 25 Aug 2020 09:16:27 -0400 Subject: Add log for dismissal when new screenshot is taken Currently, we log when the screenshot UI is dismissed due to timeout, tapping the 'X' button, tapping the preview, or tapping any of the action buttons. However, there is an additional way to cause the UI to be dismissed, which is to take a new screenshot while the UI is up (in which case we dismiss the old UI immediately). We should log this to get a better picture of how people use/interact with the screenshot UI. This change adds the log (previously registered using the uievent cli) and logs when a new screenshot is taken, if there's UI on the screen and we aren't already dismissing for some other reason (to avoid duplicate logs). Bug: 166249049 Test: manual Change-Id: I4a1d7cf8c1309a3198593eef004a2b18f94f809f --- .../src/com/android/systemui/screenshot/GlobalScreenshot.java | 7 ++++++- .../src/com/android/systemui/screenshot/ScreenshotEvent.java | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index c53523032353..853897fc54ae 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -565,7 +565,12 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset private void saveScreenshot(Bitmap screenshot, Consumer finisher, Rect screenRect, Insets screenInsets, boolean showFlash) { - dismissScreenshot("new screenshot requested", true); + if (mScreenshotLayout.isAttachedToWindow()) { + if (!mDismissAnimation.isRunning()) { // if we didn't already dismiss for another reason + mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_REENTERED); + } + dismissScreenshot("new screenshot requested", true); + } mScreenBitmap = screenshot; diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotEvent.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotEvent.java index 20fa991dcc1f..8535d5708a67 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotEvent.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotEvent.java @@ -56,7 +56,9 @@ public enum ScreenshotEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "screenshot interaction timed out") SCREENSHOT_INTERACTION_TIMEOUT(310), @UiEvent(doc = "screenshot explicitly dismissed") - SCREENSHOT_EXPLICIT_DISMISSAL(311); + SCREENSHOT_EXPLICIT_DISMISSAL(311), + @UiEvent(doc = "screenshot reentered for new screenshot") + SCREENSHOT_REENTERED(640); private final int mId; -- cgit v1.2.3-59-g8ed1b