summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steve Elliott <steell@google.com> 2020-03-20 11:19:48 -0400
committer Steve Elliott <steell@google.com> 2020-03-20 15:32:05 +0000
commit8568255c25b29cce2357e7be2fe5938d8420f4cc (patch)
tree2ad585efd1115bc632d4273d6a7d8c498f771c15
parenta7aededa7dafdeb1d15cad28e98eadba78b2c0bb (diff)
Upsort important conversations above others
Fixes: 152031857 Fixes: 149046729 Test: manual, atest Change-Id: I7d26a3cc362c216511e7844e85ef1f7f47d7aafd
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt17
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt2
2 files changed, 8 insertions, 11 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt
index 8674047f4ab2..1d5c2894e6c8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt
@@ -78,12 +78,6 @@ open class NotificationRankingManager @Inject constructor(
val aPersonType = a.getPeopleNotificationType()
val bPersonType = b.getPeopleNotificationType()
- val aIsPeople = aPersonType == TYPE_PERSON
- val bIsPeople = bPersonType == TYPE_PERSON
-
- val aIsImportantPeople = aPersonType == TYPE_IMPORTANT_PERSON
- val bIsImportantPeople = bPersonType == TYPE_IMPORTANT_PERSON
-
val aMedia = isImportantMedia(a)
val bMedia = isImportantMedia(b)
@@ -100,9 +94,14 @@ open class NotificationRankingManager @Inject constructor(
aHeadsUp != bHeadsUp -> if (aHeadsUp) -1 else 1
// Provide consistent ranking with headsUpManager
aHeadsUp -> headsUpManager.compare(a, b)
- usePeopleFiltering && aIsPeople != bIsPeople -> if (aIsPeople) -1 else 1
- usePeopleFiltering && aIsImportantPeople != bIsImportantPeople ->
- if (aIsImportantPeople) -1 else 1
+ usePeopleFiltering && aPersonType != bPersonType -> when (aPersonType) {
+ TYPE_IMPORTANT_PERSON -> -1
+ TYPE_PERSON -> when (bPersonType) {
+ TYPE_IMPORTANT_PERSON -> 1
+ else -> -1
+ }
+ else -> 1
+ }
// Upsort current media notification.
aMedia != bMedia -> if (aMedia) -1 else 1
// Upsort PRIORITY_MAX system notifications
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt
index cdf0f2d67c1a..a2599ecb50da 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt
@@ -42,7 +42,6 @@ import com.android.systemui.statusbar.policy.HeadsUpManager
import dagger.Lazy
import junit.framework.Assert.assertEquals
import org.junit.Before
-import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.mock
@@ -194,7 +193,6 @@ class NotificationRankingManagerTest : SysuiTestCase() {
assertEquals(listOf(b, a), rankingManager.updateRanking(null, listOf(a, b), "test"))
}
- @Ignore // TODO: (b/149046729) fix test and re-enable
@Test
fun testSort_importantPeople() {
whenever(sectionsManager.isFilteringEnabled()).thenReturn(true)