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

Commit e1db27eb authored by Mady Mellor's avatar Mady Mellor Committed by Automerger Merge Worker
Browse files

Merge "Fix an issue that caused an NPE" into sc-v2-dev am: f1e8bc69

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16011419

Change-Id: I5c61ea1aad18787ad5ce39604d322b41a634ae0a
parents d3b973ce f1e8bc69
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -558,6 +558,8 @@ public class BubbleData {
        }
        }
        Bubble bubbleToRemove = mBubbles.get(indexToRemove);
        Bubble bubbleToRemove = mBubbles.get(indexToRemove);
        bubbleToRemove.stopInflation();
        bubbleToRemove.stopInflation();
        overflowBubble(reason, bubbleToRemove);

        if (mBubbles.size() == 1) {
        if (mBubbles.size() == 1) {
            if (hasOverflowBubbles() && (mPositioner.showingInTaskbar() || isExpanded())) {
            if (hasOverflowBubbles() && (mPositioner.showingInTaskbar() || isExpanded())) {
                // No more active bubbles but we have stuff in the overflow -- select that view
                // No more active bubbles but we have stuff in the overflow -- select that view
@@ -581,8 +583,6 @@ public class BubbleData {
            mStateChange.orderChanged |= repackAll();
            mStateChange.orderChanged |= repackAll();
        }
        }


        overflowBubble(reason, bubbleToRemove);

        // Note: If mBubbles.isEmpty(), then mSelectedBubble is now null.
        // Note: If mBubbles.isEmpty(), then mSelectedBubble is now null.
        if (Objects.equals(mSelectedBubble, bubbleToRemove)) {
        if (Objects.equals(mSelectedBubble, bubbleToRemove)) {
            // Move selection to the new bubble at the same position.
            // Move selection to the new bubble at the same position.
+16 −1
Original line number Original line Diff line number Diff line
@@ -793,7 +793,7 @@ public class BubbleDataTest extends ShellTestCase {
    }
    }


    @Test
    @Test
    public void test_expanded_removeLastBubble_collapsesStack() {
    public void test_expanded_removeLastBubble_showsOverflowIfNotEmpty() {
        // Setup
        // Setup
        sendUpdatedEntryAtTime(mEntryA1, 1000);
        sendUpdatedEntryAtTime(mEntryA1, 1000);
        changeExpandedStateAtTime(true, 2000);
        changeExpandedStateAtTime(true, 2000);
@@ -802,6 +802,21 @@ public class BubbleDataTest extends ShellTestCase {
        // Test
        // Test
        mBubbleData.dismissBubbleWithKey(mEntryA1.getKey(), Bubbles.DISMISS_USER_GESTURE);
        mBubbleData.dismissBubbleWithKey(mEntryA1.getKey(), Bubbles.DISMISS_USER_GESTURE);
        verifyUpdateReceived();
        verifyUpdateReceived();
        assertThat(mBubbleData.getOverflowBubbles().size()).isGreaterThan(0);
        assertSelectionChangedTo(mBubbleData.getOverflow());
    }

    @Test
    public void test_expanded_removeLastBubble_collapsesIfOverflowEmpty() {
        // Setup
        sendUpdatedEntryAtTime(mEntryA1, 1000);
        changeExpandedStateAtTime(true, 2000);
        mBubbleData.setListener(mListener);

        // Test
        mBubbleData.dismissBubbleWithKey(mEntryA1.getKey(), Bubbles.DISMISS_NO_BUBBLE_UP);
        verifyUpdateReceived();
        assertThat(mBubbleData.getOverflowBubbles()).isEmpty();
        assertExpandedChangedTo(false);
        assertExpandedChangedTo(false);
    }
    }