Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ConversationCoordinatorTest.kt +39 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.app.Flags import android.app.NotificationChannel import android.app.NotificationChannel.SYSTEM_RESERVED_IDS import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_HIGH import android.app.NotificationManager.IMPORTANCE_LOW Loading Loading @@ -123,6 +124,14 @@ class ConversationCoordinatorTest : SysuiTestCase() { assertFalse(sectioner.isInSection(NotificationEntryBuilder().build())) } @Test fun testPrioritySectioner_doesNotClaim_classifiedConversation() { val sectioner = coordinator.priorityPeopleSectioner for (id in SYSTEM_RESERVED_IDS) { assertFalse(sectioner.isInSection(makeClassifiedConversation(id))) } } @Test fun testPromotesImportantConversations() { assertTrue(promoter.shouldPromoteToTopLevel(makeEntryOfPeopleType(TYPE_IMPORTANT_PERSON))) Loading Loading @@ -165,6 +174,14 @@ class ConversationCoordinatorTest : SysuiTestCase() { verify(conversationIconManager).setUnimportantConversations(eq(listOf(summary.key))) } @Test fun testAlertingSectioner_doesNotClaim_classifiedConversation() { val sectioner = coordinator.peopleAlertingSectioner for (id in SYSTEM_RESERVED_IDS) { assertFalse(sectioner.isInSection(makeClassifiedConversation(id))) } } @Test fun testInAlertingPeopleSectionWhenTheImportanceIsAtLeastDefault() { // GIVEN Loading @@ -184,6 +201,15 @@ class ConversationCoordinatorTest : SysuiTestCase() { assertThat(peopleAlertingSectioner.isInSection(silentEntry)).isTrue() } @Test @DisableFlags(Flags.FLAG_SORT_SECTION_BY_TIME) fun testSilentSectioner_doesNotClaim_classifiedConversation() { val sectioner = coordinator.peopleSilentSectioner for (id in SYSTEM_RESERVED_IDS) { assertFalse(sectioner.isInSection(makeClassifiedConversation(id))) } } @Test @DisableFlags(Flags.FLAG_SORT_SECTION_BY_TIME) fun testInSilentPeopleSectionWhenTheImportanceIsLowerThanDefault() { Loading Loading @@ -280,4 +306,17 @@ class ConversationCoordinatorTest : SysuiTestCase() { assertEquals(type, peopleNotificationIdentifier.getPeopleNotificationType(entry)) return entry } private fun makeClassifiedConversation(channelId: String): NotificationEntry { val channel = NotificationChannel(channelId, channelId, IMPORTANCE_LOW) val entry = NotificationEntryBuilder() .updateRanking { it.setIsConversation(true) it.setShortcutInfo(mock()) it.setChannel(channel) } .build() return entry } } packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/ConversationCoordinator.kt +9 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.app.NotificationChannel.SYSTEM_RESERVED_IDS import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.PipelineEntry import com.android.systemui.statusbar.notification.collection.NotifPipeline Loading Loading @@ -89,6 +90,7 @@ class ConversationCoordinator @Inject constructor( object : NotifSectioner("Priority People", BUCKET_PRIORITY_PEOPLE) { override fun isInSection(entry: PipelineEntry): Boolean { return getPeopleType(entry) == TYPE_IMPORTANT_PERSON && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } } Loading @@ -96,10 +98,12 @@ class ConversationCoordinator @Inject constructor( val peopleAlertingSectioner = object : NotifSectioner("People(alerting)", BUCKET_PEOPLE) { override fun isInSection(entry: PipelineEntry): Boolean { if (SortBySectionTimeFlag.isEnabled) { return highPriorityProvider.isHighPriorityConversation(entry) || isConversation(entry) return (highPriorityProvider.isHighPriorityConversation(entry) || isConversation(entry)) && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } else { return highPriorityProvider.isHighPriorityConversation(entry) && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } } Loading @@ -111,11 +115,12 @@ class ConversationCoordinator @Inject constructor( } val peopleSilentSectioner = object : NotifSectioner("People(silent)", BUCKET_PEOPLE) { // Because the peopleAlertingSectioner is above this one, it will claim all conversations that are alerting. // All remaining conversations must be silent. // Because the peopleAlertingSectioner is above this one, it will claim all conversations // that are alerting. All remaining conversations must be silent. override fun isInSection(entry: PipelineEntry): Boolean { SortBySectionTimeFlag.assertInLegacyMode() return isConversation(entry) && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } override fun getComparator(): NotifComparator { Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ConversationCoordinatorTest.kt +39 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.app.Flags import android.app.NotificationChannel import android.app.NotificationChannel.SYSTEM_RESERVED_IDS import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_HIGH import android.app.NotificationManager.IMPORTANCE_LOW Loading Loading @@ -123,6 +124,14 @@ class ConversationCoordinatorTest : SysuiTestCase() { assertFalse(sectioner.isInSection(NotificationEntryBuilder().build())) } @Test fun testPrioritySectioner_doesNotClaim_classifiedConversation() { val sectioner = coordinator.priorityPeopleSectioner for (id in SYSTEM_RESERVED_IDS) { assertFalse(sectioner.isInSection(makeClassifiedConversation(id))) } } @Test fun testPromotesImportantConversations() { assertTrue(promoter.shouldPromoteToTopLevel(makeEntryOfPeopleType(TYPE_IMPORTANT_PERSON))) Loading Loading @@ -165,6 +174,14 @@ class ConversationCoordinatorTest : SysuiTestCase() { verify(conversationIconManager).setUnimportantConversations(eq(listOf(summary.key))) } @Test fun testAlertingSectioner_doesNotClaim_classifiedConversation() { val sectioner = coordinator.peopleAlertingSectioner for (id in SYSTEM_RESERVED_IDS) { assertFalse(sectioner.isInSection(makeClassifiedConversation(id))) } } @Test fun testInAlertingPeopleSectionWhenTheImportanceIsAtLeastDefault() { // GIVEN Loading @@ -184,6 +201,15 @@ class ConversationCoordinatorTest : SysuiTestCase() { assertThat(peopleAlertingSectioner.isInSection(silentEntry)).isTrue() } @Test @DisableFlags(Flags.FLAG_SORT_SECTION_BY_TIME) fun testSilentSectioner_doesNotClaim_classifiedConversation() { val sectioner = coordinator.peopleSilentSectioner for (id in SYSTEM_RESERVED_IDS) { assertFalse(sectioner.isInSection(makeClassifiedConversation(id))) } } @Test @DisableFlags(Flags.FLAG_SORT_SECTION_BY_TIME) fun testInSilentPeopleSectionWhenTheImportanceIsLowerThanDefault() { Loading Loading @@ -280,4 +306,17 @@ class ConversationCoordinatorTest : SysuiTestCase() { assertEquals(type, peopleNotificationIdentifier.getPeopleNotificationType(entry)) return entry } private fun makeClassifiedConversation(channelId: String): NotificationEntry { val channel = NotificationChannel(channelId, channelId, IMPORTANCE_LOW) val entry = NotificationEntryBuilder() .updateRanking { it.setIsConversation(true) it.setShortcutInfo(mock()) it.setChannel(channel) } .build() return entry } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/ConversationCoordinator.kt +9 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.app.NotificationChannel.SYSTEM_RESERVED_IDS import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.PipelineEntry import com.android.systemui.statusbar.notification.collection.NotifPipeline Loading Loading @@ -89,6 +90,7 @@ class ConversationCoordinator @Inject constructor( object : NotifSectioner("Priority People", BUCKET_PRIORITY_PEOPLE) { override fun isInSection(entry: PipelineEntry): Boolean { return getPeopleType(entry) == TYPE_IMPORTANT_PERSON && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } } Loading @@ -96,10 +98,12 @@ class ConversationCoordinator @Inject constructor( val peopleAlertingSectioner = object : NotifSectioner("People(alerting)", BUCKET_PEOPLE) { override fun isInSection(entry: PipelineEntry): Boolean { if (SortBySectionTimeFlag.isEnabled) { return highPriorityProvider.isHighPriorityConversation(entry) || isConversation(entry) return (highPriorityProvider.isHighPriorityConversation(entry) || isConversation(entry)) && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } else { return highPriorityProvider.isHighPriorityConversation(entry) && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } } Loading @@ -111,11 +115,12 @@ class ConversationCoordinator @Inject constructor( } val peopleSilentSectioner = object : NotifSectioner("People(silent)", BUCKET_PEOPLE) { // Because the peopleAlertingSectioner is above this one, it will claim all conversations that are alerting. // All remaining conversations must be silent. // Because the peopleAlertingSectioner is above this one, it will claim all conversations // that are alerting. All remaining conversations must be silent. override fun isInSection(entry: PipelineEntry): Boolean { SortBySectionTimeFlag.assertInLegacyMode() return isConversation(entry) && entry.representativeEntry?.channel?.id !in SYSTEM_RESERVED_IDS } override fun getComparator(): NotifComparator { Loading