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
This commit is contained in:
Miranda Kephart
2021-06-09 14:36:37 -04:00
parent 0d5d58a15f
commit da23820f40

View File

@@ -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();
}
}
});
});