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 0d2bddcc8b774..b9a7574a97252 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 @@ -343,9 +343,11 @@ public class StackStateAnimator { for (NotificationStackScrollLayout.AnimationEvent event : animationEvents) { final ExpandableView changingView = (ExpandableView) event.mChangingView; boolean loggable = false; + boolean isHeadsUp = false; String key = null; if (changingView instanceof ExpandableNotificationRow && mLogger != null) { loggable = true; + isHeadsUp = ((ExpandableNotificationRow) changingView).isHeadsUp(); key = ((ExpandableNotificationRow) changingView).getEntry().getKey(); } if (event.animationType == @@ -357,6 +359,9 @@ public class StackStateAnimator { // The position for this child was never generated, let's continue. continue; } + if (loggable && isHeadsUp) { + mLogger.logHUNViewAppearingWithAddEvent(key); + } viewState.applyToView(changingView); mNewAddChildren.add(changingView); @@ -398,9 +403,18 @@ public class StackStateAnimator { translationDirection = Math.max(Math.min(translationDirection, 1.0f),-1.0f); } + Runnable postAnimation = changingView::removeFromTransientContainer; + if (loggable && isHeadsUp) { + mLogger.logHUNViewDisappearingWithRemoveEvent(key); + String finalKey = key; + postAnimation = () -> { + mLogger.disappearAnimationEnded(finalKey); + changingView.removeFromTransientContainer(); + }; + } changingView.performRemoveAnimation(ANIMATION_DURATION_APPEAR_DISAPPEAR, 0 /* delay */, translationDirection, false /* isHeadsUpAppear */, - 0, changingView::removeFromTransientContainer, null); + 0, postAnimation, null); } else if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_REMOVE_SWIPED_OUT) { if (mHostLayout.isFullySwipedOut(changingView)) { @@ -430,8 +444,7 @@ public class StackStateAnimator { // this only captures HEADS_UP_APPEAR animations, but HUNs can appear with normal // ADD animations, which would not be logged here. if (loggable) { - mLogger.logHUNViewAppearing( - ((ExpandableNotificationRow) changingView).getEntry().getKey()); + mLogger.logHUNViewAppearing(key); } mTmpState.applyToView(changingView); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateLogger.kt index 4315265e79ccb..77377af9ddfb4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateLogger.kt @@ -24,6 +24,22 @@ class StackStateLogger @Inject constructor( }) } + fun logHUNViewDisappearingWithRemoveEvent(key: String) { + buffer.log(TAG, LogLevel.ERROR, { + str1 = key + }, { + "Heads up view disappearing $str1 for ANIMATION_TYPE_REMOVE" + }) + } + + fun logHUNViewAppearingWithAddEvent(key: String) { + buffer.log(TAG, LogLevel.ERROR, { + str1 = key + }, { + "Heads up view disappearing $str1 for ANIMATION_TYPE_ADD" + }) + } + fun disappearAnimationEnded(key: String) { buffer.log(TAG, LogLevel.INFO, { str1 = key