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

Commit 446e690b authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Skip HeadsUpManager for silent updates" into main

parents a7a31224 26ea2e5b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -289,6 +289,15 @@ flag {
  }
}

flag {
    name: "notification_skip_silent_updates"
    namespace: "systemui"
    description: "Do not notify HeadsUpManager for silent updates."
    bug: "401068530"
    metadata {
       purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "scene_container"
+51 −22
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.systemui.statusbar.notification.collection.coordinator

import com.android.systemui.Flags.notificationSkipSilentUpdates

import android.app.Notification
import android.app.Notification.GROUP_ALERT_SUMMARY
import android.util.ArrayMap
@@ -465,15 +467,32 @@ constructor(
                            }
                        hunMutator.updateNotification(posted.key, pinnedStatus)
                    }
                } else {
                } else { // shouldHeadsUpEver = false
                    if (posted.isHeadsUpEntry) {
                        if (notificationSkipSilentUpdates()) {
                            if (posted.isPinnedByUser) {
                                // We don't want this to be interrupting anymore, let's remove it
                        // If the notification is pinned by the user, the only way a user can un-pin
                        // it is by tapping the status bar notification chip. Since that's a clear
                        // user action, we should remove the HUN immediately instead of waiting for
                        // any sort of minimum timeout.
                                // If the notification is pinned by the user, the only way a user
                                // can un-pin it by tapping the status bar notification chip. Since
                                // that's a clear user action, we should remove the HUN immediately
                                // instead of waiting for any sort of minimum timeout.
                                // TODO(b/401068530) Ensure that status bar chip HUNs are not
                                //  removed for silent update
                                hunMutator.removeNotification(posted.key,
                                    /* releaseImmediately= */ true)
                            } else {
                                // Do NOT remove HUN for non-user update.
                                // Let the HUN show for its remaining duration.
                            }
                        } else {
                            // We don't want this to be interrupting anymore, let's remove it
                            // If the notification is pinned by the user, the only way a user can
                            // un-pin it is by tapping the status bar notification chip. Since
                            // that's a clear user action, we should remove the HUN immediately
                            // instead of waiting for any sort of minimum timeout.
                            val shouldRemoveImmediately = posted.isPinnedByUser
                            hunMutator.removeNotification(posted.key, shouldRemoveImmediately)
                        }
                    } else {
                        // Don't let the bind finish
                        cancelHeadsUpBind(posted.entry)
@@ -573,10 +592,20 @@ constructor(
                                isBinding = isBinding,
                            )
                    }
                // Handle cancelling heads up here, rather than in the OnBeforeFinalizeFilter, so
                // that
                // work can be done before the ShadeListBuilder is run. This prevents re-entrant
                // behavior between this Coordinator, HeadsUpManager, and VisualStabilityManager.
                if (notificationSkipSilentUpdates()) {
                    // TODO(b/403703828) Move canceling to OnBeforeFinalizeFilter, since we are not
                    //  removing from HeadsUpManager and don't need to deal with re-entrant behavior
                    //  between HeadsUpCoordinator, HeadsUpManager, and VisualStabilityManager.
                    if (posted?.shouldHeadsUpEver == false
                        && !posted.isHeadsUpEntry && posted.isBinding) {
                        // Don't let the bind finish
                        cancelHeadsUpBind(posted.entry)
                    }
                } else {
                    // Handle cancelling heads up here, rather than in the OnBeforeFinalizeFilter,
                    // so that work can be done before the ShadeListBuilder is run. This prevents
                    // re-entrant behavior between this Coordinator, HeadsUpManager, and
                    // VisualStabilityManager.
                    if (posted?.shouldHeadsUpEver == false) {
                        if (posted.isHeadsUpEntry) {
                            // We don't want this to be interrupting anymore, let's remove it
@@ -590,7 +619,7 @@ constructor(
                            cancelHeadsUpBind(posted.entry)
                        }
                    }

                }
                // Update last updated time for this entry
                setUpdateTime(entry, mSystemClock.currentTimeMillis())
            }