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

Commit ee927d35 authored by Yining Liu's avatar Yining Liu Committed by Android (Google) Code Review
Browse files

Merge changes I819a942d,Ibb4899d8 into main

* changes:
  Format HeadsUpCoordinator
  Invalidate the pipeline list after HUN disappearing animation ends
parents 5396e5f0 d8fcc9dc
Loading
Loading
Loading
Loading
+463 −386

File changed.

Preview size limit exceeded, changes collapsed.

+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
@@ -463,6 +463,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