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

Commit 330bb37f authored by Ats Jenk's avatar Ats Jenk
Browse files

Log when bubble is moved to overflow

Log when there are too many bubbles in the bubble bar and the oldest
bubble gets moved to overflow.

Bug: 349845968
Test: atest com.android.wm.shell.bubbles.BubbleDataTest
Test: manual, trigger multiple bubbles until there are too many, check
  that when oldest bubble moves to overflow, event is logged
Flag: com.android.wm.shell.enable_bubble_bar
Change-Id: Ib6f2f9a48772c0571291c80ab301b2ddc9b95c00
parent 92901b7c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -885,7 +885,7 @@ public class BubbleData {
            return;
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "overflowBubble=%s", bubble.getKey());
        mLogger.logOverflowAdd(bubble, reason);
        mLogger.logOverflowAdd(bubble, mPositioner.isShowingInBubbleBar(), reason);
        if (mOverflowBubbles.isEmpty()) {
            mStateChange.showOverflowChanged = true;
        }
+13 −7
Original line number Diff line number Diff line
@@ -203,7 +203,12 @@ public class BubbleLogger {
     * @param b Bubble added to overflow
     * @param r Reason that bubble was added to overflow
     */
    public void logOverflowAdd(Bubble b, @Bubbles.DismissReason int r) {
    public void logOverflowAdd(Bubble b, boolean bubbleBar, @Bubbles.DismissReason int r) {
        if (bubbleBar) {
            if (r == Bubbles.DISMISS_AGED) {
                log(b, Event.BUBBLE_BAR_OVERFLOW_ADD_AGED);
            }
        } else {
            if (r == Bubbles.DISMISS_AGED) {
                log(b, Event.BUBBLE_OVERFLOW_ADD_AGED);
            } else if (r == Bubbles.DISMISS_USER_GESTURE) {
@@ -212,6 +217,7 @@ public class BubbleLogger {
                log(b, Event.BUBBLE_OVERFLOW_RECOVER);
            }
        }
    }

    void logStackUiChanged(String packageName, int action, int bubbleCount, float normalX,
            float normalY) {
+24 −0
Original line number Diff line number Diff line
@@ -350,6 +350,30 @@ public class BubbleDataTest extends ShellTestCase {
                BubbleLogger.Event.BUBBLE_BAR_BUBBLE_REMOVED_BLOCKED.getId());
    }

    @Test
    public void testRemoveBubbleFromBubbleBar_addToOverflow_logEvent() {
        mPositioner.setShowingInBubbleBar(true);

        sendUpdatedEntryAtTime(mEntryA1, 1000);
        mBubbleData.setListener(mListener);

        mBubbleData.dismissBubbleWithKey(mEntryA1.getKey(), Bubbles.DISMISS_AGED);
        assertThat(mUiEventLogger.numLogs()).isEqualTo(1);
        assertThat(mUiEventLogger.eventId(0)).isEqualTo(
                BubbleLogger.Event.BUBBLE_BAR_OVERFLOW_ADD_AGED.getId());
    }

    @Test
    public void testRemoveBubble_notifCancelled_noLog() {
        mPositioner.setShowingInBubbleBar(false);

        sendUpdatedEntryAtTime(mEntryA1, 1000);
        mBubbleData.setListener(mListener);

        mBubbleData.dismissBubbleWithKey(mEntryA1.getKey(), Bubbles.DISMISS_BLOCKED);
        assertThat(mUiEventLogger.numLogs()).isEqualTo(0);
    }

    @Test
    public void ifSuppress_hideFlyout() {
        // Setup