diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java | 13 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java | 19 |
2 files changed, 31 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java index 8bc35f4058e9..2bd15188b7d3 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java @@ -208,7 +208,7 @@ public class BubbleData { b -> { notificationEntryUpdated(bubble, /* suppressFlyout */ false, /* showInShade */ true); - setSelectedBubbleInternal(bubble); + setSelectedBubble(bubble); }, mContext, stack, factory); dispatchPendingChanges(); @@ -761,6 +761,17 @@ public class BubbleData { } @VisibleForTesting(visibility = PRIVATE) + Bubble getOverflowBubbleWithKey(String key) { + for (int i = 0; i < mOverflowBubbles.size(); i++) { + Bubble bubble = mOverflowBubbles.get(i); + if (bubble.getKey().equals(key)) { + return bubble; + } + } + return null; + } + + @VisibleForTesting(visibility = PRIVATE) void setTimeSource(TimeSource timeSource) { mTimeSource = timeSource; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java index 4f16031741bc..6f3fbb9cbd2c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java @@ -92,6 +92,8 @@ import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.util.FloatingContentCoordinator; import com.android.systemui.util.InjectionInflationController; +import com.google.common.collect.ImmutableList; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -318,6 +320,23 @@ public class BubbleControllerTest extends SysuiTestCase { } @Test + public void testPromoteBubble_autoExpand() { + mBubbleController.updateBubble(mRow2.getEntry()); + mBubbleController.updateBubble(mRow.getEntry()); + mBubbleController.removeBubble( + mRow.getEntry(), BubbleController.DISMISS_USER_GESTURE); + + Bubble b = mBubbleData.getOverflowBubbleWithKey(mRow.getEntry().getKey()); + assertThat(mBubbleData.getOverflowBubbles()).isEqualTo(ImmutableList.of(b)); + + Bubble b2 = mBubbleData.getBubbleWithKey(mRow2.getEntry().getKey()); + assertThat(mBubbleData.getSelectedBubble()).isEqualTo(b2); + + mBubbleController.promoteBubbleFromOverflow(b); + assertThat(mBubbleData.getSelectedBubble()).isEqualTo(b); + } + + @Test public void testRemoveBubble_withDismissedNotif() { mEntryListener.onPendingEntryAdded(mRow.getEntry()); mBubbleController.updateBubble(mRow.getEntry()); |