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

Commit 56ca197c authored by Mady Mellor's avatar Mady Mellor
Browse files

Only notify bubbles if the notification panel expansion has changed

This callback is triggered for a couple of other changes, not just
for the notification panel expansion changing. This CL saves the
previous panel state and only triggers the bubble's callback if the
state was different.

Flag: None
Test: manual - observe logs that we're only notified when it actually
               changes
Bug: 323592544
Change-Id: Ic715e8d4774f8c0025cd1d943ed0bf3de129a129
parent 3459cd0e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ public class BubblesManager {
    // TODO (b/145659174): allow for multiple callbacks to support the "shadow" new notif pipeline
    private final List<NotifCallback> mCallbacks = new ArrayList<>();
    private final StatusBarWindowCallback mStatusBarWindowCallback;
    private boolean mPanelExpanded;

    /**
     * Creates {@link BubblesManager}, returns {@code null} if Optional {@link Bubbles} not present
@@ -242,8 +243,12 @@ public class BubblesManager {
        // Store callback in a field so it won't get GC'd
        mStatusBarWindowCallback =
                (keyguardShowing, keyguardOccluded, keyguardGoingAway, bouncerShowing, isDozing,
                        panelExpanded, isDreaming) ->
                        panelExpanded, isDreaming) -> {
                    if (panelExpanded != mPanelExpanded) {
                        mPanelExpanded = panelExpanded;
                        mBubbles.onNotificationPanelExpandedChanged(panelExpanded);
                    }
                };
        notificationShadeWindowController.registerCallback(mStatusBarWindowCallback);

        mSysuiProxy = new Bubbles.SysuiProxy() {