Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.kt +5 −5 Original line number Diff line number Diff line Loading @@ -204,7 +204,7 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { collectLastValue(promotedNotificationsInteractor.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|screenRecord|0") .containsExactly(screenRecordEntry.key) .inOrder() // THEN the entry is in the fgs section Loading Loading @@ -233,7 +233,7 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { collectLastValue(promotedNotificationsInteractor.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|screenRecord|0") .containsExactly(screenRecordEntry.key) .inOrder() // THEN the entry is NOT in the fgs section Loading Loading @@ -262,7 +262,7 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { collectLastValue(promotedNotificationsInteractor.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|screenRecord|0") .containsExactly(screenRecordEntry.key) .inOrder() // THEN the entry is NOT in the fgs section Loading Loading @@ -322,8 +322,8 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { // THEN the order of the notification keys should be the call then the RON assertThat(orderedChipNotificationKeys) .containsExactly( "0|com.android.systemui.tests|0|call|0", "0|com.android.systemui.tests|0|ron|0", callEntry.key, ronEntry.key, ) // VERIFY that the comparator puts the call before the ron Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractorTest.kt +17 −20 Original line number Diff line number Diff line Loading @@ -85,8 +85,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) // THEN the call shouldn't be in the list assertThat(orderedChipNotificationKeys).containsExactly( "0|com.android.systemui.tests|0|ron|0") assertThat(orderedChipNotificationKeys).containsExactly(ronEntry.key) } @Test Loading @@ -107,8 +106,8 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { // THEN the order of the notification keys should be the call then the RON assertThat(orderedChipNotificationKeys) .containsExactly( "0|com.android.systemui.tests|0|call|0", "0|com.android.systemui.tests|0|ron|0", callEntry.key, ronEntry.key, ) .inOrder() } Loading Loading @@ -163,7 +162,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|record|0") .containsExactly(screenRecordEntry.key) .inOrder() } Loading @@ -186,7 +185,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|record|0") .containsExactly(screenRecordEntry.key) .inOrder() } Loading @@ -209,7 +208,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|record|0") .containsExactly(screenRecordEntry.key) .inOrder() } Loading Loading @@ -258,7 +257,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|recordFgs|0") .containsExactly(fgsEntry.key) .inOrder() } Loading @@ -285,7 +284,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|recordOngoing|0") .containsExactly(ongoingEntry.key) .inOrder() } Loading Loading @@ -321,7 +320,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|recordBoth|0") .containsExactly(ongoingAndFgsEntry.key) .inOrder() } Loading Loading @@ -385,7 +384,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|proj|0") .containsExactly(mediaProjEntry.key) .inOrder() } Loading @@ -409,7 +408,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|proj|0") .containsExactly(mediaProjEntry.key) .inOrder() } Loading @@ -433,7 +432,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|proj|0") .containsExactly(mediaProjEntry.key) .inOrder() } Loading Loading @@ -484,7 +483,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|projFgs|0") .containsExactly(fgsEntry.key) .inOrder() } Loading Loading @@ -512,7 +511,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|projOngoing|0") .containsExactly(ongoingEntry.key) .inOrder() } Loading Loading @@ -549,7 +548,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|projBoth|0") .containsExactly(ongoingAndFgsEntry.key) .inOrder() } Loading Loading @@ -667,8 +666,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.aodPromotedNotification) // THEN the ron is first because the call has no content assertThat(topPromotedNotificationContent?.key) .isEqualTo("0|com.android.systemui.tests|0|ron|0") assertThat(topPromotedNotificationContent?.key).isEqualTo(ronEntry.key) } @Test Loading @@ -687,8 +685,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.aodPromotedNotification) // THEN the call is the top notification assertThat(topPromotedNotificationContent?.key) .isEqualTo("0|com.android.systemui.tests|0|call|0") assertThat(topPromotedNotificationContent?.key).isEqualTo(callEntry.key) } @Test Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java +0 −172 Original line number Diff line number Diff line Loading @@ -346,47 +346,6 @@ public class NotificationTestHelper { return generateRow(createNotification(), PKG, UID, USER_HANDLE, extraInflationFlags); } /** * Returns an {@link GroupEntry} group with the given number of child * notifications. */ public GroupEntry createGroupEntry(int numChildren, @Nullable List<NotificationEntry> additionalChildren) { Notification summary = new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroupSummary(true) .setGroup(GROUP_KEY) .build(); NotificationEntry summaryEntry = new NotificationEntryBuilder() .setPkg(PKG) .setOpPkg(PKG) .setId(mId++) .setUid(UID) .setInitialPid(2000) .setNotification(summary) .setUser(USER_HANDLE) .setParent(GroupEntry.ROOT_ENTRY) .build(); GroupEntryBuilder groupEntry = new GroupEntryBuilder() .setSummary(summaryEntry); for (int i = 0; i < numChildren; i++) { NotificationEntry child = new NotificationEntryBuilder() .setParent(GroupEntry.ROOT_ENTRY) .setNotification(new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroup(GROUP_KEY) .build()) .build(); groupEntry.addChild(child); } for (NotificationEntry entry : additionalChildren) { groupEntry.addChild(entry); } return groupEntry.build(); } /** * Returns an {@link ExpandableNotificationRow} group with the given number of child * notifications. Loading @@ -413,23 +372,6 @@ public class NotificationTestHelper { return createRow(PKG, UID, USER_HANDLE, false /* isGroupSummary */, groupkey); } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. */ public ExpandableNotificationRow createBubble() throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link ExpandableNotificationRow} that shows as a sticky FSI HUN. */ Loading @@ -443,120 +385,6 @@ public class NotificationTestHelper { mDefaultInflationFlags, IMPORTANCE_HIGH); } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. */ public ExpandableNotificationRow createShortcutBubble(String shortcutId) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeShortcutBubbleMetadata(shortcutId)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link NotificationEntry} that should be shown as a bubble and is part * of a group of notifications. */ public NotificationEntry createBubbleEntryInGroup() throws Exception { Notification n = createNotification(false /* isGroupSummary */, GROUP_KEY /* groupKey */, makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */)); n.flags |= FLAG_BUBBLE; NotificationEntry entry = generateEntry(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(entry) .setCanBubble(true) .build(); return entry; } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble and is part * of a group of notifications. */ public ExpandableNotificationRow createBubbleInGroup() throws Exception { Notification n = createNotification(false /* isGroupSummary */, GROUP_KEY /* groupKey */, makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link NotificationEntry} that should be shown as a bubble. * * @param deleteIntent the intent to assign to {@link BubbleMetadata#deleteIntent} */ public NotificationEntry createBubble(@Nullable PendingIntent deleteIntent) { return createBubble(makeBubbleMetadata(deleteIntent, false /* autoExpand */), USER_HANDLE); } /** * Returns an {@link NotificationEntry} that should be shown as a bubble. * * @param handle the user to associate with this bubble. */ public NotificationEntry createBubble(UserHandle handle) { return createBubble(makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */), handle); } /** * Returns an {@link NotificationEntry} that should be shown as a auto-expanded bubble. */ public NotificationEntry createAutoExpandedBubble() { return createBubble(makeBubbleMetadata(null /* deleteIntent */, true /* autoExpand */), USER_HANDLE); } /** * Returns an {@link NotificationEntry} that should be shown as a bubble. * * @param userHandle the user to associate with this notification. */ private NotificationEntry createBubble(BubbleMetadata metadata, UserHandle userHandle) { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, metadata); n.flags |= FLAG_BUBBLE; final NotificationChannel channel = new NotificationChannel( n.getChannelId(), n.getChannelId(), IMPORTANCE_HIGH); channel.setBlockable(true); NotificationEntry entry = new NotificationEntryBuilder() .setPkg(PKG) .setOpPkg(PKG) .setId(mId++) .setUid(UID) .setInitialPid(2000) .setNotification(n) .setUser(userHandle) .setPostTime(System.currentTimeMillis()) .setChannel(channel) .build(); modifyRanking(entry) .setCanBubble(true) .build(); return entry; } /** * Creates a notification row with the given details. * Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/ColorizedFgsCoordinatorTest.kt +5 −5 Original line number Diff line number Diff line Loading @@ -204,7 +204,7 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { collectLastValue(promotedNotificationsInteractor.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|screenRecord|0") .containsExactly(screenRecordEntry.key) .inOrder() // THEN the entry is in the fgs section Loading Loading @@ -233,7 +233,7 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { collectLastValue(promotedNotificationsInteractor.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|screenRecord|0") .containsExactly(screenRecordEntry.key) .inOrder() // THEN the entry is NOT in the fgs section Loading Loading @@ -262,7 +262,7 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { collectLastValue(promotedNotificationsInteractor.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|screenRecord|0") .containsExactly(screenRecordEntry.key) .inOrder() // THEN the entry is NOT in the fgs section Loading Loading @@ -322,8 +322,8 @@ class ColorizedFgsCoordinatorTest : SysuiTestCase() { // THEN the order of the notification keys should be the call then the RON assertThat(orderedChipNotificationKeys) .containsExactly( "0|com.android.systemui.tests|0|call|0", "0|com.android.systemui.tests|0|ron|0", callEntry.key, ronEntry.key, ) // VERIFY that the comparator puts the call before the ron Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/PromotedNotificationsInteractorTest.kt +17 −20 Original line number Diff line number Diff line Loading @@ -85,8 +85,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) // THEN the call shouldn't be in the list assertThat(orderedChipNotificationKeys).containsExactly( "0|com.android.systemui.tests|0|ron|0") assertThat(orderedChipNotificationKeys).containsExactly(ronEntry.key) } @Test Loading @@ -107,8 +106,8 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { // THEN the order of the notification keys should be the call then the RON assertThat(orderedChipNotificationKeys) .containsExactly( "0|com.android.systemui.tests|0|call|0", "0|com.android.systemui.tests|0|ron|0", callEntry.key, ronEntry.key, ) .inOrder() } Loading Loading @@ -163,7 +162,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|record|0") .containsExactly(screenRecordEntry.key) .inOrder() } Loading @@ -186,7 +185,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|record|0") .containsExactly(screenRecordEntry.key) .inOrder() } Loading @@ -209,7 +208,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|record|0") .containsExactly(screenRecordEntry.key) .inOrder() } Loading Loading @@ -258,7 +257,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|recordFgs|0") .containsExactly(fgsEntry.key) .inOrder() } Loading @@ -285,7 +284,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|recordOngoing|0") .containsExactly(ongoingEntry.key) .inOrder() } Loading Loading @@ -321,7 +320,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|recordBoth|0") .containsExactly(ongoingAndFgsEntry.key) .inOrder() } Loading Loading @@ -385,7 +384,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|proj|0") .containsExactly(mediaProjEntry.key) .inOrder() } Loading @@ -409,7 +408,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|proj|0") .containsExactly(mediaProjEntry.key) .inOrder() } Loading @@ -433,7 +432,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|proj|0") .containsExactly(mediaProjEntry.key) .inOrder() } Loading Loading @@ -484,7 +483,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|projFgs|0") .containsExactly(fgsEntry.key) .inOrder() } Loading Loading @@ -512,7 +511,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|projOngoing|0") .containsExactly(ongoingEntry.key) .inOrder() } Loading Loading @@ -549,7 +548,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.orderedChipNotificationKeys) assertThat(orderedChipNotificationKeys) .containsExactly("0|com.android.systemui.tests|0|projBoth|0") .containsExactly(ongoingAndFgsEntry.key) .inOrder() } Loading Loading @@ -667,8 +666,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.aodPromotedNotification) // THEN the ron is first because the call has no content assertThat(topPromotedNotificationContent?.key) .isEqualTo("0|com.android.systemui.tests|0|ron|0") assertThat(topPromotedNotificationContent?.key).isEqualTo(ronEntry.key) } @Test Loading @@ -687,8 +685,7 @@ class PromotedNotificationsInteractorTest : SysuiTestCase() { collectLastValue(underTest.aodPromotedNotification) // THEN the call is the top notification assertThat(topPromotedNotificationContent?.key) .isEqualTo("0|com.android.systemui.tests|0|call|0") assertThat(topPromotedNotificationContent?.key).isEqualTo(callEntry.key) } @Test Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java +0 −172 Original line number Diff line number Diff line Loading @@ -346,47 +346,6 @@ public class NotificationTestHelper { return generateRow(createNotification(), PKG, UID, USER_HANDLE, extraInflationFlags); } /** * Returns an {@link GroupEntry} group with the given number of child * notifications. */ public GroupEntry createGroupEntry(int numChildren, @Nullable List<NotificationEntry> additionalChildren) { Notification summary = new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroupSummary(true) .setGroup(GROUP_KEY) .build(); NotificationEntry summaryEntry = new NotificationEntryBuilder() .setPkg(PKG) .setOpPkg(PKG) .setId(mId++) .setUid(UID) .setInitialPid(2000) .setNotification(summary) .setUser(USER_HANDLE) .setParent(GroupEntry.ROOT_ENTRY) .build(); GroupEntryBuilder groupEntry = new GroupEntryBuilder() .setSummary(summaryEntry); for (int i = 0; i < numChildren; i++) { NotificationEntry child = new NotificationEntryBuilder() .setParent(GroupEntry.ROOT_ENTRY) .setNotification(new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroup(GROUP_KEY) .build()) .build(); groupEntry.addChild(child); } for (NotificationEntry entry : additionalChildren) { groupEntry.addChild(entry); } return groupEntry.build(); } /** * Returns an {@link ExpandableNotificationRow} group with the given number of child * notifications. Loading @@ -413,23 +372,6 @@ public class NotificationTestHelper { return createRow(PKG, UID, USER_HANDLE, false /* isGroupSummary */, groupkey); } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. */ public ExpandableNotificationRow createBubble() throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link ExpandableNotificationRow} that shows as a sticky FSI HUN. */ Loading @@ -443,120 +385,6 @@ public class NotificationTestHelper { mDefaultInflationFlags, IMPORTANCE_HIGH); } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. */ public ExpandableNotificationRow createShortcutBubble(String shortcutId) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeShortcutBubbleMetadata(shortcutId)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link NotificationEntry} that should be shown as a bubble and is part * of a group of notifications. */ public NotificationEntry createBubbleEntryInGroup() throws Exception { Notification n = createNotification(false /* isGroupSummary */, GROUP_KEY /* groupKey */, makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */)); n.flags |= FLAG_BUBBLE; NotificationEntry entry = generateEntry(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(entry) .setCanBubble(true) .build(); return entry; } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble and is part * of a group of notifications. */ public ExpandableNotificationRow createBubbleInGroup() throws Exception { Notification n = createNotification(false /* isGroupSummary */, GROUP_KEY /* groupKey */, makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, mDefaultInflationFlags, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link NotificationEntry} that should be shown as a bubble. * * @param deleteIntent the intent to assign to {@link BubbleMetadata#deleteIntent} */ public NotificationEntry createBubble(@Nullable PendingIntent deleteIntent) { return createBubble(makeBubbleMetadata(deleteIntent, false /* autoExpand */), USER_HANDLE); } /** * Returns an {@link NotificationEntry} that should be shown as a bubble. * * @param handle the user to associate with this bubble. */ public NotificationEntry createBubble(UserHandle handle) { return createBubble(makeBubbleMetadata(null /* deleteIntent */, false /* autoExpand */), handle); } /** * Returns an {@link NotificationEntry} that should be shown as a auto-expanded bubble. */ public NotificationEntry createAutoExpandedBubble() { return createBubble(makeBubbleMetadata(null /* deleteIntent */, true /* autoExpand */), USER_HANDLE); } /** * Returns an {@link NotificationEntry} that should be shown as a bubble. * * @param userHandle the user to associate with this notification. */ private NotificationEntry createBubble(BubbleMetadata metadata, UserHandle userHandle) { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, metadata); n.flags |= FLAG_BUBBLE; final NotificationChannel channel = new NotificationChannel( n.getChannelId(), n.getChannelId(), IMPORTANCE_HIGH); channel.setBlockable(true); NotificationEntry entry = new NotificationEntryBuilder() .setPkg(PKG) .setOpPkg(PKG) .setId(mId++) .setUid(UID) .setInitialPid(2000) .setNotification(n) .setUser(userHandle) .setPostTime(System.currentTimeMillis()) .setChannel(channel) .build(); modifyRanking(entry) .setCanBubble(true) .build(); return entry; } /** * Creates a notification row with the given details. * Loading