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

Commit 88e64b4b authored by Mady Mellor's avatar Mady Mellor
Browse files

Switch app bubble overflow removals to a dismiss / cancel

Treating a removal like a cancel is essentially the same as what
was being done before & minimizes the number of paths that are
used here.

Test: atest BubblesTest#testShowOrHideAppBubble_addsFromOverflow
Bug: 334175587
Change-Id: Ic664739b02857893cd37bfcdc6cf1050cbec8132
parent 80f02617
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1401,7 +1401,7 @@ public class BubbleController implements ConfigurationChangeListener,
            Bubble b = mBubbleData.getOverflowBubbleWithKey(appBubbleKey);
            if (b != null) {
                // It's in the overflow, so remove it & reinflate
                mBubbleData.removeOverflowBubble(b);
                mBubbleData.dismissBubbleWithKey(appBubbleKey, Bubbles.DISMISS_NOTIF_CANCEL);
            } else {
                // App bubble does not exist, lets add and expand it
                b = Bubble.createAppBubble(intent, user, icon, mMainExecutor);
+0 −13
Original line number Diff line number Diff line
@@ -496,19 +496,6 @@ public class BubbleData {
        dispatchPendingChanges();
    }

    /**
     * Explicitly removes a bubble from the overflow, if it exists.
     *
     * @param bubble the bubble to remove.
     */
    public void removeOverflowBubble(Bubble bubble) {
        if (bubble == null) return;
        if (mOverflowBubbles.remove(bubble)) {
            mStateChange.removedOverflowBubble = bubble;
            dispatchPendingChanges();
        }
    }

    /**
     * Adds a group key indicating that the summary for this group should be suppressed.
     *
+0 −17
Original line number Diff line number Diff line
@@ -1192,23 +1192,6 @@ public class BubbleDataTest extends ShellTestCase {
        assertThat(mBubbleData.getBubbleInStackWithKey(appBubbleKey)).isNull();
    }

    @Test
    public void test_removeOverflowBubble() {
        sendUpdatedEntryAtTime(mEntryA1, 2000);
        mBubbleData.setListener(mListener);

        mBubbleData.dismissBubbleWithKey(mEntryA1.getKey(), Bubbles.DISMISS_USER_GESTURE);
        verifyUpdateReceived();
        assertOverflowChangedTo(ImmutableList.of(mBubbleA1));

        mBubbleData.removeOverflowBubble(mBubbleA1);
        verifyUpdateReceived();

        BubbleData.Update update = mUpdateCaptor.getValue();
        assertThat(update.removedOverflowBubble).isEqualTo(mBubbleA1);
        assertOverflowChangedTo(ImmutableList.of());
    }

    @Test
    public void test_getInitialStateForBubbleBar_includesInitialBubblesAndPosition() {
        sendUpdatedEntryAtTime(mEntryA1, 1000);