From da23820f401322c61738af6c680dd06ae0cf8188 Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Wed, 9 Jun 2021 14:36:37 -0400 Subject: [PATCH] End screenshot animation early on layout change If the phone configuration changes (e.g. we switch orientations) mid-animation into the corner, the destination bounds are no longer correct, so we end up in a weird state. Ending the screenshot animation early on configuration changes fixes this problem. Bug: 190545541 Fix: 190545541 Test: manual (take screenshot in landscape, rotate while animation is happening, observe results) Change-Id: I53c44263f7994ee6c5c4f7a0b1cbb7df36b24afe --- .../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 5efa1b2992b2b..aea8849adc244 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java @@ -573,6 +573,10 @@ public class ScreenshotController { mScreenshotView.updateDisplayCutoutMargins( mWindowManager.getCurrentWindowMetrics().getWindowInsets() .getDisplayCutout()); + // screenshot animation calculations won't be valid anymore, so just end + if (mScreenshotAnimation != null && mScreenshotAnimation.isRunning()) { + mScreenshotAnimation.end(); + } } }); });