Fix the animation glitch when NSSL adds and removes a HUN in the same frame.

Bug: 185680162
Fixes: 213876313
Test: visual inspection when legacy pipeline initiates a group alert transfer
Change-Id: I755fff6944da0699d9cb7e6b2456e4811f7888d5
This commit is contained in:
Jeff DeCew
2022-01-13 21:01:11 +00:00
parent 7c3f1a0c88
commit 3572079710

View File

@@ -132,6 +132,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
public static final float BACKGROUND_ALPHA_DIMMED = 0.7f; public static final float BACKGROUND_ALPHA_DIMMED = 0.7f;
private static final String TAG = "StackScroller"; private static final String TAG = "StackScroller";
private static final boolean SPEW = Log.isLoggable(TAG, Log.VERBOSE);
// Delay in milli-seconds before shade closes for clear all. // Delay in milli-seconds before shade closes for clear all.
private final int DELAY_BEFORE_SHADE_CLOSE = 200; private final int DELAY_BEFORE_SHADE_CLOSE = 200;
@@ -3143,6 +3144,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
AnimationEvent event = new AnimationEvent(row, type); AnimationEvent event = new AnimationEvent(row, type);
event.headsUpFromBottom = onBottom; event.headsUpFromBottom = onBottom;
mAnimationEvents.add(event); mAnimationEvents.add(event);
if (SPEW) {
Log.v(TAG, "Generating HUN animation event: "
+ " isHeadsUp=" + isHeadsUp
+ " type=" + type
+ " onBottom=" + onBottom
+ " row=" + row.getEntry().getKey());
}
} }
mHeadsUpChangeAnimations.clear(); mHeadsUpChangeAnimations.clear();
mAddedHeadsUpChildren.clear(); mAddedHeadsUpChildren.clear();
@@ -4677,7 +4685,22 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER) @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) { public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) {
if (mAnimationsEnabled && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed)) { final boolean add = mAnimationsEnabled && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed);
if (SPEW) {
Log.v(TAG, "generateHeadsUpAnimation:"
+ " willAdd=" + add
+ " isHeadsUp=" + isHeadsUp
+ " row=" + row.getEntry().getKey());
}
if (add) {
// If we're hiding a HUN we just started showing THIS FRAME, then remove that event,
// and do not add the disappear event either.
if (!isHeadsUp && mHeadsUpChangeAnimations.remove(new Pair<>(row, true))) {
if (SPEW) {
Log.v(TAG, "generateHeadsUpAnimation: previous hun appear animation cancelled");
}
return;
}
mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp)); mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp));
mNeedsAnimation = true; mNeedsAnimation = true;
if (!mIsExpanded && !mWillExpand && !isHeadsUp) { if (!mIsExpanded && !mWillExpand && !isHeadsUp) {