Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb38db80 authored by Yining Liu's avatar Yining Liu
Browse files

Invalidate the pipeline list after HUN disappearing animation ends

Issue: a HUN is unpinned by the pipeline during the HUN disappearing
animation, which leads to interrupted animation when the HUN is in a
group. A previous change: 28056592 fixed this issue by leaving the HUN
pinned while during the disappearing animation. This change adds a step
to invalidate the list after the animation stops to allow the
notification to be sorted to the right section.

Bug: 354250568
Flag: com.android.systemui.notification_group_hun_removal_animation_fix
Test: NotificationStackScrollLayoutControllerTest
Change-Id: Ibb4899d8211850033288256c1565dd98ffca0bef
parent d0a151b5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -713,6 +713,10 @@ class HeadsUpCoordinator @Inject constructor(
                endNotifLifetimeExtensionIfExtended(entry)
            }
        }

        override fun onHeadsUpAnimatingAwayEnded(entry: NotificationEntry) {
            mNotifPromoter.invalidateList("headsUpAnimatingAwayEnded: ${entry.logKey}")
        }
    }

    private fun isSticky(entry: NotificationEntry) = mHeadsUpManager.isSticky(entry.key)
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ object GroupHunAnimationFix {
    val token: FlagToken
        get() = FlagToken(FLAG_NAME, isEnabled)

    /** Are sections sorted by time? */
    /** Return whether the fix is enabled */
    @JvmStatic
    inline val isEnabled
        get() = Flags.notificationGroupHunRemovalAnimationFix()
+5 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.row.NotificationGuts;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.row.NotificationSnooze;
import com.android.systemui.statusbar.notification.shared.GroupHunAnimationFix;
import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor;
import com.android.systemui.statusbar.notification.stack.ui.viewbinder.NotificationListViewBinder;
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
@@ -1987,6 +1988,10 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                NotificationEntry entry = row.getEntry();
                mHeadsUpAppearanceController.updateHeader(entry);
                mHeadsUpAppearanceController.updateHeadsUpAndPulsingRoundness(entry);
                if (GroupHunAnimationFix.isEnabled() && !animatingAway) {
                    // invalidate list to make sure the row is sorted to the correct section
                    mHeadsUpManager.onEntryAnimatingAwayEnded(entry);
                }
            });
        }

+9 −0
Original line number Diff line number Diff line
@@ -450,6 +450,15 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {
        }
    }

    /**
     * Called to notify the listeners that the HUN animating away animation has ended.
     */
    public void onEntryAnimatingAwayEnded(@NonNull NotificationEntry entry) {
        for (OnHeadsUpChangedListener listener : mListeners) {
            listener.onHeadsUpAnimatingAwayEnded(entry);
        }
    }

    /**
     * Manager-specific logic, that should occur, when the entry is updated, and its posted time has
     * changed.
+39 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ interface HeadsUpManager : Dumpable {
     *   should be ranked higher and 0 if they are equal.
     */
    fun compare(a: NotificationEntry?, b: NotificationEntry?): Int

    /**
     * Extends the lifetime of the currently showing pulsing notification so that the pulse lasts
     * longer.
@@ -184,6 +185,8 @@ interface HeadsUpManager : Dumpable {
    fun unpinAll(userUnPinned: Boolean)

    fun updateNotification(key: String, shouldHeadsUpAgain: Boolean)

    fun onEntryAnimatingAwayEnded(entry: NotificationEntry)
}

/** Sets the animation state of the HeadsUpManager. */
@@ -204,41 +207,77 @@ interface OnHeadsUpPhoneListenerChange {
/* No op impl of HeadsUpManager. */
class HeadsUpManagerEmptyImpl @Inject constructor() : HeadsUpManager {
    override val allEntries = Stream.empty<NotificationEntry>()

    override fun addHeadsUpPhoneListener(listener: OnHeadsUpPhoneListenerChange) {}

    override fun addListener(listener: OnHeadsUpChangedListener) {}

    override fun addSwipedOutNotification(key: String) {}

    override fun canRemoveImmediately(key: String) = false

    override fun compare(a: NotificationEntry?, b: NotificationEntry?) = 0

    override fun dump(pw: PrintWriter, args: Array<out String>) {}

    override fun extendHeadsUp() {}

    override fun getEarliestRemovalTime(key: String?) = 0L

    override fun getTouchableRegion(): Region? = null

    override fun getTopEntry() = null

    override fun hasPinnedHeadsUp() = false

    override fun isHeadsUpEntry(key: String) = false

    override fun isHeadsUpAnimatingAwayValue() = false

    override fun isSnoozed(packageName: String) = false

    override fun isSticky(key: String?) = false

    override fun isTrackingHeadsUp() = false

    override fun onExpandingFinished() {}

    override fun releaseAllImmediately() {}

    override fun removeListener(listener: OnHeadsUpChangedListener) {}

    override fun removeNotification(key: String, releaseImmediately: Boolean) = false

    override fun removeNotification(key: String, releaseImmediately: Boolean, animate: Boolean) =
        false

    override fun setAnimationStateHandler(handler: AnimationStateHandler) {}

    override fun setExpanded(entry: NotificationEntry, expanded: Boolean) {}

    override fun setGutsShown(entry: NotificationEntry, gutsShown: Boolean) {}

    override fun setHeadsUpAnimatingAway(headsUpAnimatingAway: Boolean) {}

    override fun setRemoteInputActive(entry: NotificationEntry, remoteInputActive: Boolean) {}

    override fun setTrackingHeadsUp(tracking: Boolean) {}

    override fun setUser(user: Int) {}

    override fun setUserActionMayIndirectlyRemove(entry: NotificationEntry) {}

    override fun shouldSwallowClick(key: String): Boolean = false

    override fun showNotification(entry: NotificationEntry) {}

    override fun snooze() {}

    override fun unpinAll(userUnPinned: Boolean) {}

    override fun updateNotification(key: String, alert: Boolean) {}

    override fun onEntryAnimatingAwayEnded(entry: NotificationEntry) {}
}

@Module
Loading