diff options
| -rw-r--r-- | packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt index f7e0d588407f..3ccf5e4fbdd0 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt @@ -209,8 +209,13 @@ open class GhostedViewLaunchAnimatorController( val heightRatio = state.height.toFloat() / ghostedViewState.height val scale = min(widthRatio, heightRatio) + if (ghostedView.parent is ViewGroup) { + // Recalculate the matrix in case the ghosted view moved. We ensure that the ghosted + // view is still attached to a ViewGroup, otherwise calculateMatrix will throw. + GhostView.calculateMatrix(ghostedView, launchContainer, ghostViewMatrix) + } + launchContainer.getLocationOnScreen(launchContainerLocation) - GhostView.calculateMatrix(ghostedView, launchContainer, ghostViewMatrix) ghostViewMatrix.postScale( scale, scale, ghostedViewState.centerX - launchContainerLocation[0], |