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

Commit 89274b49 authored by Lyn Han's avatar Lyn Han
Browse files

Auto-expand overflow bubbles on promote

Fixes: 151766943
Test: manual - promoted bubble auto-expands
Test: atest BubbleControllerTest

Change-Id: I1b2dff17f1853ce9a3fa04bb09f2152a9eb4d578
parent 587562b2
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ public class BubbleData {
                b -> {
                    notificationEntryUpdated(bubble, /* suppressFlyout */
                            false, /* showInShade */ true);
                    setSelectedBubbleInternal(bubble);
                    setSelectedBubble(bubble);
                },
                mContext, stack, factory);
        dispatchPendingChanges();
@@ -760,6 +760,17 @@ public class BubbleData {
        return null;
    }

    @VisibleForTesting(visibility = PRIVATE)
    Bubble getOverflowBubbleWithKey(String key) {
        for (int i = 0; i < mOverflowBubbles.size(); i++) {
            Bubble bubble = mOverflowBubbles.get(i);
            if (bubble.getKey().equals(key)) {
                return bubble;
            }
        }
        return null;
    }

    @VisibleForTesting(visibility = PRIVATE)
    void setTimeSource(TimeSource timeSource) {
        mTimeSource = timeSource;
+19 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.FloatingContentCoordinator;
import com.android.systemui.util.InjectionInflationController;

import com.google.common.collect.ImmutableList;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -317,6 +319,23 @@ public class BubbleControllerTest extends SysuiTestCase {
        assertFalse(mSysUiStateBubblesExpanded);
    }

    @Test
    public void testPromoteBubble_autoExpand() {
        mBubbleController.updateBubble(mRow2.getEntry());
        mBubbleController.updateBubble(mRow.getEntry());
        mBubbleController.removeBubble(
                mRow.getEntry(), BubbleController.DISMISS_USER_GESTURE);

        Bubble b = mBubbleData.getOverflowBubbleWithKey(mRow.getEntry().getKey());
        assertThat(mBubbleData.getOverflowBubbles()).isEqualTo(ImmutableList.of(b));

        Bubble b2 = mBubbleData.getBubbleWithKey(mRow2.getEntry().getKey());
        assertThat(mBubbleData.getSelectedBubble()).isEqualTo(b2);

        mBubbleController.promoteBubbleFromOverflow(b);
        assertThat(mBubbleData.getSelectedBubble()).isEqualTo(b);
    }

    @Test
    public void testRemoveBubble_withDismissedNotif() {
        mEntryListener.onPendingEntryAdded(mRow.getEntry());