Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +8 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,14 @@ public class BubbleData { Bubble getOrCreateBubble(NotificationEntry entry) { Bubble bubble = getBubbleWithKey(entry.getKey()); if (bubble == null) { for (int i = 0; i < mOverflowBubbles.size(); i++) { Bubble b = mOverflowBubbles.get(i); if (b.getKey().equals(entry.getKey())) { mOverflowBubbles.remove(b); mPendingBubbles.add(b); return b; } } // Check for it in pending for (int i = 0; i < mPendingBubbles.size(); i++) { Bubble b = mPendingBubbles.get(i); Loading packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java +14 −4 Original line number Diff line number Diff line Loading @@ -268,13 +268,18 @@ public class BubbleDataTest extends SysuiTestCase { sendUpdatedEntryAtTime(mEntryB2, 5000); mBubbleData.setListener(mListener); // Test sendUpdatedEntryAtTime(mEntryC1, 6000); verifyUpdateReceived(); // Verify assertBubbleRemoved(mBubbleA1, BubbleController.DISMISS_AGED); assertThat(mBubbleData.getOverflowBubbles()).isEqualTo(ImmutableList.of(mBubbleA1)); assertOverflowChangedTo(ImmutableList.of(mBubbleA1)); Bubble bubbleA1 = mBubbleData.getOrCreateBubble(mEntryA1); bubbleA1.markUpdatedAt(7000L); mBubbleData.notificationEntryUpdated(bubbleA1, false /* suppressFlyout*/, true /* showInShade */); verifyUpdateReceived(); assertBubbleRemoved(mBubbleA2, BubbleController.DISMISS_AGED); assertOverflowChangedTo(ImmutableList.of(mBubbleA2)); } /** Loading Loading @@ -931,6 +936,11 @@ public class BubbleDataTest extends SysuiTestCase { assertThat(update.expanded).named("expanded").isEqualTo(expected); } private void assertOverflowChangedTo(ImmutableList<Bubble> bubbles) { BubbleData.Update update = mUpdateCaptor.getValue(); assertThat(update.overflowBubbles).isEqualTo(bubbles); } private NotificationEntry createBubbleEntry(int userId, String notifKey, String packageName) { return createBubbleEntry(userId, notifKey, packageName, 1000); Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +8 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,14 @@ public class BubbleData { Bubble getOrCreateBubble(NotificationEntry entry) { Bubble bubble = getBubbleWithKey(entry.getKey()); if (bubble == null) { for (int i = 0; i < mOverflowBubbles.size(); i++) { Bubble b = mOverflowBubbles.get(i); if (b.getKey().equals(entry.getKey())) { mOverflowBubbles.remove(b); mPendingBubbles.add(b); return b; } } // Check for it in pending for (int i = 0; i < mPendingBubbles.size(); i++) { Bubble b = mPendingBubbles.get(i); Loading
packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java +14 −4 Original line number Diff line number Diff line Loading @@ -268,13 +268,18 @@ public class BubbleDataTest extends SysuiTestCase { sendUpdatedEntryAtTime(mEntryB2, 5000); mBubbleData.setListener(mListener); // Test sendUpdatedEntryAtTime(mEntryC1, 6000); verifyUpdateReceived(); // Verify assertBubbleRemoved(mBubbleA1, BubbleController.DISMISS_AGED); assertThat(mBubbleData.getOverflowBubbles()).isEqualTo(ImmutableList.of(mBubbleA1)); assertOverflowChangedTo(ImmutableList.of(mBubbleA1)); Bubble bubbleA1 = mBubbleData.getOrCreateBubble(mEntryA1); bubbleA1.markUpdatedAt(7000L); mBubbleData.notificationEntryUpdated(bubbleA1, false /* suppressFlyout*/, true /* showInShade */); verifyUpdateReceived(); assertBubbleRemoved(mBubbleA2, BubbleController.DISMISS_AGED); assertOverflowChangedTo(ImmutableList.of(mBubbleA2)); } /** Loading Loading @@ -931,6 +936,11 @@ public class BubbleDataTest extends SysuiTestCase { assertThat(update.expanded).named("expanded").isEqualTo(expected); } private void assertOverflowChangedTo(ImmutableList<Bubble> bubbles) { BubbleData.Update update = mUpdateCaptor.getValue(); assertThat(update.overflowBubbles).isEqualTo(bubbles); } private NotificationEntry createBubbleEntry(int userId, String notifKey, String packageName) { return createBubbleEntry(userId, notifKey, packageName, 1000); Loading