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

Commit 7d831798 authored by Steve Elliott's avatar Steve Elliott
Browse files

clearability for bundles and children

Bug: 394483200
Test: atest SystemUITests
Flag: com.android.systemui.notification_bundle_ui
Change-Id: Id1079075cd162713c617a21f96914111a348bce1
parent 19e4fd3a
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;
                }