Merge "Log non-hun animations on hun views"

This commit is contained in:
Jay Aliomer
2022-01-31 20:44:27 +00:00
committed by Android (Google) Code Review
2 changed files with 32 additions and 3 deletions

View File

@@ -344,9 +344,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 ==
@@ -358,6 +360,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);
@@ -399,9 +404,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)) {
@@ -431,8 +445,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);

View File

@@ -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