From 93f0ca79c90a53ecfdb0fc9f1a5c7d8be3606c56 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 27 May 2021 15:53:25 +0200 Subject: [PATCH] Fixed an issue where the footerview and others would fly over the screen Because we were placing them at their current positions instead of the viewstates position, the view could be placed completely wrong. This also fixes that this logic didn't actually apply to decor views as those don't generate an add / remove animation. Fixes: 188529208 Test: add notifications, drag down on lockscreen, observe no footer flying Change-Id: Ie44d6a8e668dc092670f007d7979750e9041a4f9 --- .../notification/stack/StackStateAnimator.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java index faeb12c0866f4..883f9f26c518b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java @@ -31,6 +31,7 @@ import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; +import com.android.systemui.statusbar.notification.row.StackScrollerDecorView; import java.util.ArrayList; import java.util.HashSet; @@ -187,11 +188,17 @@ public class StackStateAnimator { private void adaptDurationWhenGoingToFullShade(ExpandableView child, ExpandableViewState viewState, boolean wasAdded, int animationStaggerCount) { - if (wasAdded && mAnimationFilter.hasGoToFullShadeEvent) { - child.setTranslationY(child.getTranslationY() + mGoToFullShadeAppearingTranslation); - float longerDurationFactor = (float) Math.pow(animationStaggerCount, 0.7f); - mAnimationProperties.duration = ANIMATION_DURATION_APPEAR_DISAPPEAR + 50 + - (long) (100 * longerDurationFactor); + boolean isDecorView = child instanceof StackScrollerDecorView; + boolean needsAdjustment = wasAdded || isDecorView; + if (needsAdjustment && mAnimationFilter.hasGoToFullShadeEvent) { + int startOffset = 0; + if (!isDecorView) { + startOffset = mGoToFullShadeAppearingTranslation; + float longerDurationFactor = (float) Math.pow(animationStaggerCount, 0.7f); + mAnimationProperties.duration = ANIMATION_DURATION_APPEAR_DISAPPEAR + 50 + + (long) (100 * longerDurationFactor); + } + child.setTranslationY(viewState.yTranslation + startOffset); } }