Make screenshot animation display over cutout area

The screenshot preview is inset to avoid showing on top of the
cutout. However, the animation should display on top of the cutout,
since the screenshot is of the whole screen and includes the cutout.
This change shifts the start position of the animation by the
amount of the insets.

Bug: 191384262
Fix: 191384262
Test: manual
Change-Id: I2cfa0a7d9fec49b3c00f28f6127527b899cf131b
This commit is contained in:
Miranda Kephart
2021-06-17 15:27:37 -04:00
parent 0d5d58a15f
commit fcbf4c9800

View File

@@ -479,6 +479,11 @@ public class ScreenshotView extends FrameLayout implements
final PointF finalPos = new PointF(targetPosition.exactCenterX(),
targetPosition.exactCenterY());
// Shift to screen coordinates so that the animation runs on top of the entire screen,
// including e.g. bars covering the display cutout.
int[] locInScreen = mScreenshotPreview.getLocationOnScreen();
startPos.offset(targetPosition.left - locInScreen[0], targetPosition.top - locInScreen[1]);
if (DEBUG_ANIM) {
Log.d(TAG, "toCorner: startPos=" + startPos);
Log.d(TAG, "toCorner: finalPos=" + finalPos);