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

Commit aea895f0 authored by Mady Mellor's avatar Mady Mellor
Browse files

Fix the dot, yet again

The showDot logic should basically follow the showInShade logic, they
only differ due to DND rules. Whenever I added the showDot stuff I missed
this bit in following the showInShade logic.

Added some tests for it too.

Test: atest BubbleControllerTest
Bug: 137213469
Change-Id: I5aa56ca8c08d5e1bdefc2e39d00bd08616b42091
parent d3388d71
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -190,8 +190,9 @@ public class BubbleData {
        } else if (mSelectedBubble == null) {
            setSelectedBubbleInternal(bubble);
        }
        bubble.setShowInShadeWhenBubble(!mExpanded || mSelectedBubble != bubble);
        bubble.setShowBubbleDot(true);
        boolean isBubbleExpandedAndSelected = mExpanded && mSelectedBubble == bubble;
        bubble.setShowInShadeWhenBubble(!isBubbleExpandedAndSelected);
        bubble.setShowBubbleDot(!isBubbleExpandedAndSelected);
        dispatchPendingChanges();
    }

+37 −1
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ public class BubbleControllerTest extends SysuiTestCase {
    }

    @Test
    public void testExpansionRemovesShowInShade() {
    public void testExpansionRemovesShowInShadeAndDot() {
        // Mark it as a bubble and add it explicitly
        mEntryListener.onPendingEntryAdded(mRow.getEntry());
        mBubbleController.updateBubble(mRow.getEntry());
@@ -331,6 +331,7 @@ public class BubbleControllerTest extends SysuiTestCase {
        // We should have bubbles & their notifs should not be suppressed
        assertTrue(mBubbleController.hasBubbles());
        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());

        // Expand
        BubbleStackView stackView = mBubbleController.getStackView();
@@ -340,6 +341,40 @@ public class BubbleControllerTest extends SysuiTestCase {

        // Notif is suppressed after expansion
        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
        // Notif shouldn't show dot after expansion
        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
    }

    @Test
    public void testUpdateWhileExpanded_DoesntChangeShowInShadeAndDot() {
        // Mark it as a bubble and add it explicitly
        mEntryListener.onPendingEntryAdded(mRow.getEntry());
        mBubbleController.updateBubble(mRow.getEntry());

        // We should have bubbles & their notifs should not be suppressed
        assertTrue(mBubbleController.hasBubbles());
        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());

        // Expand
        BubbleStackView stackView = mBubbleController.getStackView();
        mBubbleController.expandStack();
        assertTrue(mBubbleController.isStackExpanded());
        verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().key);

        // Notif is suppressed after expansion
        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
        // Notif shouldn't show dot after expansion
        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());

        // Send update
        mEntryListener.onPreEntryUpdated(mRow.getEntry());

        // Nothing should have changed
        // Notif is suppressed after expansion
        assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
        // Notif shouldn't show dot after expansion
        assertFalse(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
    }

    @Test
@@ -466,6 +501,7 @@ public class BubbleControllerTest extends SysuiTestCase {
    public void testMarkNewNotificationAsShowInShade() {
        mEntryListener.onPendingEntryAdded(mRow.getEntry());
        assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(mRow.getEntry().key));
        assertTrue(mBubbleData.getBubbleWithKey(mRow.getEntry().key).showBubbleDot());
    }

    @Test