Merge "Do not dismiss priority children of a group being dismissed" into udc-dev am: f0d0864579
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23785932 Change-Id: I187dd159cb0ffa32356c14ad98d20733d8ece297 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -840,6 +840,7 @@ public class NotifCollection implements Dumpable, PipelineDumpable {
|
|||||||
&& !hasFlag(entry, Notification.FLAG_ONGOING_EVENT)
|
&& !hasFlag(entry, Notification.FLAG_ONGOING_EVENT)
|
||||||
&& !hasFlag(entry, Notification.FLAG_BUBBLE)
|
&& !hasFlag(entry, Notification.FLAG_BUBBLE)
|
||||||
&& !hasFlag(entry, Notification.FLAG_NO_CLEAR)
|
&& !hasFlag(entry, Notification.FLAG_NO_CLEAR)
|
||||||
|
&& (entry.getChannel() == null || !entry.getChannel().isImportantConversation())
|
||||||
&& entry.getDismissState() != DISMISSED;
|
&& entry.getDismissState() != DISMISSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1674,12 +1674,22 @@ public class NotifCollectionTest extends SysuiTestCase {
|
|||||||
verifyNoMoreInteractions(mStatusBarService);
|
verifyNoMoreInteractions(mStatusBarService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCanDismissOtherNotificationChildren() {
|
||||||
|
// GIVEN an ongoing notification
|
||||||
|
final NotificationEntry container = new NotificationEntryBuilder()
|
||||||
|
.setGroup(mContext, "group")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// THEN its children are dismissible
|
||||||
|
assertTrue(mCollection.shouldAutoDismissChildren(
|
||||||
|
container, container.getSbn().getGroupKey()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCannotDismissOngoingNotificationChildren() {
|
public void testCannotDismissOngoingNotificationChildren() {
|
||||||
// GIVEN an ongoing notification
|
// GIVEN an ongoing notification
|
||||||
final NotificationEntry container = new NotificationEntryBuilder()
|
final NotificationEntry container = new NotificationEntryBuilder()
|
||||||
.setPkg(TEST_PACKAGE)
|
|
||||||
.setId(47)
|
|
||||||
.setGroup(mContext, "group")
|
.setGroup(mContext, "group")
|
||||||
.setFlag(mContext, FLAG_ONGOING_EVENT, true)
|
.setFlag(mContext, FLAG_ONGOING_EVENT, true)
|
||||||
.build();
|
.build();
|
||||||
@@ -1693,6 +1703,7 @@ public class NotifCollectionTest extends SysuiTestCase {
|
|||||||
public void testCannotDismissNoClearNotifications() {
|
public void testCannotDismissNoClearNotifications() {
|
||||||
// GIVEN an no-clear notification
|
// GIVEN an no-clear notification
|
||||||
final NotificationEntry container = new NotificationEntryBuilder()
|
final NotificationEntry container = new NotificationEntryBuilder()
|
||||||
|
.setGroup(mContext, "group")
|
||||||
.setFlag(mContext, FLAG_NO_CLEAR, true)
|
.setFlag(mContext, FLAG_NO_CLEAR, true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -1701,12 +1712,26 @@ public class NotifCollectionTest extends SysuiTestCase {
|
|||||||
container, container.getSbn().getGroupKey()));
|
container, container.getSbn().getGroupKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCannotDismissPriorityConversations() {
|
||||||
|
// GIVEN an no-clear notification
|
||||||
|
NotificationChannel channel =
|
||||||
|
new NotificationChannel("foo", "Foo", NotificationManager.IMPORTANCE_HIGH);
|
||||||
|
channel.setImportantConversation(true);
|
||||||
|
final NotificationEntry container = new NotificationEntryBuilder()
|
||||||
|
.setGroup(mContext, "group")
|
||||||
|
.setChannel(channel)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// THEN its children are not dismissible
|
||||||
|
assertFalse(mCollection.shouldAutoDismissChildren(
|
||||||
|
container, container.getSbn().getGroupKey()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCanDismissFgsNotificationChildren() {
|
public void testCanDismissFgsNotificationChildren() {
|
||||||
// GIVEN an FGS but not ongoing notification
|
// GIVEN an FGS but not ongoing notification
|
||||||
final NotificationEntry container = new NotificationEntryBuilder()
|
final NotificationEntry container = new NotificationEntryBuilder()
|
||||||
.setPkg(TEST_PACKAGE)
|
|
||||||
.setId(47)
|
|
||||||
.setGroup(mContext, "group")
|
.setGroup(mContext, "group")
|
||||||
.setFlag(mContext, FLAG_FOREGROUND_SERVICE, true)
|
.setFlag(mContext, FLAG_FOREGROUND_SERVICE, true)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
Reference in New Issue
Block a user