Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddae9c92 authored by Sergey Serokurov's avatar Sergey Serokurov Committed by Android (Google) Code Review
Browse files

Merge "Do not show overflow after the last bubble dismissed (revised)"

parents 94eebb4a 97aa9b0e
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -562,18 +562,11 @@ 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;
        }
        }
        if (indexToRemove < mBubbles.size() - 1) {
            // Removing anything but the last bubble means positions will change.
            mStateChange.orderChanged = true;
+2 −2
Original line number Diff line number Diff line
@@ -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
+5 −7
Original line number Diff line number Diff line
@@ -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
+8 −7
Original line number Diff line number Diff line
@@ -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