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

Commit b2c257f4 authored by Ats Jenk's avatar Ats Jenk
Browse files

Log event when bubble is opened from overflow

Log when bubble bar bubble is added back to the bar from overflow.

Bug: 349845968
Test: atest BubblesTest
Test: manual, tap on a bubble in overflow, check logged events
Flag: com.android.wm.shell.enable_bubble_bar
Change-Id: Ie31f24ec3fc106bb30c0cf94f8eef6acf19b0e13
parent e6e89993
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1327,7 +1327,11 @@ public class BubbleController implements ConfigurationChangeListener,

    /** Promote the provided bubble from the overflow view. */
    public void promoteBubbleFromOverflow(Bubble bubble) {
        if (isShowingAsBubbleBar()) {
            mLogger.log(bubble, BubbleLogger.Event.BUBBLE_BAR_OVERFLOW_REMOVE_BACK_TO_BAR);
        } else {
            mLogger.log(bubble, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_BACK_TO_STACK);
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "promoteBubbleFromOverflow=%s", bubble.getKey());
        bubble.setInflateSynchronously(mInflateSynchronously);
        bubble.setShouldAutoExpand(true);
+22 −0
Original line number Diff line number Diff line
@@ -2723,6 +2723,28 @@ public class BubblesTest extends SysuiTestCase {
        verifyNoMoreInteractions(mBubbleLogger);
    }

    @EnableFlags(FLAG_ENABLE_BUBBLE_BAR)
    @Test
    public void testEventLogging_bubbleBar_fromOverflowToBar() {
        mBubbleProperties.mIsBubbleBarEnabled = true;
        mPositioner.setIsLargeScreen(true);
        FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener();
        mBubbleController.registerBubbleStateListener(bubbleStateListener);

        mEntryListener.onEntryAdded(mRow);

        // Dismiss the bubble so it's in the overflow
        mBubbleController.removeBubble(
                mRow.getKey(), Bubbles.DISMISS_USER_GESTURE);
        Bubble overflowBubble = mBubbleData.getOverflowBubbleWithKey(mRow.getKey());
        assertThat(overflowBubble).isNotNull();

        // Promote overflow bubble and check that it is logged
        mBubbleController.promoteBubbleFromOverflow(overflowBubble);
        verify(mBubbleLogger).log(eqBubbleWithKey(overflowBubble.getKey()),
                eq(BubbleLogger.Event.BUBBLE_BAR_OVERFLOW_REMOVE_BACK_TO_BAR));
    }

    /** Creates a bubble using the userId and package. */
    private Bubble createBubble(int userId, String pkg) {
        final UserHandle userHandle = new UserHandle(userId);