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

Commit 370841a7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "clearability for bundles and children" into main

parents b05725a7 7d831798
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -66,4 +66,12 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) {
    override fun wasAttachedInPreviousPass(): Boolean {
        return false
    }

    /**
     * Returns whether this bundle be cleared when the user wants to "clear all" notifications.
     *
     * This is `true` only if all children are clearable.
     */
    val isClearable: Boolean
        get() = _children.all { it.representativeEntry?.sbn?.isClearable != false }
}
+2 −3
Original line number Diff line number Diff line
@@ -67,8 +67,7 @@ class BundleEntryAdapter(
    }

    override fun isClearable(): Boolean {
        // TODO(b/394483200): check whether all of the children are clearable, when implemented
        return true
        return entry.isClearable
    }

    override fun getTargetSdk(): Int {
+12 −7
Original line number Diff line number Diff line
@@ -141,7 +141,6 @@ public class RankingCoordinator implements Coordinator {
            return mSilentNodeController;
        }

        @Nullable
        @Override
        public void onEntriesUpdated(@NonNull List<PipelineEntry> entries) {
            mHasSilentEntries = false;
@@ -149,7 +148,12 @@ public class RankingCoordinator implements Coordinator {
                final PipelineEntry pipelineEntry = entries.get(i);
                final ListEntry listEntry = pipelineEntry.asListEntry();
                if (listEntry == null) {
                    // TODO(b/395698521) Handle BundleEntry
                    if (pipelineEntry instanceof BundleEntry bundleEntry) {
                        if (bundleEntry.isClearable()) {
                            mHasSilentEntries = true;
                            break;
                        }
                    }
                    continue;
                }
                final NotificationEntry notifEntry = listEntry.getRepresentativeEntry();
@@ -217,17 +221,18 @@ public class RankingCoordinator implements Coordinator {
            return mSilentNodeController;
        }

        @Nullable
        @Override
        public void onEntriesUpdated(@NonNull List<PipelineEntry> entries) {
            mHasMinimizedEntries = false;
            for (int i = 0; i < entries.size(); i++) {
                final ListEntry listEntry = entries.get(i).asListEntry();
                final PipelineEntry pipelineEntry = entries.get(i);
                final ListEntry listEntry = pipelineEntry.asListEntry();
                if (listEntry == null) {
                    // TODO(b/395698521) Handle BundleEntry
                    continue;
                    // Bundles are never minimized
                    throw new IllegalStateException(
                            "non-ListEntry in minimized notif section: " + pipelineEntry.getKey());
                }
                NotificationEntry notifEntry = listEntry.getRepresentativeEntry();
                final NotificationEntry notifEntry = listEntry.getRepresentativeEntry();
                if (notifEntry == null) {
                    continue;
                }