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

Commit b175ed94 authored by Ned Burns's avatar Ned Burns
Browse files

Remove onBeginDispatchToListeners from CollectionReadyForBuildListener

I honestly can't remember why we needed this in the first place. But it
also conflicts with a few upcoming concepts:

- Notification batching (we might get multiple dispatchToListeners calls
before we get a single onBuildList call)
- Update debouncing (same issue)

So we're just going to remove it until we come up with a reason to want
it.

Test: atest SystemUITests
Change-Id: I47cb9c8b037af9daba64e1f59b20beddf138cce4
parent e6855d6e
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -23,18 +23,6 @@ import java.util.Collection;
 * filtered, and grouped list of currently visible notifications.
 */
public interface CollectionReadyForBuildListener {
    /**
     * Called after the NotifCollection has received an update from NotificationManager but before
     * it dispatches any change events to its listeners. This is to inform the list builder that
     * the first stage of the pipeline has been triggered. After events have been dispatched,
     * onBuildList() will be called.
     *
     * While onBuildList() is always called after this method is called, the converse is not always
     * true: sometimes the NotifCollection applies an update that does not need to dispatch events,
     * in which case this method will be skipped and onBuildList will be called directly.
     */
    void onBeginDispatchToListeners();

    /**
     * Called by the NotifCollection to indicate that something in the collection has changed and
     * that the list builder should regenerate the list.
+0 −9
Original line number Diff line number Diff line
@@ -338,9 +338,6 @@ public class NotifCollection {

    private void dispatchOnEntryAdded(NotificationEntry entry) {
        mAmDispatchingToOtherCode = true;
        if (mBuildListener != null) {
            mBuildListener.onBeginDispatchToListeners();
        }
        for (NotifCollectionListener listener : mNotifCollectionListeners) {
            listener.onEntryAdded(entry);
        }
@@ -349,9 +346,6 @@ public class NotifCollection {

    private void dispatchOnEntryUpdated(NotificationEntry entry) {
        mAmDispatchingToOtherCode = true;
        if (mBuildListener != null) {
            mBuildListener.onBeginDispatchToListeners();
        }
        for (NotifCollectionListener listener : mNotifCollectionListeners) {
            listener.onEntryUpdated(entry);
        }
@@ -363,9 +357,6 @@ public class NotifCollection {
            @CancellationReason int reason,
            boolean removedByUser) {
        mAmDispatchingToOtherCode = true;
        if (mBuildListener != null) {
            mBuildListener.onBeginDispatchToListeners();
        }
        for (NotifCollectionListener listener : mNotifCollectionListeners) {
            listener.onEntryRemoved(entry, reason, removedByUser);
        }
+0 −7
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.statusbar.notification.collection;

import static com.android.systemui.statusbar.notification.collection.GroupEntry.ROOT_ENTRY;
import static com.android.systemui.statusbar.notification.collection.ListDumper.dumpList;
import static com.android.systemui.statusbar.notification.collection.listbuilder.PipelineState.STATE_BUILD_PENDING;
import static com.android.systemui.statusbar.notification.collection.listbuilder.PipelineState.STATE_BUILD_STARTED;
import static com.android.systemui.statusbar.notification.collection.listbuilder.PipelineState.STATE_FINALIZING;
import static com.android.systemui.statusbar.notification.collection.listbuilder.PipelineState.STATE_GROUPING;
@@ -197,12 +196,6 @@ public class NotifListBuilderImpl implements NotifListBuilder {

    private final CollectionReadyForBuildListener mReadyForBuildListener =
            new CollectionReadyForBuildListener() {
                @Override
                public void onBeginDispatchToListeners() {
                    Assert.isMainThread();
                    mPipelineState.incrementTo(STATE_BUILD_PENDING);
                }

                @Override
                public void onBuildList(Collection<NotificationEntry> entries) {
                    Assert.isMainThread();
+8 −10
Original line number Diff line number Diff line
@@ -76,19 +76,17 @@ public class PipelineState {
    }

    public static final int STATE_IDLE = 0;
    public static final int STATE_BUILD_PENDING = 1;
    public static final int STATE_BUILD_STARTED = 2;
    public static final int STATE_RESETTING = 3;
    public static final int STATE_PRE_GROUP_FILTERING = 4;
    public static final int STATE_GROUPING = 5;
    public static final int STATE_TRANSFORMING = 6;
    public static final int STATE_SORTING = 7;
    public static final int STATE_PRE_RENDER_FILTERING = 8;
    public static final int STATE_FINALIZING = 9;
    public static final int STATE_BUILD_STARTED = 1;
    public static final int STATE_RESETTING = 2;
    public static final int STATE_PRE_GROUP_FILTERING = 3;
    public static final int STATE_GROUPING = 4;
    public static final int STATE_TRANSFORMING = 5;
    public static final int STATE_SORTING = 6;
    public static final int STATE_PRE_RENDER_FILTERING = 7;
    public static final int STATE_FINALIZING = 8;

    @IntDef(prefix = { "STATE_" }, value = {
            STATE_IDLE,
            STATE_BUILD_PENDING,
            STATE_BUILD_STARTED,
            STATE_RESETTING,
            STATE_PRE_GROUP_FILTERING,
+0 −1
Original line number Diff line number Diff line
@@ -1021,7 +1021,6 @@ public class NotifListBuilderImplTest extends SysuiTestCase {
            mPendingSet.clear();
        }

        mReadyForBuildListener.onBeginDispatchToListeners();
        mReadyForBuildListener.onBuildList(mEntrySet);
    }