From c42db8df8bc6205ecdda5d5a36e8a4bffbde146a Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 4 Dec 2018 13:29:25 -0800 Subject: [PATCH] Fixed an issue when launching notification groups The clipping on the bottom wasn't calculated accurately Change-Id: Iaf4aab575418ce8477503ae3079f9913f8b669f6 Fixes: 110093221 Test: launch group, observe normal animation --- .../notification/ActivityLaunchAnimator.java | 4 ++++ .../notification/row/ExpandableNotificationRow.java | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java index f506753379a4c..f899863dcc6b3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java @@ -299,6 +299,10 @@ public class ActivityLaunchAnimator { return top; } + public int getBottom() { + return bottom; + } + public int getWidth() { return right - left; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index d4d45ea52a853..1c0052e879fd8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -2001,7 +2001,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView float interpolation = Interpolators.FAST_OUT_SLOW_IN.getInterpolation(params.getProgress()); int startClipTopAmount = params.getStartClipTopAmount(); if (mNotificationParent != null) { - top -= mNotificationParent.getTranslationY(); + float parentY = mNotificationParent.getTranslationY(); + top -= parentY; mNotificationParent.setTranslationZ(translationZ); int parentStartClipTopAmount = params.getParentStartClipTopAmount(); if (startClipTopAmount != 0) { @@ -2011,8 +2012,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mNotificationParent.setClipTopAmount(clipTopAmount); } mNotificationParent.setExtraWidthForClipping(extraWidthForClipping); - mNotificationParent.setMinimumHeightForClipping(params.getHeight() - + mNotificationParent.getActualHeight()); + float clipBottom = Math.max(params.getBottom(), + parentY + mNotificationParent.getActualHeight() + - mNotificationParent.getClipBottomAmount()); + float clipTop = Math.min(params.getTop(), parentY); + int minimumHeightForClipping = (int) (clipBottom - clipTop); + mNotificationParent.setMinimumHeightForClipping(minimumHeightForClipping); } else if (startClipTopAmount != 0) { int clipTopAmount = (int) MathUtils.lerp(startClipTopAmount, 0, interpolation); setClipTopAmount(clipTopAmount);