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

Commit 7ef9c265 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Update HUNCoordinator's lifetime extender

Make sure to update the locally stored 'currentHUN' before ending the
lifetime extender. The lifetime extender immediately re-evaluates
whether to lifetime extend and requires the new state to be set in order
to re-evaluate the new state correctly.

Test: manual
  1. Post a HUN via Notify.apk
  2. Try to cancel the notif from the app (Notify.apk)
  Observe: notification is cancelled after the HUN goes away (as opposed
  to not being able to be cancelled)
Change-Id: Ie780e96bff9a5b88ad9823397a513ea05196429c
parent e4a6bce2
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -204,10 +204,8 @@ public class HeadsUpCoordinator implements Coordinator {
        public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
            NotificationEntry newHUN = mHeadsUpManager.getTopEntry();
            if (!Objects.equals(mCurrentHun, newHUN)) {
                endNotifLifetimeExtension();
                mCurrentHun = newHUN;
                mNotifPromoter.invalidateList();
                mNotifSectioner.invalidateList();
                endNotifLifetimeExtension();
            }
            if (!isHeadsUp) {
                mHeadsUpViewBinder.unbindHeadsUpView(entry);
+5 −1
Original line number Diff line number Diff line
@@ -55,6 +55,10 @@ public interface NotifLifetimeExtender {

    /** Callback for notifying the NotifCollection that a lifetime extension has expired.*/
    interface OnEndLifetimeExtensionCallback {
        /**
         * Stop extending the lifetime of `entry` with `extender` and then immediately re-evaluates
         * whether to continue lifetime extending this notification or to remove it.
         */
        void onEndLifetimeExtension(NotifLifetimeExtender extender, NotificationEntry entry);
    }
}