diff options
author | 2025-03-17 17:53:34 -0700 | |
---|---|---|
committer | 2025-03-17 17:53:34 -0700 | |
commit | 65b2d14c9d58255bbef5b460573b70adb737953d (patch) | |
tree | 2f21acb2f473aade852e496ecd5148e1fa060b7c | |
parent | 8105f876410c9554bc2e7c193ce40ebdded2d2ac (diff) | |
parent | dc9372b2ad658bc04bd3174e3b3791b57dca4dad (diff) |
Merge "[RONs] Implement the structure required for redacting the AOD RON" into main
34 files changed, 480 insertions, 330 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt index 6c498c8fd2f1..5ec9b601bcca 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt @@ -44,6 +44,7 @@ import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel import com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer import com.android.systemui.statusbar.core.StatusBarConnectedDisplays import com.android.systemui.statusbar.core.StatusBarRootModernization +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.phone.ongoingcall.DisableChipsModernization import com.android.systemui.statusbar.phone.ongoingcall.EnableChipsModernization @@ -799,8 +800,8 @@ class CallChipViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } private val PROMOTED_CONTENT_WITH_COLOR = - PromotedNotificationContentModel.Builder("notif") - .apply { + PromotedNotificationContentBuilder("notif") + .applyToShared { this.colors = PromotedNotificationContentModel.Colors( backgroundColor = PROMOTED_BACKGROUND_COLOR, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt index 7f8f5f43e775..9ce43a0792c2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt @@ -30,7 +30,7 @@ import com.android.systemui.statusbar.StatusBarIconView import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips import com.android.systemui.statusbar.core.StatusBarConnectedDisplays import com.android.systemui.statusbar.notification.data.model.activeNotificationModel -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.testKosmos import com.android.systemui.util.time.fakeSystemClock import com.google.common.truth.Truth.assertThat @@ -420,7 +420,7 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() { // WHEN the notif gets a new UID that starts as visible activityManagerRepository.fake.startingIsAppVisibleValue = true val newPromotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.shortCriticalText = "Arrived" } val newPromotedContent = newPromotedContentBuilder.build() @@ -452,6 +452,6 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() { companion object { private const val UID = 885 - private val PROMOTED_CONTENT = PromotedNotificationContentModel.Builder("notif1").build() + private val PROMOTED_CONTENT = PromotedNotificationContentBuilder("notif1").build() } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/StatusBarNotificationChipsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/StatusBarNotificationChipsInteractorTest.kt index 0b9b297130a2..202d5cff95d7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/StatusBarNotificationChipsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/StatusBarNotificationChipsInteractorTest.kt @@ -36,7 +36,7 @@ import com.android.systemui.statusbar.notification.data.repository.ActiveNotific import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.data.repository.addNotif import com.android.systemui.statusbar.notification.data.repository.removeNotif -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.testKosmos @@ -65,7 +65,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock<StatusBarIconView>(), - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -96,7 +96,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -115,7 +115,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -135,7 +135,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -158,12 +158,12 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = firstIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ), activeNotificationModel( key = "notif2", statusBarChipIcon = secondIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ), activeNotificationModel( key = "notif3", @@ -195,7 +195,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = "notif", uid = uid, statusBarChipIcon = mock<StatusBarIconView>(), - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) ) ) @@ -223,14 +223,14 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = "promotedNormal", statusBarChipIcon = mock(), promotedContent = - PromotedNotificationContentModel.Builder("promotedNormal").build(), + PromotedNotificationContentBuilder("promotedNormal").build(), callType = CallType.None, ), activeNotificationModel( key = "promotedCall", statusBarChipIcon = mock(), promotedContent = - PromotedNotificationContentModel.Builder("promotedCall").build(), + PromotedNotificationContentBuilder("promotedCall").build(), callType = CallType.Ongoing, ), ) @@ -256,7 +256,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = firstIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -269,7 +269,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = secondIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -282,7 +282,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = thirdIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -302,7 +302,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -325,7 +325,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -348,7 +348,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = firstIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) setNotifs(listOf(notif1)) assertThat(latest!!.map { it.key }).containsExactly("notif1").inOrder() @@ -359,7 +359,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif2", statusBarChipIcon = secondIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ) setNotifs(listOf(notif1, notif2)) @@ -380,7 +380,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { // WHEN notif1 gets an update val notif1NewPromotedContent = - PromotedNotificationContentModel.Builder("notif1").apply { + PromotedNotificationContentBuilder("notif1").applyToShared { this.shortCriticalText = "Arrived" } setNotifs( @@ -426,8 +426,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif1Info.key, uid = notif1Info.uid, statusBarChipIcon = notif1Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif1Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(), ) ) activityManagerRepository.fake.setIsAppVisible(notif1Info.uid, isAppVisible = false) @@ -443,8 +442,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif2Info.key, uid = notif2Info.uid, statusBarChipIcon = notif2Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif2Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(), ) ) activityManagerRepository.fake.setIsAppVisible(notif2Info.uid, isAppVisible = false) @@ -482,16 +480,14 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif1Info.key, uid = notif1Info.uid, statusBarChipIcon = notif1Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif1Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(), ) val notif2 = activeNotificationModel( key = notif2Info.key, uid = notif2Info.uid, statusBarChipIcon = notif2Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif2Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(), ) setNotifs(listOf(notif1, notif2)) assertThat(latest!!.map { it.key }).containsExactly("notif1", "notif2").inOrder() @@ -537,16 +533,14 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif1Info.key, uid = notif1Info.uid, statusBarChipIcon = notif1Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif1Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(), ) val notif2 = activeNotificationModel( key = notif2Info.key, uid = notif2Info.uid, statusBarChipIcon = notif2Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif2Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(), ) setNotifs(listOf(notif1, notif2)) assertThat(latest!!.map { it.key }).containsExactly("notif1", "notif2").inOrder() @@ -567,8 +561,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif3Info.key, uid = notif3Info.uid, statusBarChipIcon = notif3Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif3Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif3Info.key).build(), ) setNotifs(listOf(notif1, notif2, notif3)) @@ -597,8 +590,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif1Info.key, uid = notif1Info.uid, statusBarChipIcon = notif1Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif1Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(), ) setNotifs(listOf(notif1)) @@ -609,8 +601,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif2Info.key, uid = notif2Info.uid, statusBarChipIcon = notif2Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif2Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(), ) setNotifs(listOf(notif1, notif2)) @@ -637,7 +628,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { // WHEN notif2 gets an update val notif2NewPromotedContent = - PromotedNotificationContentModel.Builder("notif2").apply { + PromotedNotificationContentBuilder("notif2").applyToShared { this.shortCriticalText = "Arrived" } setNotifs( @@ -662,8 +653,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { key = notif3Info.key, uid = notif3Info.uid, statusBarChipIcon = notif3Info.icon, - promotedContent = - PromotedNotificationContentModel.Builder(notif3Info.key).build(), + promotedContent = PromotedNotificationContentBuilder(notif3Info.key).build(), ) setNotifs(listOf(notif1, notif2, notif3)) @@ -710,8 +700,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif|uid1", statusBarChipIcon = firstIcon, - promotedContent = - PromotedNotificationContentModel.Builder("notif|uid1").build(), + promotedContent = PromotedNotificationContentBuilder("notif|uid1").build(), ) ) ) @@ -725,8 +714,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif|uid2", statusBarChipIcon = secondIcon, - promotedContent = - PromotedNotificationContentModel.Builder("notif|uid2").build(), + promotedContent = PromotedNotificationContentBuilder("notif|uid2").build(), ) ) ) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt index 8368fa671ea8..eecdbbfd408b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt @@ -43,6 +43,7 @@ import com.android.systemui.statusbar.notification.data.repository.ActiveNotific import com.android.systemui.statusbar.notification.data.repository.UnconfinedFakeHeadsUpRowRepository import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.headsup.PinnedStatus +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.When import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel @@ -101,7 +102,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -121,7 +122,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -142,7 +143,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { key = "notif", appName = "Fake App Name", statusBarChipIcon = icon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -172,7 +173,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { key = notifKey, appName = "Fake App Name", statusBarChipIcon = null, - promotedContent = PromotedNotificationContentModel.Builder(notifKey).build(), + promotedContent = PromotedNotificationContentBuilder(notifKey).build(), ) ) ) @@ -195,7 +196,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { val latest by collectLastValue(underTest.chips) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.colors = PromotedNotificationContentModel.Colors( backgroundColor = 56, @@ -229,12 +230,12 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = firstIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ), activeNotificationModel( key = "notif2", statusBarChipIcon = secondIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ), activeNotificationModel( key = "notif3", @@ -264,13 +265,12 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = firstKey, statusBarChipIcon = null, - promotedContent = PromotedNotificationContentModel.Builder(firstKey).build(), + promotedContent = PromotedNotificationContentBuilder(firstKey).build(), ), activeNotificationModel( key = secondKey, statusBarChipIcon = null, - promotedContent = - PromotedNotificationContentModel.Builder(secondKey).build(), + promotedContent = PromotedNotificationContentBuilder(secondKey).build(), ), activeNotificationModel( key = thirdKey, @@ -294,7 +294,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.shortCriticalText = "Arrived" this.time = When.Time(currentTime + 30.minutes.inWholeMilliseconds) } @@ -321,7 +321,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { val latest by collectLastValue(underTest.chips) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { this.time = null } + PromotedNotificationContentBuilder("notif").applyToShared { this.time = null } setNotifs( listOf( activeNotificationModel( @@ -346,7 +346,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.wasPromotedAutomatically = true this.time = When.Time(currentTime + 30.minutes.inWholeMilliseconds) } @@ -374,7 +374,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.wasPromotedAutomatically = false this.time = When.Time(currentTime + 30.minutes.inWholeMilliseconds) } @@ -402,7 +402,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime + 13.minutes.inWholeMilliseconds) } @@ -430,7 +430,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime + 500) } @@ -458,7 +458,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime) } @@ -486,7 +486,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime - 2.minutes.inWholeMilliseconds) } @@ -515,7 +515,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime + 3.minutes.inWholeMilliseconds) } @@ -555,7 +555,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { val whenElapsed = currentElapsed - 1.minutes.inWholeMilliseconds val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Chronometer(elapsedRealtimeMillis = whenElapsed, isCountDown = false) } @@ -592,7 +592,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { val whenElapsed = currentElapsed + 10.minutes.inWholeMilliseconds val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Chronometer(elapsedRealtimeMillis = whenElapsed, isCountDown = true) } @@ -623,7 +623,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime + 10.minutes.inWholeMilliseconds) } setNotifs( @@ -653,7 +653,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime + 10.minutes.inWholeMilliseconds) } setNotifs( @@ -690,11 +690,11 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime + 10.minutes.inWholeMilliseconds) } val otherPromotedContentBuilder = - PromotedNotificationContentModel.Builder("other notif").apply { + PromotedNotificationContentBuilder("other notif").applyToShared { this.time = When.Time(currentTime + 10.minutes.inWholeMilliseconds) } val icon = createStatusBarIconViewOrNull() @@ -738,7 +738,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { fakeSystemClock.setCurrentTimeMillis(currentTime) val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.time = When.Time(currentTime + 10.minutes.inWholeMilliseconds) } setNotifs( @@ -781,7 +781,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key, statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder(key).build(), + promotedContent = PromotedNotificationContentBuilder(key).build(), ) ) ) @@ -809,7 +809,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key, statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder(key).build(), + promotedContent = PromotedNotificationContentBuilder(key).build(), ) ) ) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt index 608a84bdb604..83b3c9cae3c1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt @@ -63,7 +63,7 @@ import com.android.systemui.statusbar.notification.data.repository.activeNotific import com.android.systemui.statusbar.notification.data.repository.addNotif import com.android.systemui.statusbar.notification.data.repository.addNotifs import com.android.systemui.statusbar.notification.data.repository.removeNotif -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.statusbar.phone.ongoingcall.DisableChipsModernization @@ -358,7 +358,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { addOngoingCallState(key = "call") val promotedContentBuilder = - PromotedNotificationContentModel.Builder("notif").apply { + PromotedNotificationContentBuilder("notif").applyToShared { this.shortCriticalText = "Some text here" } activeNotificationListRepository.addNotif( @@ -741,7 +741,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -765,7 +765,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -791,14 +791,12 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), ) ) @@ -822,14 +820,12 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), ) ) @@ -857,20 +853,17 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), activeNotificationModel( key = "thirdNotif", statusBarChipIcon = thirdIcon, - promotedContent = - PromotedNotificationContentModel.Builder("thirdNotif").build(), + promotedContent = PromotedNotificationContentBuilder("thirdNotif").build(), ), ) ) @@ -896,26 +889,22 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), activeNotificationModel( key = "thirdNotif", statusBarChipIcon = thirdIcon, - promotedContent = - PromotedNotificationContentModel.Builder("thirdNotif").build(), + promotedContent = PromotedNotificationContentBuilder("thirdNotif").build(), ), activeNotificationModel( key = "fourthNotif", statusBarChipIcon = fourthIcon, - promotedContent = - PromotedNotificationContentModel.Builder("fourthNotif").build(), + promotedContent = PromotedNotificationContentBuilder("fourthNotif").build(), ), ) ) @@ -941,20 +930,17 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), activeNotificationModel( key = "thirdNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("thirdNotif").build(), + promotedContent = PromotedNotificationContentBuilder("thirdNotif").build(), ), ) ) @@ -973,26 +959,22 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), activeNotificationModel( key = "thirdNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("thirdNotif").build(), + promotedContent = PromotedNotificationContentBuilder("thirdNotif").build(), ), activeNotificationModel( key = "fourthNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("fourthNotif").build(), + promotedContent = PromotedNotificationContentBuilder("fourthNotif").build(), ), ) ) @@ -1016,14 +998,12 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), ) ) @@ -1050,20 +1030,17 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, - promotedContent = - PromotedNotificationContentModel.Builder("firstNotif").build(), + promotedContent = PromotedNotificationContentBuilder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, - promotedContent = - PromotedNotificationContentModel.Builder("secondNotif").build(), + promotedContent = PromotedNotificationContentBuilder("secondNotif").build(), ), activeNotificationModel( key = "thirdNotif", statusBarChipIcon = thirdIcon, - promotedContent = - PromotedNotificationContentModel.Builder("thirdNotif").build(), + promotedContent = PromotedNotificationContentBuilder("thirdNotif").build(), ), ) ) @@ -1092,7 +1069,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) @@ -1114,14 +1091,14 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) ) activeNotificationListRepository.addNotif( activeNotificationModel( key = "notif2", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ) ) @@ -1143,14 +1120,14 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) ) activeNotificationListRepository.addNotif( activeNotificationModel( key = "notif2", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ) ) @@ -1178,7 +1155,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = notifIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) addOngoingCallState(key = callNotificationKey) @@ -1189,7 +1166,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif2", statusBarChipIcon = notifIcon2, - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ) ) @@ -1214,7 +1191,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = notifIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) ) @@ -1265,7 +1242,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = notifIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) @@ -1304,7 +1281,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = notifIcon, - promotedContent = PromotedNotificationContentModel.Builder("notif").build(), + promotedContent = PromotedNotificationContentBuilder("notif").build(), ) ) // And everything else hidden @@ -1382,7 +1359,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = notif1Icon, - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) ) ) @@ -1436,7 +1413,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif2", statusBarChipIcon = notif2Icon, - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ) ) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt index d3befa921e9e..29bb29f25797 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt @@ -29,7 +29,7 @@ import com.android.systemui.statusbar.notification.data.model.activeNotification import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.data.repository.setActiveNotifs -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat @@ -170,7 +170,7 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { val promoted1 = activeNotificationModel( key = "notif1", - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) val notPromoted2 = activeNotificationModel(key = "notif2", promotedContent = null) @@ -208,14 +208,14 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { val promoted1 = activeNotificationModel( key = "notif1", - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) val notPromoted2 = activeNotificationModel(key = "notif2", promotedContent = null) val notPromoted3 = activeNotificationModel(key = "notif3", promotedContent = null) val promoted4 = activeNotificationModel( key = "notif4", - promotedContent = PromotedNotificationContentModel.Builder("notif4").build(), + promotedContent = PromotedNotificationContentBuilder("notif4").build(), ) activeNotificationListRepository.activeNotifications.value = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt index 35b19c19d5ce..5c749e6e35d6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt @@ -28,7 +28,8 @@ import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.shared.byKey import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock @@ -130,7 +131,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { val promoted2 = mockNotificationEntry( "key2", - promotedContent = PromotedNotificationContentModel.Builder("key2").build(), + promotedContent = PromotedNotificationContentBuilder("key2").build(), ) underTest.setRenderedList(listOf(notPromoted1, promoted2)) @@ -149,7 +150,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { private fun mockNotificationEntry( key: String, rank: Int = 0, - promotedContent: PromotedNotificationContentModel? = null, + promotedContent: PromotedNotificationContentModels? = null, ): NotificationEntry { val nBuilder = Notification.Builder(context, "a") val notification = nBuilder.build() @@ -165,7 +166,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { whenever(this.representativeEntry).thenReturn(this) whenever(this.ranking).thenReturn(RankingBuilder().setRank(rank).build()) whenever(this.sbn).thenReturn(mockSbn) - whenever(this.promotedNotificationContentModel).thenReturn(promotedContent) + whenever(this.promotedNotificationContentModels).thenReturn(promotedContent) } } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt index ee698ae20adb..41120a16e4ea 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/domain/interactor/NotificationIconsInteractorTest.kt @@ -33,8 +33,10 @@ import com.android.systemui.statusbar.notification.data.repository.notifications import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor import com.android.systemui.statusbar.notification.domain.interactor.headsUpNotificationIconInteractor import com.android.systemui.statusbar.notification.promoted.domain.interactor.aodPromotedNotificationInteractor +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style.Base +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.shared.byIsAmbient import com.android.systemui.statusbar.notification.shared.byIsLastMessageFromReply import com.android.systemui.statusbar.notification.shared.byIsPromoted @@ -354,6 +356,6 @@ private val testIcons = private fun promotedContent( key: String, style: PromotedNotificationContentModel.Style, -): PromotedNotificationContentModel { - return PromotedNotificationContentModel.Builder(key).apply { this.style = style }.build() +): PromotedNotificationContentModels { + return PromotedNotificationContentBuilder(key).applyToShared { this.style = style }.build() } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorImplTest.kt index 0ac944a43de6..cc016b9768b7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorImplTest.kt @@ -33,18 +33,21 @@ import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase +import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_NONE +import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_PUBLIC import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder import com.android.systemui.statusbar.notification.promoted.AutomaticPromotionCoordinator.Companion.EXTRA_WAS_AUTOMATICALLY_PROMOTED -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.When +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.row.RowImageInflater import com.android.systemui.testKosmos import com.android.systemui.util.time.fakeSystemClock import com.android.systemui.util.time.systemClock import com.google.common.truth.Truth.assertThat +import kotlin.test.assertNotNull import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes import org.junit.Test @@ -112,12 +115,43 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { setContentText(TEST_CONTENT_TEXT) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.subText).isEqualTo(TEST_SUB_TEXT) - assertThat(content?.title).isEqualTo(TEST_CONTENT_TITLE) - assertThat(content?.text).isEqualTo(TEST_CONTENT_TEXT) + content.privateVersion.apply { + assertThat(subText).isEqualTo(TEST_SUB_TEXT) + assertThat(title).isEqualTo(TEST_CONTENT_TITLE) + assertThat(text).isEqualTo(TEST_CONTENT_TEXT) + } + + content.publicVersion.apply { + assertThat(subText).isNull() + assertThat(title).isNull() + assertThat(text).isNull() + } + } + + @Test + @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) + fun extractsContent_commonFields_noRedaction() { + val entry = createEntry { + setSubText(TEST_SUB_TEXT) + setContentTitle(TEST_CONTENT_TITLE) + setContentText(TEST_CONTENT_TEXT) + } + + val content = requireContent(entry, redactionType = REDACTION_TYPE_NONE) + + content.privateVersion.apply { + assertThat(subText).isEqualTo(TEST_SUB_TEXT) + assertThat(title).isEqualTo(TEST_CONTENT_TITLE) + assertThat(text).isEqualTo(TEST_CONTENT_TEXT) + } + + content.publicVersion.apply { + assertThat(subText).isEqualTo(TEST_SUB_TEXT) + assertThat(title).isEqualTo(TEST_CONTENT_TITLE) + assertThat(text).isEqualTo(TEST_CONTENT_TEXT) + } } @Test @@ -125,9 +159,9 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { fun extractContent_wasPromotedAutomatically_false() { val entry = createEntry { extras.putBoolean(EXTRA_WAS_AUTOMATICALLY_PROMOTED, false) } - val content = extractContent(entry) + val content = requireContent(entry).privateVersion - assertThat(content!!.wasPromotedAutomatically).isFalse() + assertThat(content.wasPromotedAutomatically).isFalse() } @Test @@ -135,9 +169,9 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { fun extractContent_wasPromotedAutomatically_true() { val entry = createEntry { extras.putBoolean(EXTRA_WAS_AUTOMATICALLY_PROMOTED, true) } - val content = extractContent(entry) + val content = requireContent(entry).privateVersion - assertThat(content!!.wasPromotedAutomatically).isTrue() + assertThat(content.wasPromotedAutomatically).isTrue() } @Test @@ -146,10 +180,9 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { fun extractContent_apiFlagOff_shortCriticalTextNotExtracted() { val entry = createEntry { setShortCriticalText(TEST_SHORT_CRITICAL_TEXT) } - val content = extractContent(entry) + val content = requireContent(entry).privateVersion - assertThat(content).isNotNull() - assertThat(content?.text).isNull() + assertThat(content.text).isNull() } @Test @@ -161,10 +194,9 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { fun extractContent_apiFlagOn_shortCriticalTextExtracted() { val entry = createEntry { setShortCriticalText(TEST_SHORT_CRITICAL_TEXT) } - val content = extractContent(entry) + val content = requireContent(entry).privateVersion - assertThat(content).isNotNull() - assertThat(content?.shortCriticalText).isEqualTo(TEST_SHORT_CRITICAL_TEXT) + assertThat(content.shortCriticalText).isEqualTo(TEST_SHORT_CRITICAL_TEXT) } @Test @@ -176,10 +208,9 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { fun extractContent_noShortCriticalTextSet_textIsNull() { val entry = createEntry { setShortCriticalText(null) } - val content = extractContent(entry) + val content = requireContent(entry).privateVersion - assertThat(content).isNotNull() - assertThat(content?.shortCriticalText).isNull() + assertThat(content.shortCriticalText).isNull() } @Test @@ -379,17 +410,14 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { setWhen(providedCurrentTime) } - val content = extractContent(entry) - - assertThat(content).isNotNull() + val content = requireContent(entry).privateVersion when (expected) { - ExpectedTime.Null -> assertThat(content?.time).isNull() + ExpectedTime.Null -> assertThat(content.time).isNull() ExpectedTime.Time -> { - val actual = content?.time as? When.Time - assertThat(actual).isNotNull() - assertThat(actual?.currentTimeMillis).isEqualTo(expectedCurrentTime) + val actual = assertNotNull(content.time as? When.Time) + assertThat(actual.currentTimeMillis).isEqualTo(expectedCurrentTime) } ExpectedTime.CountDown, @@ -398,23 +426,24 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { expectedCurrentTime + systemClock.elapsedRealtime() - systemClock.currentTimeMillis() - val actual = content?.time as? When.Chronometer - assertThat(actual).isNotNull() - assertThat(actual?.elapsedRealtimeMillis).isEqualTo(expectedElapsedRealtime) - assertThat(actual?.isCountDown).isEqualTo(expected == ExpectedTime.CountDown) + val actual = assertNotNull(content.time as? When.Chronometer) + assertThat(actual.elapsedRealtimeMillis).isEqualTo(expectedElapsedRealtime) + assertThat(actual.isCountDown).isEqualTo(expected == ExpectedTime.CountDown) } } } + // TODO: Add tests for the style of the publicVersion once we implement that + @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) fun extractContent_fromBaseStyle() { val entry = createEntry { setStyle(null) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.Base) + assertThat(content.privateVersion.style).isEqualTo(Style.Base) + assertThat(content.publicVersion.style).isEqualTo(Style.Base) } @Test @@ -422,10 +451,10 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { fun extractContent_fromBigPictureStyle() { val entry = createEntry { setStyle(BigPictureStyle()) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.BigPicture) + assertThat(content.privateVersion.style).isEqualTo(Style.BigPicture) + assertThat(content.publicVersion.style).isEqualTo(Style.Base) } @Test @@ -442,12 +471,15 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { ) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.BigText) - assertThat(content?.title).isEqualTo(TEST_BIG_CONTENT_TITLE) - assertThat(content?.text).isEqualTo(TEST_BIG_TEXT) + assertThat(content.privateVersion.style).isEqualTo(Style.BigText) + assertThat(content.privateVersion.title).isEqualTo(TEST_BIG_CONTENT_TITLE) + assertThat(content.privateVersion.text).isEqualTo(TEST_BIG_TEXT) + + assertThat(content.publicVersion.style).isEqualTo(Style.Base) + assertThat(content.publicVersion.title).isNull() + assertThat(content.publicVersion.text).isNull() } @Test @@ -464,12 +496,15 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { ) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.BigText) - assertThat(content?.title).isEqualTo(TEST_CONTENT_TITLE) - assertThat(content?.text).isEqualTo(TEST_BIG_TEXT) + assertThat(content.privateVersion.style).isEqualTo(Style.BigText) + assertThat(content.privateVersion.title).isEqualTo(TEST_CONTENT_TITLE) + assertThat(content.privateVersion.text).isEqualTo(TEST_BIG_TEXT) + + assertThat(content.publicVersion.style).isEqualTo(Style.Base) + assertThat(content.publicVersion.title).isNull() + assertThat(content.publicVersion.text).isNull() } @Test @@ -486,12 +521,15 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { ) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.BigText) - assertThat(content?.title).isEqualTo(TEST_BIG_CONTENT_TITLE) - assertThat(content?.text).isEqualTo(TEST_CONTENT_TEXT) + assertThat(content.privateVersion.style).isEqualTo(Style.BigText) + assertThat(content.privateVersion.title).isEqualTo(TEST_BIG_CONTENT_TITLE) + assertThat(content.privateVersion.text).isEqualTo(TEST_CONTENT_TEXT) + + assertThat(content.publicVersion.style).isEqualTo(Style.Base) + assertThat(content.publicVersion.title).isNull() + assertThat(content.publicVersion.text).isNull() } @Test @@ -506,11 +544,14 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { ) val entry = createEntry { setStyle(CallStyle.forOngoingCall(TEST_PERSON, hangUpIntent)) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.Call) - assertThat(content?.title).isEqualTo(TEST_PERSON_NAME) + assertThat(content.privateVersion.style).isEqualTo(Style.Call) + assertThat(content.privateVersion.title).isEqualTo(TEST_PERSON_NAME) + + assertThat(content.publicVersion.style).isEqualTo(Style.Base) + assertThat(content.publicVersion.title).isNull() + assertThat(content.publicVersion.text).isNull() } @Test @@ -524,13 +565,17 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { setStyle(ProgressStyle().addProgressSegment(Segment(100)).setProgress(75)) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.Progress) - assertThat(content?.newProgress).isNotNull() - assertThat(content?.newProgress?.progress).isEqualTo(75) - assertThat(content?.newProgress?.progressMax).isEqualTo(100) + assertThat(content.privateVersion.style).isEqualTo(Style.Progress) + val newProgress = assertNotNull(content.privateVersion.newProgress) + assertThat(newProgress.progress).isEqualTo(75) + assertThat(newProgress.progressMax).isEqualTo(100) + + assertThat(content.publicVersion.style).isEqualTo(Style.Base) + assertThat(content.publicVersion.title).isNull() + assertThat(content.publicVersion.text).isNull() + assertThat(content.publicVersion.newProgress).isNull() } @Test @@ -540,10 +585,11 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { setStyle(MessagingStyle(TEST_PERSON).addMessage("message text", 0L, TEST_PERSON)) } - val content = extractContent(entry) + val content = requireContent(entry) - assertThat(content).isNotNull() - assertThat(content?.style).isEqualTo(Style.Ineligible) + assertThat(content.privateVersion.style).isEqualTo(Style.Ineligible) + + assertThat(content.publicVersion.style).isEqualTo(Style.Ineligible) } @Test @@ -553,18 +599,13 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { setProgress(TEST_PROGRESS_MAX, TEST_PROGRESS, /* indeterminate= */ false) } - val content = extractContent(entry) - - assertThat(content).isNotNull() + val content = requireContent(entry) - val oldProgress = content?.oldProgress - assertThat(oldProgress).isNotNull() + val oldProgress = assertNotNull(content.privateVersion.oldProgress) - assertThat(content).isNotNull() - assertThat(content?.oldProgress).isNotNull() - assertThat(content?.oldProgress?.progress).isEqualTo(TEST_PROGRESS) - assertThat(content?.oldProgress?.max).isEqualTo(TEST_PROGRESS_MAX) - assertThat(content?.oldProgress?.isIndeterminate).isFalse() + assertThat(oldProgress.progress).isEqualTo(TEST_PROGRESS) + assertThat(oldProgress.max).isEqualTo(TEST_PROGRESS_MAX) + assertThat(oldProgress.isIndeterminate).isFalse() } @Test @@ -574,18 +615,25 @@ class PromotedNotificationContentExtractorImplTest : SysuiTestCase() { setProgress(TEST_PROGRESS_MAX, TEST_PROGRESS, /* indeterminate= */ true) } - val content = extractContent(entry) + val content = requireContent(entry) + val oldProgress = assertNotNull(content.privateVersion.oldProgress) - assertThat(content).isNotNull() - assertThat(content?.oldProgress).isNotNull() - assertThat(content?.oldProgress?.progress).isEqualTo(TEST_PROGRESS) - assertThat(content?.oldProgress?.max).isEqualTo(TEST_PROGRESS_MAX) - assertThat(content?.oldProgress?.isIndeterminate).isTrue() + assertThat(oldProgress.progress).isEqualTo(TEST_PROGRESS) + assertThat(oldProgress.max).isEqualTo(TEST_PROGRESS_MAX) + assertThat(oldProgress.isIndeterminate).isTrue() } - private fun extractContent(entry: NotificationEntry): PromotedNotificationContentModel? { + private fun requireContent( + entry: NotificationEntry, + redactionType: Int = REDACTION_TYPE_PUBLIC, + ): PromotedNotificationContentModels = assertNotNull(extractContent(entry, redactionType)) + + private fun extractContent( + entry: NotificationEntry, + redactionType: Int = REDACTION_TYPE_PUBLIC, + ): PromotedNotificationContentModels? { val recoveredBuilder = Notification.Builder(context, entry.sbn.notification) - return underTest.extractContent(entry, recoveredBuilder, imageModelProvider) + return underTest.extractContent(entry, recoveredBuilder, redactionType, imageModelProvider) } private fun createEntry( diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractorTest.kt index 873ab5bc9c2c..42c3f6603ad8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractorTest.kt @@ -44,7 +44,7 @@ import com.android.systemui.statusbar.notification.data.repository.activeNotific import com.android.systemui.statusbar.notification.data.repository.addNotif import com.android.systemui.statusbar.notification.domain.interactor.renderNotificationListInteractor import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.phone.ongoingcall.StatusBarChipsModernization import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallTestHelper.addOngoingCallState import com.android.systemui.testKosmos @@ -562,14 +562,14 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) ) activeNotificationListRepository.addNotif( activeNotificationModel( key = "notif2", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ) ) @@ -608,14 +608,14 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), + promotedContent = PromotedNotificationContentBuilder("notif1").build(), ) ) activeNotificationListRepository.addNotif( activeNotificationModel( key = "notif2", statusBarChipIcon = createStatusBarIconViewOrNull(), - promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), + promotedContent = PromotedNotificationContentBuilder("notif2").build(), ) ) @@ -643,8 +643,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.aodPromotedNotification) // THEN the ron is first because the call has no content - assertThat(topPromotedNotificationContent?.identity?.key) - .isEqualTo("0|test_pkg|0|ron|0") + assertThat(topPromotedNotificationContent?.key).isEqualTo("0|test_pkg|0|ron|0") } @Test @@ -663,8 +662,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.aodPromotedNotification) // THEN the call is the top notification - assertThat(topPromotedNotificationContent?.identity?.key) - .isEqualTo("0|test_pkg|0|call|0") + assertThat(topPromotedNotificationContent?.key).isEqualTo("0|test_pkg|0|call|0") } @Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java index 99f2596dbf1d..19b1046f1931 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java @@ -67,11 +67,11 @@ import com.android.systemui.media.controls.util.MediaFeatureFlag; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips; import com.android.systemui.statusbar.notification.ConversationNotificationProcessor; -import com.android.systemui.statusbar.notification.collection.EntryAdapter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.promoted.FakePromotedNotificationContentExtractor; import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi; -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel; +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder; +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.BindParams; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationCallback; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag; @@ -389,8 +389,8 @@ public class NotificationContentInflaterTest extends SysuiTestCase { @Test @DisableFlags({PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME}) public void testExtractsPromotedContent_notWhenBothFlagsDisabled() throws Exception { - final PromotedNotificationContentModel content = - new PromotedNotificationContentModel.Builder("key").build(); + final PromotedNotificationContentModels content = + new PromotedNotificationContentBuilder("key").build(); mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content); inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow); @@ -401,43 +401,43 @@ public class NotificationContentInflaterTest extends SysuiTestCase { @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME) @DisableFlags(StatusBarNotifChips.FLAG_NAME) - public void testExtractsPromotedContent_whenPromotedNotificationUiFlagEnabled() + public void testExtractsPromotedContent_whePromotedNotificationUiFlagEnabled() throws Exception { - final PromotedNotificationContentModel content = - new PromotedNotificationContentModel.Builder("key").build(); + final PromotedNotificationContentModels content = + new PromotedNotificationContentBuilder("key").build(); mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content); inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow); mPromotedNotificationContentExtractor.verifyOneExtractCall(); - assertEquals(content, mRow.getEntry().getPromotedNotificationContentModel()); + assertEquals(content, mRow.getEntry().getPromotedNotificationContentModels()); } @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) @DisableFlags(PromotedNotificationUi.FLAG_NAME) public void testExtractsPromotedContent_whenStatusBarNotifChipsFlagEnabled() throws Exception { - final PromotedNotificationContentModel content = - new PromotedNotificationContentModel.Builder("key").build(); + final PromotedNotificationContentModels content = + new PromotedNotificationContentBuilder("key").build(); mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content); inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow); mPromotedNotificationContentExtractor.verifyOneExtractCall(); - assertEquals(content, mRow.getEntry().getPromotedNotificationContentModel()); + assertEquals(content, mRow.getEntry().getPromotedNotificationContentModels()); } @Test @EnableFlags({PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME}) public void testExtractsPromotedContent_whenBothFlagsEnabled() throws Exception { - final PromotedNotificationContentModel content = - new PromotedNotificationContentModel.Builder("key").build(); + final PromotedNotificationContentModels content = + new PromotedNotificationContentBuilder("key").build(); mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content); inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow); mPromotedNotificationContentExtractor.verifyOneExtractCall(); - assertEquals(content, mRow.getEntry().getPromotedNotificationContentModel()); + assertEquals(content, mRow.getEntry().getPromotedNotificationContentModels()); } @Test @@ -448,7 +448,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase { inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow); mPromotedNotificationContentExtractor.verifyOneExtractCall(); - assertNull(mRow.getEntry().getPromotedNotificationContentModel()); + assertNull(mRow.getEntry().getPromotedNotificationContentModels()); } @Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt index 063a04ab9f37..dcba3e447dda 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt @@ -44,7 +44,7 @@ import com.android.systemui.statusbar.notification.ConversationNotificationProce import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.promoted.FakePromotedNotificationContentExtractor import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.BindParams import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_ALL import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_CONTRACTED @@ -456,7 +456,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { @Test @DisableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) fun testExtractsPromotedContent_notWhenBothFlagsDisabled() { - val content = PromotedNotificationContentModel.Builder("key").build() + val content = PromotedNotificationContentBuilder("key").build() promotedNotificationContentExtractor.resetForEntry(row.entry, content) inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row) @@ -468,38 +468,38 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { @EnableFlags(PromotedNotificationUi.FLAG_NAME) @DisableFlags(StatusBarNotifChips.FLAG_NAME) fun testExtractsPromotedContent_whenPromotedNotificationUiFlagEnabled() { - val content = PromotedNotificationContentModel.Builder("key").build() + val content = PromotedNotificationContentBuilder("key").build() promotedNotificationContentExtractor.resetForEntry(row.entry, content) inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row) promotedNotificationContentExtractor.verifyOneExtractCall() - Assert.assertEquals(content, row.entry.promotedNotificationContentModel) + Assert.assertEquals(content, row.entry.promotedNotificationContentModels) } @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) @DisableFlags(PromotedNotificationUi.FLAG_NAME) fun testExtractsPromotedContent_whenStatusBarNotifChipsFlagEnabled() { - val content = PromotedNotificationContentModel.Builder("key").build() + val content = PromotedNotificationContentBuilder("key").build() promotedNotificationContentExtractor.resetForEntry(row.entry, content) inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row) promotedNotificationContentExtractor.verifyOneExtractCall() - Assert.assertEquals(content, row.entry.promotedNotificationContentModel) + Assert.assertEquals(content, row.entry.promotedNotificationContentModels) } @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME) fun testExtractsPromotedContent_whenBothFlagsEnabled() { - val content = PromotedNotificationContentModel.Builder("key").build() + val content = PromotedNotificationContentBuilder("key").build() promotedNotificationContentExtractor.resetForEntry(row.entry, content) inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row) promotedNotificationContentExtractor.verifyOneExtractCall() - Assert.assertEquals(content, row.entry.promotedNotificationContentModel) + Assert.assertEquals(content, row.entry.promotedNotificationContentModels) } @Test @@ -510,7 +510,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row) promotedNotificationContentExtractor.verifyOneExtractCall() - Assert.assertNull(row.entry.promotedNotificationContentModel) + Assert.assertNull(row.entry.promotedNotificationContentModels) } @Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt index c58b4bc9953c..18074d53e87b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt @@ -40,7 +40,7 @@ import com.android.systemui.statusbar.notification.data.model.activeNotification import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.statusbar.phone.ongoingcall.data.repository.ongoingCallRepository @@ -170,7 +170,7 @@ class OngoingCallControllerTest : SysuiTestCase() { @Test fun interactorHasOngoingCallNotif_repoHasPromotedContent() = testScope.runTest { - val promotedContent = PromotedNotificationContentModel.Builder("ongoingNotif").build() + val promotedContent = PromotedNotificationContentBuilder("ongoingNotif").build() setNotifOnRepo( activeNotificationModel( key = "ongoingNotif", diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt index 84f1d5cd4895..c071327ae398 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt @@ -29,7 +29,7 @@ import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.statusbar.StatusBarIconView import com.android.systemui.statusbar.data.repository.fakeStatusBarModeRepository import com.android.systemui.statusbar.gesture.swipeStatusBarAwayGestureHandler -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder import com.android.systemui.statusbar.phone.ongoingcall.EnableChipsModernization import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallTestHelper.addOngoingCallState @@ -75,7 +75,7 @@ class OngoingCallInteractorTest : SysuiTestCase() { val startTimeMs = 1000L val testIconView: StatusBarIconView = mock() val testIntent: PendingIntent = mock() - val testPromotedContent = PromotedNotificationContentModel.Builder(key).build() + val testPromotedContent = PromotedNotificationContentBuilder(key).build() addOngoingCallState( key = key, startTimeMs = startTimeMs, @@ -106,7 +106,7 @@ class OngoingCallInteractorTest : SysuiTestCase() { val startTimeMs = 1000L val testIconView: StatusBarIconView = mock() val testIntent: PendingIntent = mock() - val testPromotedContent = PromotedNotificationContentModel.Builder(key).build() + val testPromotedContent = PromotedNotificationContentBuilder(key).build() addOngoingCallState( key = key, startTimeMs = startTimeMs, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt index 1f2079d83e6f..356731cb3777 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt @@ -17,7 +17,7 @@ package com.android.systemui.statusbar.chips.notification.domain.model import com.android.systemui.statusbar.StatusBarIconView -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels /** Modeling all the data needed to render a status bar notification chip. */ data class NotificationChipModel( @@ -25,7 +25,7 @@ data class NotificationChipModel( /** The user-readable name of the app that posted this notification. */ val appName: String, val statusBarChipIconView: StatusBarIconView?, - val promotedContent: PromotedNotificationContentModel, + val promotedContent: PromotedNotificationContentModels, /** The time when the notification first appeared as promoted. */ val creationTime: Long, /** True if the app managing this notification is currently visible to the user. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt index b303751b4d6e..dfbd12d5a215 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt @@ -72,6 +72,8 @@ constructor( headsUpState: TopPinnedState ): OngoingActivityChipModel.Active { StatusBarNotifChips.unsafeAssertInNewMode() + // Chips are never shown when locked, so it's safe to use the version with sensitive content + val chipContent = promotedContent.privateVersion val contentDescription = getContentDescription(this.appName) val icon = if (this.statusBarChipIconView != null) { @@ -123,21 +125,18 @@ constructor( ) } - if (this.promotedContent.shortCriticalText != null) { + if (chipContent.shortCriticalText != null) { return OngoingActivityChipModel.Active.Text( key = this.key, icon = icon, colors = colors, - text = this.promotedContent.shortCriticalText, + text = chipContent.shortCriticalText, onClickListenerLegacy = onClickListenerLegacy, clickBehavior = clickBehavior, ) } - if ( - Flags.promoteNotificationsAutomatically() && - this.promotedContent.wasPromotedAutomatically - ) { + if (Flags.promoteNotificationsAutomatically() && chipContent.wasPromotedAutomatically) { // When we're promoting notifications automatically, the `when` time set on the // notification will likely just be set to the current time, which would cause the chip // to always show "now". We don't want early testers to get that experience since it's @@ -151,7 +150,7 @@ constructor( ) } - if (this.promotedContent.time == null) { + if (chipContent.time == null) { return OngoingActivityChipModel.Active.IconOnly( key = this.key, icon = icon, @@ -161,17 +160,17 @@ constructor( ) } - when (this.promotedContent.time) { + when (chipContent.time) { is PromotedNotificationContentModel.When.Time -> { return if ( - this.promotedContent.time.currentTimeMillis >= + chipContent.time.currentTimeMillis >= systemClock.currentTimeMillis() + FUTURE_TIME_THRESHOLD_MILLIS ) { OngoingActivityChipModel.Active.ShortTimeDelta( key = this.key, icon = icon, colors = colors, - time = this.promotedContent.time.currentTimeMillis, + time = chipContent.time.currentTimeMillis, onClickListenerLegacy = onClickListenerLegacy, clickBehavior = clickBehavior, ) @@ -198,8 +197,8 @@ constructor( key = this.key, icon = icon, colors = colors, - startTimeMs = this.promotedContent.time.elapsedRealtimeMillis, - isEventInFuture = this.promotedContent.time.isCountDown, + startTimeMs = chipContent.time.elapsedRealtimeMillis, + isEventInFuture = chipContent.time.isCountDown, onClickListenerLegacy = onClickListenerLegacy, clickBehavior = clickBehavior, ) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index 4558017a98c8..b5ab0920a470 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -68,6 +68,7 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.No import com.android.systemui.statusbar.notification.headsup.PinnedStatus; import com.android.systemui.statusbar.notification.icon.IconPack; import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel; +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRowController; import com.android.systemui.statusbar.notification.row.NotificationGuts; @@ -198,7 +199,7 @@ public final class NotificationEntry extends ListEntry { // TODO(b/377565433): Move into NotificationContentModel during/after // NotificationRowContentBinderRefactor. - private PromotedNotificationContentModel mPromotedNotificationContentModel; + private PromotedNotificationContentModels mPromotedNotificationContentModels; /** * True if both @@ -1106,9 +1107,9 @@ public final class NotificationEntry extends ListEntry { * Gets the content needed to render this notification as a promoted notification on various * surfaces (like status bar chips and AOD). */ - public PromotedNotificationContentModel getPromotedNotificationContentModel() { + public PromotedNotificationContentModels getPromotedNotificationContentModels() { if (PromotedNotificationContentModel.featureFlagEnabled()) { - return mPromotedNotificationContentModel; + return mPromotedNotificationContentModels; } else { Log.wtf(TAG, "getting promoted content without feature flag enabled", new Throwable()); return null; @@ -1127,10 +1128,10 @@ public final class NotificationEntry extends ListEntry { * Sets the content needed to render this notification as a promoted notification on various * surfaces (like status bar chips and AOD). */ - public void setPromotedNotificationContentModel( - @Nullable PromotedNotificationContentModel promotedNotificationContentModel) { + public void setPromotedNotificationContentModels( + @Nullable PromotedNotificationContentModels promotedNotificationContentModels) { if (PromotedNotificationContentModel.featureFlagEnabled()) { - this.mPromotedNotificationContentModel = promotedNotificationContentModel; + this.mPromotedNotificationContentModels = promotedNotificationContentModels; } else { Log.wtf(TAG, "setting promoted content without feature flag enabled", new Throwable()); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java index 990ad9b5cd51..6042bff4bb97 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java @@ -324,7 +324,7 @@ public interface NotificationsModule { if (PromotedNotificationContentModel.featureFlagEnabled()) { return implProvider.get(); } else { - return (entry, recoveredBuilder, imageModelProvider) -> null; + return (entry, recoveredBuilder, redactionType, imageModelProvider) -> null; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt index 2f9d86b45d1f..e7cc342ab65c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt @@ -36,6 +36,7 @@ import com.android.systemui.statusbar.notification.collection.provider.SectionSt import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationListRepository import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.shared.ActiveNotificationEntryModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationGroupModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel @@ -141,7 +142,7 @@ private class ActiveNotificationsStoreBuilder( private fun NotificationEntry.toModel(): ActiveNotificationModel { val promotedContent = if (PromotedNotificationContentModel.featureFlagEnabled()) { - promotedNotificationContentModel + promotedNotificationContentModels } else { null } @@ -199,7 +200,7 @@ private fun ActiveNotificationsStore.createOrReuse( isGroupSummary: Boolean, bucket: Int, callType: CallType, - promotedContent: PromotedNotificationContentModel?, + promotedContent: PromotedNotificationContentModels?, ): ActiveNotificationModel { return individuals[key]?.takeIf { it.isCurrent( @@ -281,7 +282,7 @@ private fun ActiveNotificationModel.isCurrent( isGroupSummary: Boolean, bucket: Int, callType: CallType, - promotedContent: PromotedNotificationContentModel?, + promotedContent: PromotedNotificationContentModels?, ): Boolean { return when { key != this.key -> false diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt index 27b2788f0b08..a8a7e885d1f7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractor.kt @@ -40,6 +40,8 @@ import android.graphics.drawable.Icon import com.android.systemui.Flags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.shade.ShadeDisplayAware +import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_NONE +import com.android.systemui.statusbar.NotificationLockscreenUserManager.RedactionType import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.promoted.AutomaticPromotionCoordinator.Companion.EXTRA_AUTOMATICALLY_EXTRACTED_SHORT_CRITICAL_TEXT import com.android.systemui.statusbar.notification.promoted.AutomaticPromotionCoordinator.Companion.EXTRA_WAS_AUTOMATICALLY_PROMOTED @@ -48,6 +50,7 @@ import com.android.systemui.statusbar.notification.promoted.shared.model.Promote import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.OldProgress import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.When +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.row.shared.ImageModel import com.android.systemui.statusbar.notification.row.shared.ImageModelProvider import com.android.systemui.statusbar.notification.row.shared.ImageModelProvider.ImageSizeClass.MediumSquare @@ -60,8 +63,9 @@ interface PromotedNotificationContentExtractor { fun extractContent( entry: NotificationEntry, recoveredBuilder: Notification.Builder, + @RedactionType redactionType: Int, imageModelProvider: ImageModelProvider, - ): PromotedNotificationContentModel? + ): PromotedNotificationContentModels? } @SysUISingleton @@ -76,8 +80,9 @@ constructor( override fun extractContent( entry: NotificationEntry, recoveredBuilder: Notification.Builder, + @RedactionType redactionType: Int, imageModelProvider: ImageModelProvider, - ): PromotedNotificationContentModel? { + ): PromotedNotificationContentModels? { if (!PromotedNotificationContentModel.featureFlagEnabled()) { logger.logExtractionSkipped(entry, "feature flags disabled") return null @@ -95,7 +100,55 @@ constructor( return null } - val contentBuilder = PromotedNotificationContentModel.Builder(entry.key) + val privateVersion = + extractPrivateContent( + key = entry.key, + notification = notification, + recoveredBuilder = recoveredBuilder, + lastAudiblyAlertedMs = entry.lastAudiblyAlertedMs, + imageModelProvider = imageModelProvider, + ) + val publicVersion = + if (redactionType == REDACTION_TYPE_NONE) { + privateVersion + } else { + if (notification.publicVersion == null) { + privateVersion.toDefaultPublicVersion() + } else { + // TODO(b/400991304): implement extraction for [Notification.publicVersion] + privateVersion.toDefaultPublicVersion() + } + } + return PromotedNotificationContentModels( + privateVersion = privateVersion, + publicVersion = publicVersion, + ) + .also { logger.logExtractionSucceeded(entry, it) } + } + + private fun PromotedNotificationContentModel.toDefaultPublicVersion(): + PromotedNotificationContentModel = + PromotedNotificationContentModel.Builder(key = identity.key).let { + it.style = if (style == Style.Ineligible) Style.Ineligible else Style.Base + it.smallIcon = smallIcon + it.iconLevel = iconLevel + it.appName = appName + it.time = time + it.lastAudiblyAlertedMs = lastAudiblyAlertedMs + it.profileBadgeResId = profileBadgeResId + it.colors = colors + it.build() + } + + private fun extractPrivateContent( + key: String, + notification: Notification, + recoveredBuilder: Notification.Builder, + lastAudiblyAlertedMs: Long, + imageModelProvider: ImageModelProvider, + ): PromotedNotificationContentModel { + + val contentBuilder = PromotedNotificationContentModel.Builder(key) // TODO: Pitch a fit if style is unsupported or mandatory fields are missing once // FLAG_PROMOTED_ONGOING is set reliably and we're not testing status bar chips. @@ -108,7 +161,7 @@ constructor( contentBuilder.subText = notification.subText() contentBuilder.time = notification.extractWhen() contentBuilder.shortCriticalText = notification.shortCriticalText() - contentBuilder.lastAudiblyAlertedMs = entry.lastAudiblyAlertedMs + contentBuilder.lastAudiblyAlertedMs = lastAudiblyAlertedMs contentBuilder.profileBadgeResId = null // TODO contentBuilder.title = notification.title(recoveredBuilder.style) contentBuilder.text = notification.text(recoveredBuilder.style) @@ -124,7 +177,7 @@ constructor( recoveredBuilder.extractStyleContent(notification, contentBuilder, imageModelProvider) - return contentBuilder.build().also { logger.logExtractionSucceeded(entry, it) } + return contentBuilder.build() } private fun Notification.smallIconModel(imageModelProvider: ImageModelProvider): ImageModel? = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationLogger.kt index 5f9678a06b59..6b6203d6ea4d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationLogger.kt @@ -23,7 +23,7 @@ import com.android.systemui.log.core.LogLevel.ERROR import com.android.systemui.log.core.LogLevel.INFO import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.logKey -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import javax.inject.Inject @OptIn(ExperimentalStdlibApi::class) @@ -56,7 +56,7 @@ constructor(@PromotedNotificationLog private val buffer: LogBuffer) { fun logExtractionSucceeded( entry: NotificationEntry, - content: PromotedNotificationContentModel, + content: PromotedNotificationContentModels, ) { buffer.log( EXTRACTION_TAG, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt index ec4ee4560ea1..d9778bdde0a5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt @@ -22,6 +22,7 @@ import com.android.systemui.statusbar.notification.promoted.shared.model.Promote import com.android.systemui.util.kotlin.FlowDumperImpl import javax.inject.Inject import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map @SysUISingleton @@ -34,6 +35,16 @@ constructor( /** The content to show as the promoted notification on AOD */ val content: Flow<PromotedNotificationContentModel?> = promotedNotificationsInteractor.aodPromotedNotification + .map { + // TODO(b/400991304): show the private version when unlocked + it?.publicVersion + } + .distinctUntilNewInstance() val isPresent: Flow<Boolean> = content.map { it != null }.dumpWhileCollecting("isPresent") + + /** + * Returns flow where all subsequent repetitions of the same object instance are filtered out. + */ + private fun <T> Flow<T>.distinctUntilNewInstance() = distinctUntilChanged { a, b -> a === b } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractor.kt index 96d41f1b3aaf..08e7528631c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractor.kt @@ -25,8 +25,8 @@ import com.android.systemui.statusbar.chips.notification.domain.interactor.Statu import com.android.systemui.statusbar.chips.screenrecord.domain.interactor.ScreenRecordChipInteractor import com.android.systemui.statusbar.chips.screenrecord.domain.model.ScreenRecordChipModel import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style.Ineligible +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel import javax.inject.Inject @@ -201,13 +201,13 @@ constructor( * The top promoted notification represented by a chip, with the order determined by the order * of the chips, not the notifications. */ - private val topPromotedChipNotification: Flow<PromotedNotificationContentModel?> = + private val topPromotedChipNotification: Flow<PromotedNotificationContentModels?> = orderedChipNotifications .map { list -> list.firstNotNullOfOrNull { it.promotedContent } } .distinctUntilNewInstance() /** This is the AOD promoted notification, which should avoid regular changing. */ - val aodPromotedNotification: Flow<PromotedNotificationContentModel?> = + val aodPromotedNotification: Flow<PromotedNotificationContentModels?> = combine( topPromotedChipNotification, activeNotificationsInteractor.topLevelRepresentativeNotifications, @@ -229,13 +229,13 @@ constructor( .flowOn(backgroundDispatcher) private fun List<ActiveNotificationModel>.firstAodEligibleOrNull(): - PromotedNotificationContentModel? { + PromotedNotificationContentModels? { return this.firstNotNullOfOrNull { it.promotedContent?.takeIfAodEligible() } } - private fun PromotedNotificationContentModel.takeIfAodEligible(): - PromotedNotificationContentModel? { - return this.takeUnless { it.style == Ineligible } + private fun PromotedNotificationContentModels.takeIfAodEligible(): + PromotedNotificationContentModels? { + return this.takeUnless { it.privateVersion.style == Ineligible } } /** @@ -251,7 +251,7 @@ constructor( */ private data class NotifAndPromotedContent( val key: String, - val promotedContent: PromotedNotificationContentModel?, + val promotedContent: PromotedNotificationContentModels?, ) { /** * Define the equals of this object to only check the reference equality of the promoted @@ -269,7 +269,7 @@ constructor( /** Define the hashCode to be very quick, even if it increases collisions. */ override fun hashCode(): Int { var result = key.hashCode() - result = 31 * result + (promotedContent?.identity?.hashCode() ?: 0) + result = 31 * result + (promotedContent?.key?.hashCode() ?: 0) return result } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentModel.kt index 57b07204fc6a..ffacf62fccce 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentModel.kt @@ -29,6 +29,31 @@ import com.android.systemui.statusbar.notification.row.ImageResult import com.android.systemui.statusbar.notification.row.LazyImage import com.android.systemui.statusbar.notification.row.shared.ImageModel +data class PromotedNotificationContentModels( + /** The potentially redacted version of the content that will be exposed to the public */ + val publicVersion: PromotedNotificationContentModel, + /** The unredacted version of the content that will be kept private */ + val privateVersion: PromotedNotificationContentModel, +) { + val key: String + get() = privateVersion.identity.key + + init { + check(publicVersion.identity.key == privateVersion.identity.key) { + "public and private models must have the same key" + } + } + + fun toRedactedString(): String { + val publicVersionString = + "==privateVersion".takeIf { privateVersion === publicVersion } + ?: publicVersion.toRedactedString() + return ("PromotedNotificationContentModels(" + + "privateVersion=${privateVersion.toRedactedString()}, " + + "publicVersion=$publicVersionString)") + } +} + /** * The content needed to render a promoted notification to surfaces besides the notification stack, * like the skeleton view on AOD or the status bar chip. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java index d97e25fdfa22..57ceafcd15c6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java @@ -60,6 +60,7 @@ import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor; import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel; +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels; import com.android.systemui.statusbar.notification.row.shared.AsyncGroupHeaderViewInflation; import com.android.systemui.statusbar.notification.row.shared.AsyncHybridViewInflation; import com.android.systemui.statusbar.notification.row.shared.ImageModelProvider; @@ -1003,7 +1004,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder row.mImageModelIndex = result.mRowImageInflater.getNewImageIndex(); if (PromotedNotificationContentModel.featureFlagEnabled()) { - entry.setPromotedNotificationContentModel(result.mPromotedContent); + entry.setPromotedNotificationContentModels(result.mPromotedContent); } boolean setRepliesAndActions = true; @@ -1387,9 +1388,9 @@ public class NotificationContentInflater implements NotificationRowContentBinder mLogger.logAsyncTaskProgress(logKey, "extracting promoted notification content"); final ImageModelProvider imageModelProvider = result.mRowImageInflater.useForContentModel(); - final PromotedNotificationContentModel promotedContent = + final PromotedNotificationContentModels promotedContent = mPromotedNotificationContentExtractor.extractContent(mEntry, - recoveredBuilder, imageModelProvider); + recoveredBuilder, mBindParams.redactionType, imageModelProvider); mLogger.logAsyncTaskProgress(logKey, "extracted promoted notification content: " + promotedContent); @@ -1503,7 +1504,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder static class InflationProgress { RowImageInflater mRowImageInflater; - PromotedNotificationContentModel mPromotedContent; + PromotedNotificationContentModels mPromotedContent; private RemoteViews newContentView; private RemoteViews newHeadsUpView; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt index ae52db88358a..4f1b90544403 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt @@ -53,6 +53,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.logKey import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_CONTRACTED import com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_EXPANDED import com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_HEADSUP @@ -595,7 +596,7 @@ constructor( val rowImageInflater: RowImageInflater, val remoteViews: NewRemoteViews, val contentModel: NotificationContentModel, - val promotedContent: PromotedNotificationContentModel?, + val promotedContent: PromotedNotificationContentModels?, ) { var inflatedContentView: View? = null @@ -700,7 +701,12 @@ constructor( ) val imageModelProvider = rowImageInflater.useForContentModel() promotedNotificationContentExtractor - .extractContent(entry, builder, imageModelProvider) + .extractContent( + entry, + builder, + bindParams.redactionType, + imageModelProvider, + ) .also { logger.logAsyncTaskProgress( entry.logKey, @@ -1519,7 +1525,7 @@ constructor( entry.setContentModel(result.contentModel) if (PromotedNotificationContentModel.featureFlagEnabled()) { - entry.promotedNotificationContentModel = result.promotedContent + entry.promotedNotificationContentModels = result.promotedContent } result.inflatedSmartReplyState?.let { row.privateLayout.setInflatedSmartReplyState(it) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt index 487cbceb13a4..96527389b5fe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt @@ -20,6 +20,7 @@ import android.graphics.drawable.Icon import android.util.Log import com.android.systemui.statusbar.StatusBarIconView import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.stack.PriorityBucket /** @@ -88,7 +89,7 @@ data class ActiveNotificationModel( * The content needed to render this as a promoted notification on various surfaces, or null if * this notification cannot be rendered as a promoted notification. */ - val promotedContent: PromotedNotificationContentModel?, + val promotedContent: PromotedNotificationContentModels?, ) : ActiveNotificationEntryModel() { init { if (!PromotedNotificationContentModel.featureFlagEnabled()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt index 61b7d80a8c85..b7eada1c6804 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt @@ -38,7 +38,7 @@ import com.android.systemui.statusbar.chips.ui.view.ChipChronometer import com.android.systemui.statusbar.data.repository.StatusBarModeRepositoryStore import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.statusbar.phone.ongoingcall.data.repository.OngoingCallRepository @@ -347,7 +347,7 @@ constructor( * If the call notification also meets promoted notification criteria, this field is filled * in with the content related to promotion. Otherwise null. */ - val promotedContent: PromotedNotificationContentModel?, + val promotedContent: PromotedNotificationContentModels?, /** True if the call is currently ongoing (as opposed to incoming, screening, etc.). */ val isOngoing: Boolean, /** True if the user has swiped away the status bar while in this phone call. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt index 322dfff8f144..9546d374b595 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt @@ -18,7 +18,7 @@ package com.android.systemui.statusbar.phone.ongoingcall.shared.model import android.app.PendingIntent import com.android.systemui.statusbar.StatusBarIconView -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels /** Represents the state of any ongoing calls. */ sealed interface OngoingCallModel { @@ -47,7 +47,7 @@ sealed interface OngoingCallModel { val intent: PendingIntent?, val notificationKey: String, val appName: String, - val promotedContent: PromotedNotificationContentModel?, + val promotedContent: PromotedNotificationContentModels?, val isAppVisible: Boolean, ) : OngoingCallModel } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt index 165f85d2cbba..4af4e804ff10 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt @@ -19,7 +19,7 @@ package com.android.systemui.statusbar.notification.data.model import android.app.PendingIntent import android.graphics.drawable.Icon import com.android.systemui.statusbar.StatusBarIconView -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.statusbar.notification.stack.BUCKET_UNKNOWN @@ -49,7 +49,7 @@ fun activeNotificationModel( contentIntent: PendingIntent? = null, bucket: Int = BUCKET_UNKNOWN, callType: CallType = CallType.None, - promotedContent: PromotedNotificationContentModel? = null, + promotedContent: PromotedNotificationContentModels? = null, ) = ActiveNotificationModel( key = key, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/FakePromotedNotificationContentExtractor.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/FakePromotedNotificationContentExtractor.kt index 8fdf5dbf2aeb..aaa86aaaedc6 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/FakePromotedNotificationContentExtractor.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/FakePromotedNotificationContentExtractor.kt @@ -17,21 +17,23 @@ package com.android.systemui.statusbar.notification.promoted import android.app.Notification +import com.android.systemui.statusbar.NotificationLockscreenUserManager.RedactionType import com.android.systemui.statusbar.notification.collection.NotificationEntry -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.row.shared.ImageModelProvider import org.junit.Assert class FakePromotedNotificationContentExtractor : PromotedNotificationContentExtractor { @JvmField - val contentForEntry = mutableMapOf<NotificationEntry, PromotedNotificationContentModel?>() + val contentForEntry = mutableMapOf<NotificationEntry, PromotedNotificationContentModels?>() @JvmField val extractCalls = mutableListOf<Pair<NotificationEntry, Notification.Builder>>() override fun extractContent( entry: NotificationEntry, recoveredBuilder: Notification.Builder, + @RedactionType redactionType: Int, imageModelProvider: ImageModelProvider, - ): PromotedNotificationContentModel? { + ): PromotedNotificationContentModels? { extractCalls.add(entry to recoveredBuilder) if (contentForEntry.isEmpty()) { @@ -44,7 +46,7 @@ class FakePromotedNotificationContentExtractor : PromotedNotificationContentExtr } } - fun resetForEntry(entry: NotificationEntry, content: PromotedNotificationContentModel?) { + fun resetForEntry(entry: NotificationEntry, content: PromotedNotificationContentModels?) { contentForEntry.clear() contentForEntry[entry] = content extractCalls.clear() diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorKosmos.kt index 2b3158da38f9..c4542c4e709b 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/PromotedNotificationContentExtractorKosmos.kt @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.promoted import android.app.Notification import android.content.applicationContext import com.android.systemui.kosmos.Kosmos +import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_NONE import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.row.RowImageInflater import com.android.systemui.statusbar.notification.row.shared.skeletonImageTransform @@ -39,9 +40,10 @@ fun Kosmos.setPromotedContent(entry: NotificationEntry) { promotedNotificationContentExtractor.extractContent( entry, Notification.Builder.recoverBuilder(applicationContext, entry.sbn.notification), + REDACTION_TYPE_NONE, RowImageInflater.newInstance(previousIndex = null, reinflating = false) .useForContentModel(), ) - entry.promotedNotificationContentModel = + entry.promotedNotificationContentModels = requireNotNull(extractedContent) { "extractContent returned null" } } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentBuilder.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentBuilder.kt new file mode 100644 index 000000000000..6916d560a7ad --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/shared/model/PromotedNotificationContentBuilder.kt @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.notification.promoted.shared.model + +class PromotedNotificationContentBuilder(val key: String) { + private val sharedBuilder = PromotedNotificationContentModel.Builder(key) + + fun applyToShared( + block: PromotedNotificationContentModel.Builder.() -> Unit + ): PromotedNotificationContentBuilder { + sharedBuilder.apply(block) + return this + } + + fun build(): PromotedNotificationContentModels { + val sharedModel = sharedBuilder.build() + return PromotedNotificationContentModels(sharedModel, sharedModel) + } +} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallTestHelper.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallTestHelper.kt index 3e96fd7c729f..e5e1a830231e 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallTestHelper.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallTestHelper.kt @@ -26,7 +26,7 @@ import com.android.systemui.statusbar.notification.data.model.activeNotification import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.data.repository.addNotif import com.android.systemui.statusbar.notification.data.repository.removeNotif -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel +import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModels import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.statusbar.phone.ongoingcall.StatusBarChipsModernization import com.android.systemui.statusbar.phone.ongoingcall.data.repository.ongoingCallRepository @@ -39,7 +39,7 @@ fun inCallModel( intent: PendingIntent? = null, notificationKey: String = "test", appName: String = "", - promotedContent: PromotedNotificationContentModel? = null, + promotedContent: PromotedNotificationContentModels? = null, isAppVisible: Boolean = false, ) = OngoingCallModel.InCall( @@ -77,7 +77,7 @@ object OngoingCallTestHelper { key: String = "notif", startTimeMs: Long = 1000L, statusBarChipIconView: StatusBarIconView? = createStatusBarIconViewOrNull(), - promotedContent: PromotedNotificationContentModel? = null, + promotedContent: PromotedNotificationContentModels? = null, contentIntent: PendingIntent? = null, uid: Int = DEFAULT_UID, appName: String = "Fake name", |