diff options
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java | 12 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java | 38 |
2 files changed, 44 insertions, 6 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java index 603a9ec6bedb..b82496e45415 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java @@ -1327,7 +1327,11 @@ public class BubbleController implements ConfigurationChangeListener, /** Promote the provided bubble from the overflow view. */ public void promoteBubbleFromOverflow(Bubble bubble) { - mLogger.log(bubble, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_BACK_TO_STACK); + 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; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java index 856333ea724e..aad8b4ba1191 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -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); |