Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorImplTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,17 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { assertThat(content?.shortCriticalText).isNull() } @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) fun extractsContent_fromBaseStyle() { val entry = createEntry { setStyle(null) } val content = extractContent(entry) assertThat(content).isNotNull() assertThat(content?.style).isEqualTo(Style.Base) } @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) fun extractsContent_fromBigPictureStyle() { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/AODPromotedNotification.kt +14 −10 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ private val PromotedNotificationContentModel.layoutResource: Int? get() { return if (Flags.notificationsRedesignTemplates()) { when (style) { Style.Base -> R.layout.notification_2025_template_expanded_base Style.BigPicture -> R.layout.notification_2025_template_expanded_big_picture Style.BigText -> R.layout.notification_2025_template_expanded_big_text Style.Call -> R.layout.notification_2025_template_expanded_call Loading @@ -86,6 +87,7 @@ private val PromotedNotificationContentModel.layoutResource: Int? } } else { when (style) { Style.Base -> R.layout.notification_template_material_big_base Style.BigPicture -> R.layout.notification_template_material_big_picture Style.BigText -> R.layout.notification_template_material_big_text Style.Call -> R.layout.notification_template_material_big_call Loading Loading @@ -133,6 +135,7 @@ private class AODPromotedNotificationViewUpdater(root: View) { fun update(content: PromotedNotificationContentModel) { when (content.style) { Style.Base -> updateBase(content) Style.BigPicture -> updateBigPicture(content) Style.BigText -> updateBigText(content) Style.Call -> updateCall(content) Loading @@ -141,20 +144,24 @@ private class AODPromotedNotificationViewUpdater(root: View) { } } private fun updateBigPicture(content: PromotedNotificationContentModel) { private fun updateBase( content: PromotedNotificationContentModel, textView: ImageFloatingTextView? = null, ) { updateHeader(content) updateTitle(title, content) updateText(text, content) updateText(textView ?: text, content) } private fun updateBigPicture(content: PromotedNotificationContentModel) { updateBase(content) bigPicture?.visibility = GONE } private fun updateBigText(content: PromotedNotificationContentModel) { updateHeader(content) updateTitle(title, content) updateText(bigText, content) updateBase(content, textView = bigText) } private fun updateCall(content: PromotedNotificationContentModel) { Loading @@ -164,10 +171,7 @@ private class AODPromotedNotificationViewUpdater(root: View) { } private fun updateProgress(content: PromotedNotificationContentModel) { updateHeader(content) updateTitle(title, content) updateText(text, content) updateBase(content) updateNewProgressBar(content) } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt +11 −8 Original line number Diff line number Diff line Loading @@ -98,8 +98,7 @@ constructor( primaryTextColor = colorsFromNotif.primaryTextColor, ) recoveredBuilder.style?.extractContent(contentBuilder) ?: run { contentBuilder.style = Style.Ineligible } recoveredBuilder.extractStyleContent(contentBuilder) return contentBuilder.build().also { logger.logExtractionSucceeded(entry, it) } } Loading Loading @@ -140,28 +139,32 @@ private fun Notification.extractWhen(): When? { } } private fun Notification.Style.extractContent( private fun Notification.Builder.extractStyleContent( contentBuilder: PromotedNotificationContentModel.Builder ) { val style = this.style contentBuilder.style = when (this) { when (style) { null -> Style.Base is BigPictureStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.BigPicture } is BigTextStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.BigText } is CallStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.Call } is ProgressStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.Progress } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ data class PromotedNotificationContentModel( /** The promotion-eligible style of a notification, or [Style.Ineligible] if not. */ enum class Style { Base, // style == null BigPicture, BigText, Call, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorImplTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,17 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { assertThat(content?.shortCriticalText).isNull() } @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) fun extractsContent_fromBaseStyle() { val entry = createEntry { setStyle(null) } val content = extractContent(entry) assertThat(content).isNotNull() assertThat(content?.style).isEqualTo(Style.Base) } @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) fun extractsContent_fromBigPictureStyle() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/AODPromotedNotification.kt +14 −10 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ private val PromotedNotificationContentModel.layoutResource: Int? get() { return if (Flags.notificationsRedesignTemplates()) { when (style) { Style.Base -> R.layout.notification_2025_template_expanded_base Style.BigPicture -> R.layout.notification_2025_template_expanded_big_picture Style.BigText -> R.layout.notification_2025_template_expanded_big_text Style.Call -> R.layout.notification_2025_template_expanded_call Loading @@ -86,6 +87,7 @@ private val PromotedNotificationContentModel.layoutResource: Int? } } else { when (style) { Style.Base -> R.layout.notification_template_material_big_base Style.BigPicture -> R.layout.notification_template_material_big_picture Style.BigText -> R.layout.notification_template_material_big_text Style.Call -> R.layout.notification_template_material_big_call Loading Loading @@ -133,6 +135,7 @@ private class AODPromotedNotificationViewUpdater(root: View) { fun update(content: PromotedNotificationContentModel) { when (content.style) { Style.Base -> updateBase(content) Style.BigPicture -> updateBigPicture(content) Style.BigText -> updateBigText(content) Style.Call -> updateCall(content) Loading @@ -141,20 +144,24 @@ private class AODPromotedNotificationViewUpdater(root: View) { } } private fun updateBigPicture(content: PromotedNotificationContentModel) { private fun updateBase( content: PromotedNotificationContentModel, textView: ImageFloatingTextView? = null, ) { updateHeader(content) updateTitle(title, content) updateText(text, content) updateText(textView ?: text, content) } private fun updateBigPicture(content: PromotedNotificationContentModel) { updateBase(content) bigPicture?.visibility = GONE } private fun updateBigText(content: PromotedNotificationContentModel) { updateHeader(content) updateTitle(title, content) updateText(bigText, content) updateBase(content, textView = bigText) } private fun updateCall(content: PromotedNotificationContentModel) { Loading @@ -164,10 +171,7 @@ private class AODPromotedNotificationViewUpdater(root: View) { } private fun updateProgress(content: PromotedNotificationContentModel) { updateHeader(content) updateTitle(title, content) updateText(text, content) updateBase(content) updateNewProgressBar(content) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt +11 −8 Original line number Diff line number Diff line Loading @@ -98,8 +98,7 @@ constructor( primaryTextColor = colorsFromNotif.primaryTextColor, ) recoveredBuilder.style?.extractContent(contentBuilder) ?: run { contentBuilder.style = Style.Ineligible } recoveredBuilder.extractStyleContent(contentBuilder) return contentBuilder.build().also { logger.logExtractionSucceeded(entry, it) } } Loading Loading @@ -140,28 +139,32 @@ private fun Notification.extractWhen(): When? { } } private fun Notification.Style.extractContent( private fun Notification.Builder.extractStyleContent( contentBuilder: PromotedNotificationContentModel.Builder ) { val style = this.style contentBuilder.style = when (this) { when (style) { null -> Style.Base is BigPictureStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.BigPicture } is BigTextStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.BigText } is CallStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.Call } is ProgressStyle -> { extractContent(contentBuilder) style.extractContent(contentBuilder) Style.Progress } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ data class PromotedNotificationContentModel( /** The promotion-eligible style of a notification, or [Style.Ineligible] if not. */ enum class Style { Base, // style == null BigPicture, BigText, Call, Loading