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

Commit 325c39f0 authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge changes Ie31f24ec,I8e0c7493 into main

* changes:
  Log event when bubble is opened from overflow
  Log event when overflow is opened
parents fe25ea1a b2c257f4
Loading
Loading
Loading
Loading
+6 −6
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);
@@ -1350,11 +1354,7 @@ public class BubbleController implements ConfigurationChangeListener,
        if (BubbleOverflow.KEY.equals(key)) {
            mBubbleData.setSelectedBubbleFromLauncher(mBubbleData.getOverflow());
            mLayerView.showExpandedView(mBubbleData.getOverflow());
            if (wasExpanded) {
                mLogger.log(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_SWITCHED);
            } else {
                mLogger.log(BubbleLogger.Event.BUBBLE_BAR_EXPANDED);
            }
            mLogger.log(BubbleLogger.Event.BUBBLE_BAR_OVERFLOW_SELECTED);
            return;
        }

+38 −0
Original line number Diff line number Diff line
@@ -2707,6 +2707,44 @@ public class BubblesTest extends SysuiTestCase {
                eq(BubbleLogger.Event.BUBBLE_BAR_EXPANDED));
    }

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

        mEntryListener.onEntryAdded(mRow);

        clearInvocations(mBubbleLogger);
        mBubbleController.expandStackAndSelectBubbleFromLauncher(BubbleOverflow.KEY, 0);
        verify(mBubbleLogger).log(BubbleLogger.Event.BUBBLE_BAR_OVERFLOW_SELECTED);
        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);