Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.statusbar.notification.collection.coordinator; import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST; Loading Loading @@ -339,6 +341,13 @@ public class RankingCoordinatorTest extends SysuiTestCase { verify(mSilentHeaderController, times(2)).setClearSectionEnabled(eq(false)); } @Test public void testAlertingSectioner_rejectsBundle() { for (String id : SYSTEM_RESERVED_IDS) { assertFalse(mAlertingSectioner.isInSection(makeClassifiedNotifEntry(id))); } } @Test public void statusBarStateCallbackTest() { mStatusBarStateCallback.onDozeAmountChanged(1f, 1f); Loading Loading @@ -392,4 +401,11 @@ public class RankingCoordinatorTest extends SysuiTestCase { .build()); assertEquals(ambient, mEntry.getRanking().isAmbient()); } private NotificationEntry makeClassifiedNotifEntry(String channelId) { NotificationChannel channel = new NotificationChannel(channelId, channelId, IMPORTANCE_LOW); return new NotificationEntryBuilder() .updateRanking((rankingBuilder -> rankingBuilder.setChannel(channel))) .build(); } } packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinator.java +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.collection.coordinator; import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -99,7 +101,11 @@ public class RankingCoordinator implements Coordinator { NotificationPriorityBucketKt.BUCKET_ALERTING) { @Override public boolean isInSection(PipelineEntry entry) { return mHighPriorityProvider.isHighPriority(entry); return mHighPriorityProvider.isHighPriority(entry) && entry.getRepresentativeEntry() != null && entry.getRepresentativeEntry().getChannel() != null && !SYSTEM_RESERVED_IDS.contains( entry.getRepresentativeEntry().getChannel().getId()); } @Nullable Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinatorTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.statusbar.notification.collection.coordinator; import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST; Loading Loading @@ -339,6 +341,13 @@ public class RankingCoordinatorTest extends SysuiTestCase { verify(mSilentHeaderController, times(2)).setClearSectionEnabled(eq(false)); } @Test public void testAlertingSectioner_rejectsBundle() { for (String id : SYSTEM_RESERVED_IDS) { assertFalse(mAlertingSectioner.isInSection(makeClassifiedNotifEntry(id))); } } @Test public void statusBarStateCallbackTest() { mStatusBarStateCallback.onDozeAmountChanged(1f, 1f); Loading Loading @@ -392,4 +401,11 @@ public class RankingCoordinatorTest extends SysuiTestCase { .build()); assertEquals(ambient, mEntry.getRanking().isAmbient()); } private NotificationEntry makeClassifiedNotifEntry(String channelId) { NotificationChannel channel = new NotificationChannel(channelId, channelId, IMPORTANCE_LOW); return new NotificationEntryBuilder() .updateRanking((rankingBuilder -> rankingBuilder.setChannel(channel))) .build(); } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/RankingCoordinator.java +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.collection.coordinator; import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -99,7 +101,11 @@ public class RankingCoordinator implements Coordinator { NotificationPriorityBucketKt.BUCKET_ALERTING) { @Override public boolean isInSection(PipelineEntry entry) { return mHighPriorityProvider.isHighPriority(entry); return mHighPriorityProvider.isHighPriority(entry) && entry.getRepresentativeEntry() != null && entry.getRepresentativeEntry().getChannel() != null && !SYSTEM_RESERVED_IDS.contains( entry.getRepresentativeEntry().getChannel().getId()); } @Nullable Loading