diff options
| author | 2021-12-14 17:00:20 +0000 | |
|---|---|---|
| committer | 2021-12-14 17:00:20 +0000 | |
| commit | ddae9c92a22d8ad9f411013fe5a9f27fc32cfdef (patch) | |
| tree | 7795b554b00f82c754a701e4475b2ad751ce44cb | |
| parent | 94eebb4ab7d3aecdcf3632b7928b31ddbea2a883 (diff) | |
| parent | 97aa9b0ec1f84878d11a5d7128876dba0bbc3d18 (diff) | |
Merge "Do not show overflow after the last bubble dismissed (revised)"
4 files changed, 19 insertions, 27 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java index cd635c10fd8e..51b7eaa8b0e4 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java @@ -562,17 +562,10 @@ public class BubbleData { overflowBubble(reason, bubbleToRemove); if (mBubbles.size() == 1) { - if (hasOverflowBubbles() && (mPositioner.showingInTaskbar() || isExpanded())) { - // No more active bubbles but we have stuff in the overflow -- select that view - // if we're already expanded or always showing. - setShowingOverflow(true); - setSelectedBubbleInternal(mOverflow); - } else { - setExpandedInternal(false); - // Don't use setSelectedBubbleInternal because we don't want to trigger an - // applyUpdate - mSelectedBubble = null; - } + setExpandedInternal(false); + // Don't use setSelectedBubbleInternal because we don't want to trigger an + // applyUpdate + mSelectedBubble = null; } if (indexToRemove < mBubbles.size() - 1) { // Removing anything but the last bubble means positions will change. diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java index 8bc1223cfd64..185479b145af 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java @@ -794,7 +794,7 @@ public class BubbleDataTest extends ShellTestCase { } @Test - public void test_expanded_removeLastBubble_showsOverflowIfNotEmpty() { + public void test_expanded_removeLastBubble_collapsesIfOverflowNotEmpty() { // Setup sendUpdatedEntryAtTime(mEntryA1, 1000); changeExpandedStateAtTime(true, 2000); @@ -804,7 +804,7 @@ public class BubbleDataTest extends ShellTestCase { mBubbleData.dismissBubbleWithKey(mEntryA1.getKey(), Bubbles.DISMISS_USER_GESTURE); verifyUpdateReceived(); assertThat(mBubbleData.getOverflowBubbles().size()).isGreaterThan(0); - assertSelectionChangedTo(mBubbleData.getOverflow()); + assertExpandedChangedTo(false); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java index 71ae5eb028a7..c7943c3ed121 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -116,7 +116,6 @@ import com.android.wm.shell.bubbles.BubbleDataRepository; import com.android.wm.shell.bubbles.BubbleEntry; import com.android.wm.shell.bubbles.BubbleIconFactory; import com.android.wm.shell.bubbles.BubbleLogger; -import com.android.wm.shell.bubbles.BubbleOverflow; import com.android.wm.shell.bubbles.BubbleStackView; import com.android.wm.shell.bubbles.BubbleViewInfoTask; import com.android.wm.shell.bubbles.Bubbles; @@ -631,7 +630,7 @@ public class BubblesTest extends SysuiTestCase { } @Test - public void testRemoveLastExpanded_selectsOverflow() { + public void testRemoveLastExpanded_collapses() { // Mark it as a bubble and add it explicitly mEntryListener.onPendingEntryAdded(mRow); mEntryListener.onPendingEntryAdded(mRow2); @@ -670,11 +669,10 @@ public class BubblesTest extends SysuiTestCase { stackView.getExpandedBubble().getKey()).getKey(), Bubbles.DISMISS_USER_GESTURE); - // Overflow should be selected - assertEquals(mBubbleData.getSelectedBubble().getKey(), BubbleOverflow.KEY); - verify(mBubbleExpandListener).onBubbleExpandChanged(true, BubbleOverflow.KEY); - assertTrue(mBubbleController.hasBubbles()); - assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */); + // We should be collapsed + verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey()); + assertFalse(mBubbleController.hasBubbles()); + assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java index 7b9e6a9efb3b..65c219c1be16 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java @@ -19,8 +19,11 @@ package com.android.systemui.wmshell; import static android.app.Notification.FLAG_BUBBLE; import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; import static android.service.notification.NotificationListenerService.REASON_GROUP_SUMMARY_CANCELED; + import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; + import static com.google.common.truth.Truth.assertThat; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -97,7 +100,6 @@ import com.android.wm.shell.bubbles.BubbleData; import com.android.wm.shell.bubbles.BubbleDataRepository; import com.android.wm.shell.bubbles.BubbleEntry; import com.android.wm.shell.bubbles.BubbleLogger; -import com.android.wm.shell.bubbles.BubbleOverflow; import com.android.wm.shell.bubbles.BubbleStackView; import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.common.DisplayController; @@ -572,7 +574,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { } @Test - public void testRemoveLastExpanded_selectsOverflow() { + public void testRemoveLastExpanded_collapses() { // Mark it as a bubble and add it explicitly mEntryListener.onEntryAdded(mRow); mEntryListener.onEntryAdded(mRow2); @@ -611,11 +613,10 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { stackView.getExpandedBubble().getKey()).getKey(), Bubbles.DISMISS_USER_GESTURE); - // Overflow should be selected - assertEquals(mBubbleData.getSelectedBubble().getKey(), BubbleOverflow.KEY); - verify(mBubbleExpandListener).onBubbleExpandChanged(true, BubbleOverflow.KEY); - assertTrue(mBubbleController.hasBubbles()); - assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */); + // We should be collapsed + verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey()); + assertFalse(mBubbleController.hasBubbles()); + assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */); } @Test |