Merge "Cache NotifCollection for next pipeline run" into udc-dev

This commit is contained in:
Ibrahim Yilmaz
2023-03-23 22:41:12 +00:00
committed by Android (Google) Code Review

View File

@@ -110,6 +110,8 @@ public class ShadeListBuilder implements Dumpable, PipelineDumpable {
private final PipelineState mPipelineState = new PipelineState(); private final PipelineState mPipelineState = new PipelineState();
private final Map<String, GroupEntry> mGroups = new ArrayMap<>(); private final Map<String, GroupEntry> mGroups = new ArrayMap<>();
private Collection<NotificationEntry> mAllEntries = Collections.emptyList(); private Collection<NotificationEntry> mAllEntries = Collections.emptyList();
@Nullable
private Collection<NotificationEntry> mPendingEntries = null;
private int mIterationCount = 0; private int mIterationCount = 0;
private final List<NotifFilter> mNotifPreGroupFilters = new ArrayList<>(); private final List<NotifFilter> mNotifPreGroupFilters = new ArrayList<>();
@@ -317,11 +319,9 @@ public class ShadeListBuilder implements Dumpable, PipelineDumpable {
@Override @Override
public void onBuildList(Collection<NotificationEntry> entries, String reason) { public void onBuildList(Collection<NotificationEntry> entries, String reason) {
Assert.isMainThread(); Assert.isMainThread();
mPipelineState.requireIsBefore(STATE_BUILD_STARTED); mPendingEntries = new ArrayList<>(entries);
mLogger.logOnBuildList(reason); mLogger.logOnBuildList(reason);
mAllEntries = entries; rebuildListIfBefore(STATE_BUILD_STARTED);
scheduleRebuild(/* reentrant = */ false);
} }
}; };
@@ -398,6 +398,11 @@ public class ShadeListBuilder implements Dumpable, PipelineDumpable {
Trace.beginSection("ShadeListBuilder.buildList"); Trace.beginSection("ShadeListBuilder.buildList");
mPipelineState.requireIsBefore(STATE_BUILD_STARTED); mPipelineState.requireIsBefore(STATE_BUILD_STARTED);
if (mPendingEntries != null) {
mAllEntries = mPendingEntries;
mPendingEntries = null;
}
if (!mNotifStabilityManager.isPipelineRunAllowed()) { if (!mNotifStabilityManager.isPipelineRunAllowed()) {
mLogger.logPipelineRunSuppressed(); mLogger.logPipelineRunSuppressed();
Trace.endSection(); Trace.endSection();