Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt +4 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import kotlinx.coroutines.flow.MutableStateFlow */ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) { override val bucket: Int = spec.bucket /** The model used by UI. */ val bundleRepository = BundleRepository(spec.titleTextResId, spec.icon) Loading Loading @@ -80,8 +82,8 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) { get() = _children.all { it.representativeEntry?.sbn?.isClearable != false } /** * The total count of [NotificationEntry]s within bundle. Notification updates trigger * pipeline rebuilds, so updates to group children will be reflected in this count. * The total count of [NotificationEntry]s within bundle. Notification updates trigger pipeline * rebuilds, so updates to group children will be reflected in this count. */ @VisibleForTesting fun updateTotalCount() { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleSpec.kt +10 −6 Original line number Diff line number Diff line Loading @@ -20,11 +20,17 @@ import android.app.NotificationChannel import androidx.annotation.DrawableRes import androidx.annotation.StringRes import com.android.internal.R import com.android.systemui.statusbar.notification.stack.BUCKET_NEWS import com.android.systemui.statusbar.notification.stack.BUCKET_PROMO import com.android.systemui.statusbar.notification.stack.BUCKET_RECS import com.android.systemui.statusbar.notification.stack.BUCKET_SOCIAL import com.android.systemui.statusbar.notification.stack.PriorityBucket data class BundleSpec( val key: String, @StringRes val titleTextResId: Int, @DrawableRes val icon: Int, @PriorityBucket val bucket: Int, ) { companion object { val PROMOTIONS = Loading @@ -32,30 +38,28 @@ data class BundleSpec( key = NotificationChannel.PROMOTIONS_ID, titleTextResId = R.string.promotional_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_promotions, bucket = BUCKET_PROMO, ) val SOCIAL_MEDIA = BundleSpec( key = NotificationChannel.SOCIAL_MEDIA_ID, titleTextResId = R.string.social_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_social, bucket = BUCKET_SOCIAL, ) val NEWS = BundleSpec( key = NotificationChannel.NEWS_ID, titleTextResId = R.string.news_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_news, bucket = BUCKET_NEWS, ) val RECOMMENDED = BundleSpec( key = NotificationChannel.RECS_ID, titleTextResId = R.string.recs_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_recs, ) val DEBUG = BundleSpec( key = "debug_bundle", titleTextResId = R.string.notification_channel_developer, icon = com.android.systemui.res.R.drawable.ic_person, bucket = BUCKET_RECS, ) } } packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.kt +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.collection import android.annotation.UptimeMillisLong import com.android.systemui.statusbar.notification.stack.BUCKET_ALERTING import com.android.systemui.statusbar.notification.stack.PriorityBucket /** * Abstract superclass for top-level entries, i.e. things that can appear in the final notification Loading @@ -42,6 +44,8 @@ protected constructor( */ abstract val representativeEntry: NotificationEntry? @get:PriorityBucket override var bucket: Int = BUCKET_ALERTING override fun asListEntry(): ListEntry? { return this } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/PipelineEntry.kt +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.collection import com.android.systemui.statusbar.notification.collection.ListAttachState.Companion.create import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection import com.android.systemui.statusbar.notification.stack.BUCKET_ALERTING import com.android.systemui.statusbar.notification.stack.PriorityBucket import com.android.systemui.util.ListenerSet Loading @@ -32,7 +31,8 @@ sealed class PipelineEntry( /** @return Previous state that ShadeListBuilder assigned to this PipelineEntry. */ val previousAttachState: ListAttachState = create() @get:PriorityBucket var bucket: Int = BUCKET_ALERTING @get:PriorityBucket abstract val bucket: Int var isSeenInShade: Boolean = false @JvmField Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BundleCoordinator.kt +4 −6 Original line number Diff line number Diff line Loading @@ -112,7 +112,6 @@ constructor( add(BundleSpec.SOCIAL_MEDIA) add(BundleSpec.PROMOTIONS) add(BundleSpec.RECOMMENDED) if (!debugBundleAppName.isNullOrEmpty()) add(BundleSpec.DEBUG) } private val bundleIds = this.bundleSpecs.map { it.key } Loading @@ -123,7 +122,7 @@ constructor( */ override fun getBundleIdOrNull(entry: ListEntry): String? { if (isFromDebugApp(entry)) { return BundleSpec.DEBUG.key return BundleSpec.RECOMMENDED.key } if (entry is GroupEntry) { if (entry.children.isEmpty()) return null Loading Loading @@ -176,8 +175,7 @@ constructor( } private val bundleCountUpdater = OnBeforeRenderListListener { entries -> entries.filterIsInstance<BundleEntry>() .forEach(BundleEntry::updateTotalCount) entries.filterIsInstance<BundleEntry>().forEach(BundleEntry::updateTotalCount) } override fun attach(pipeline: NotifPipeline) { Loading @@ -195,8 +193,8 @@ constructor( @JvmField var debugBundleLogs: Boolean = false /** * All notifications that contain this String in the key are bundled into a debug bundle * such that bundle code can be easily and deterministically tested. * All notifications that contain this String in the key are bundled into the recommended * bundle such that bundle code can be easily and deterministically tested. * * E.g. use this command to bundle all notifications from notify: `adb shell setprop * persist.debug.notification_bundle_ui_debug_app_name com.google.cinek.notify && adb Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt +4 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import kotlinx.coroutines.flow.MutableStateFlow */ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) { override val bucket: Int = spec.bucket /** The model used by UI. */ val bundleRepository = BundleRepository(spec.titleTextResId, spec.icon) Loading Loading @@ -80,8 +82,8 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) { get() = _children.all { it.representativeEntry?.sbn?.isClearable != false } /** * The total count of [NotificationEntry]s within bundle. Notification updates trigger * pipeline rebuilds, so updates to group children will be reflected in this count. * The total count of [NotificationEntry]s within bundle. Notification updates trigger pipeline * rebuilds, so updates to group children will be reflected in this count. */ @VisibleForTesting fun updateTotalCount() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleSpec.kt +10 −6 Original line number Diff line number Diff line Loading @@ -20,11 +20,17 @@ import android.app.NotificationChannel import androidx.annotation.DrawableRes import androidx.annotation.StringRes import com.android.internal.R import com.android.systemui.statusbar.notification.stack.BUCKET_NEWS import com.android.systemui.statusbar.notification.stack.BUCKET_PROMO import com.android.systemui.statusbar.notification.stack.BUCKET_RECS import com.android.systemui.statusbar.notification.stack.BUCKET_SOCIAL import com.android.systemui.statusbar.notification.stack.PriorityBucket data class BundleSpec( val key: String, @StringRes val titleTextResId: Int, @DrawableRes val icon: Int, @PriorityBucket val bucket: Int, ) { companion object { val PROMOTIONS = Loading @@ -32,30 +38,28 @@ data class BundleSpec( key = NotificationChannel.PROMOTIONS_ID, titleTextResId = R.string.promotional_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_promotions, bucket = BUCKET_PROMO, ) val SOCIAL_MEDIA = BundleSpec( key = NotificationChannel.SOCIAL_MEDIA_ID, titleTextResId = R.string.social_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_social, bucket = BUCKET_SOCIAL, ) val NEWS = BundleSpec( key = NotificationChannel.NEWS_ID, titleTextResId = R.string.news_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_news, bucket = BUCKET_NEWS, ) val RECOMMENDED = BundleSpec( key = NotificationChannel.RECS_ID, titleTextResId = R.string.recs_notification_channel_label, icon = com.android.settingslib.R.drawable.ic_recs, ) val DEBUG = BundleSpec( key = "debug_bundle", titleTextResId = R.string.notification_channel_developer, icon = com.android.systemui.res.R.drawable.ic_person, bucket = BUCKET_RECS, ) } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.kt +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.collection import android.annotation.UptimeMillisLong import com.android.systemui.statusbar.notification.stack.BUCKET_ALERTING import com.android.systemui.statusbar.notification.stack.PriorityBucket /** * Abstract superclass for top-level entries, i.e. things that can appear in the final notification Loading @@ -42,6 +44,8 @@ protected constructor( */ abstract val representativeEntry: NotificationEntry? @get:PriorityBucket override var bucket: Int = BUCKET_ALERTING override fun asListEntry(): ListEntry? { return this } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/PipelineEntry.kt +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.collection import com.android.systemui.statusbar.notification.collection.ListAttachState.Companion.create import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection import com.android.systemui.statusbar.notification.stack.BUCKET_ALERTING import com.android.systemui.statusbar.notification.stack.PriorityBucket import com.android.systemui.util.ListenerSet Loading @@ -32,7 +31,8 @@ sealed class PipelineEntry( /** @return Previous state that ShadeListBuilder assigned to this PipelineEntry. */ val previousAttachState: ListAttachState = create() @get:PriorityBucket var bucket: Int = BUCKET_ALERTING @get:PriorityBucket abstract val bucket: Int var isSeenInShade: Boolean = false @JvmField Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BundleCoordinator.kt +4 −6 Original line number Diff line number Diff line Loading @@ -112,7 +112,6 @@ constructor( add(BundleSpec.SOCIAL_MEDIA) add(BundleSpec.PROMOTIONS) add(BundleSpec.RECOMMENDED) if (!debugBundleAppName.isNullOrEmpty()) add(BundleSpec.DEBUG) } private val bundleIds = this.bundleSpecs.map { it.key } Loading @@ -123,7 +122,7 @@ constructor( */ override fun getBundleIdOrNull(entry: ListEntry): String? { if (isFromDebugApp(entry)) { return BundleSpec.DEBUG.key return BundleSpec.RECOMMENDED.key } if (entry is GroupEntry) { if (entry.children.isEmpty()) return null Loading Loading @@ -176,8 +175,7 @@ constructor( } private val bundleCountUpdater = OnBeforeRenderListListener { entries -> entries.filterIsInstance<BundleEntry>() .forEach(BundleEntry::updateTotalCount) entries.filterIsInstance<BundleEntry>().forEach(BundleEntry::updateTotalCount) } override fun attach(pipeline: NotifPipeline) { Loading @@ -195,8 +193,8 @@ constructor( @JvmField var debugBundleLogs: Boolean = false /** * All notifications that contain this String in the key are bundled into a debug bundle * such that bundle code can be easily and deterministically tested. * All notifications that contain this String in the key are bundled into the recommended * bundle such that bundle code can be easily and deterministically tested. * * E.g. use this command to bundle all notifications from notify: `adb shell setprop * persist.debug.notification_bundle_ui_debug_app_name com.google.cinek.notify && adb Loading