From bbd72ff3e5c71e82ff156b82eb0ecf93e9e22431 Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Tue, 13 Jul 2021 15:38:03 -0400 Subject: [PATCH] Offset ghost views by the containing view's location Shared transitions weren't behaving correctly in some cases on phones with display cutouts, because the locations of the shared views are computed based on screen coordinates, but take place in a decor view that may be inset by the display cutout (depending on the target app's behavior around the cutout). This change offsets the ghost views according to the location of the decor view in the screen, so that all adjustments take place in the same coordinate system. Bug: 190757843 Test: manual (tested in screenshots, when the target app does and does not get inset by the cutout) Change-Id: Ia9c3b5f36136c8825c67ce645f6cbdd8e0126fdf --- core/java/android/app/ActivityTransitionCoordinator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/android/app/ActivityTransitionCoordinator.java b/core/java/android/app/ActivityTransitionCoordinator.java index 4b87a647a80b7..f5b3b40d88d6a 100644 --- a/core/java/android/app/ActivityTransitionCoordinator.java +++ b/core/java/android/app/ActivityTransitionCoordinator.java @@ -871,6 +871,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { if (view.isAttachedToWindow()) { tempMatrix.reset(); mSharedElementParentMatrices.get(i).invert(tempMatrix); + decor.transformMatrixToLocal(tempMatrix); GhostView.addGhost(view, decor, tempMatrix); ViewGroup parent = (ViewGroup) view.getParent(); if (moveWithParent && !isInTransitionGroup(parent, decor)) {