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

Commit 5cc1adba authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add status bar/shelf icons for bundles

Test: manual, presubmit
Fixes: 416147040
Flag: com.android.systemui.notification_bundle_ui
Change-Id: I65e4fd59901e9ca906a25d791185afd8bdcafb90
parent b94ffc19
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -154,4 +154,9 @@ class BundleEntryAdapterTest : SysuiTestCase() {
    fun getPeopleNotificationType() {
        assertThat(underTest.getPeopleNotificationType()).isEqualTo(TYPE_NON_PERSON)
    }

    @Test
    fun getIcons() {
        assertThat(underTest.icons).isEqualTo(underTest.entry.icons)
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.systemui.statusbar.notification.collection

import com.android.systemui.statusbar.notification.icon.IconPack
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.data.repository.BundleRepository
import java.util.Collections
@@ -43,6 +44,8 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) {

    var row: ExpandableNotificationRow? = null

    var icons: IconPack = IconPack.buildEmptyPack(null)

    private val _children = ArrayList<ListEntry>()

    /**
+2 −3
Original line number Diff line number Diff line
@@ -95,9 +95,8 @@ class BundleEntryAdapter(
        return 0
    }

    override fun getIcons(): IconPack? {
        // TODO(b/396446620): implement bundle icons
        return IconPack.buildEmptyPack(null)
    override fun getIcons(): IconPack {
        return entry.icons
    }

    override fun isColorized(): Boolean {
+41 −40
Original line number Diff line number Diff line
@@ -48,19 +48,18 @@ import javax.inject.Inject
 * This list differs from the canonical one we receive from system server in a few ways:
 * - Filtered: Some notifications are filtered out. For example, we filter out notifications whose
 *   views haven't been inflated yet. We also filter out some notifications if we're on the lock
 *   screen and notifications for other users. To participate, see
 *   [.addPreGroupFilter] and similar methods.
 *   screen and notifications for other users. To participate, see [.addPreGroupFilter] and similar
 *   methods.
 * - Grouped: Notifications that are part of the same group are clustered together into a single
 *   GroupEntry. These groups are then transformed in order to remove children or completely split
 *   them apart. To participate, see [.addPromoter].
 * - Sorted: All top-level notifications are sorted. To participate, see
 *   [.setSections] and [.setComparators]
 * - Sorted: All top-level notifications are sorted. To participate, see [.setSections] and
 *   [.setComparators]
 *
 * The exact order of all hooks is as follows:
 * 0. Collection listeners are fired ([.addCollectionListener]).
 * 1. Pre-group filters are fired on each notification ([.addPreGroupFilter]).
 *  2. Initial grouping is performed (NotificationEntries will have their parents set
 *     appropriately).
 * 2. Initial grouping is performed (NotificationEntries will have their parents set appropriately).
 * 3. OnBeforeTransformGroupListeners are fired ([.addOnBeforeTransformGroupsListener])
 * 4. NotifPromoters are called on each notification with a parent ([.addPromoter])
 * 5. OnBeforeSortListeners are fired ([.addOnBeforeSortListener])
@@ -75,10 +74,12 @@ import javax.inject.Inject
 * 13. OnAfterRenderEntryListeners are fired ([.addOnAfterRenderEntryListener])
 */
@SysUISingleton
class NotifPipeline @Inject constructor(
class NotifPipeline
@Inject
constructor(
    private val mNotifCollection: NotifCollection,
    private val mShadeListBuilder: ShadeListBuilder,
    private val mRenderStageManager: RenderStageManager
    private val mRenderStageManager: RenderStageManager,
) : CommonNotifCollection {
    /**
     * Returns the list of all known notifications, i.e. the notifications that are currently posted
@@ -99,13 +100,16 @@ class NotifPipeline @Inject constructor(
        mNotifCollection.removeCollectionListener(listener)
    }

    /**
     * Returns the NotificationEntry associated with [key].
     */
    /** Returns the NotificationEntry associated with [key]. */
    override fun getEntry(key: String): NotificationEntry? {
        return mNotifCollection.getEntry(key)
    }

    /** Returns the BundleEntry associated with [key]. */
    override fun getBundleEntry(key: String): BundleEntry? {
        return mShadeListBuilder.getBundleEntry(key)
    }

    /**
     * Registers a lifetime extender. Lifetime extenders can cause notifications that have been
     * dismissed or retracted by system server to be temporarily retained in the collection.
@@ -124,9 +128,9 @@ class NotifPipeline @Inject constructor(

    /**
     * Registers a filter with the pipeline before grouping, promoting and sorting occurs. Filters
     * are called on each notification in the order that they were registered. If any filter
     * returns true, the notification is removed from the pipeline (and no other filters are
     * called on that notif).
     * are called on each notification in the order that they were registered. If any filter returns
     * true, the notification is removed from the pipeline (and no other filters are called on that
     * notif).
     */
    fun addPreGroupFilter(filter: NotifFilter) {
        mShadeListBuilder.addPreGroupFilter(filter)
@@ -204,10 +208,9 @@ class NotifPipeline @Inject constructor(

    /**
     * Registers a filter with the pipeline to filter right before rendering the list (after
     * pre-group filtering, grouping, promoting and sorting occurs). Filters are
     * called on each notification in the order that they were registered. If any filter returns
     * true, the notification is removed from the pipeline (and no other filters are called on that
     * notif).
     * pre-group filtering, grouping, promoting and sorting occurs). Filters are called on each
     * notification in the order that they were registered. If any filter returns true, the
     * notification is removed from the pipeline (and no other filters are called on that notif).
     */
    fun addFinalizeFilter(filter: NotifFilter) {
        mShadeListBuilder.addFinalizeFilter(filter)
@@ -233,24 +236,22 @@ class NotifPipeline @Inject constructor(
        mRenderStageManager.addOnAfterRenderListListener(listener)
    }

    /**
     * Called at the end of the pipeline after a group has been handed off to the view layer.
     */
    /** Called at the end of the pipeline after a group has been handed off to the view layer. */
    fun addOnAfterRenderGroupListener(listener: OnAfterRenderGroupListener) {
        mRenderStageManager.addOnAfterRenderGroupListener(listener)
    }

    /**
     * Called at the end of the pipeline after an entry has been handed off to the view layer.
     * This will be called for every top level entry, every group summary, and every group child.
     * Called at the end of the pipeline after an entry has been handed off to the view layer. This
     * will be called for every top level entry, every group summary, and every group child.
     */
    fun addOnAfterRenderEntryListener(listener: OnAfterRenderEntryListener) {
        mRenderStageManager.addOnAfterRenderEntryListener(listener)
    }

    /**
     * Get an object which can be used to update a notification (internally to the pipeline)
     * in response to a user action.
     * Get an object which can be used to update a notification (internally to the pipeline) in
     * response to a user action.
     *
     * @param name the name of the component that will update notifiations
     * @return an updater
+1 −1
Original line number Diff line number Diff line
@@ -733,7 +733,7 @@ public class ShadeListBuilder implements Dumpable, PipelineDumpable {
    }

    @Nullable
    private BundleEntry getBundleEntry(String id) {
    BundleEntry getBundleEntry(String id) {
        BundleEntry be = mIdToBundleEntry.get(id);
        if (be == null) {
            debugBundleLog(TAG, () -> "BundleEntry not found for bundleId: " + id);
Loading