diff options
3 files changed, 36 insertions, 2 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 a8a8c2a80974..c81ffdabf9b8 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 @@ -1979,11 +1979,15 @@ public class BubbleController implements ConfigurationChangeListener, @Override public void addBubble(Bubble addedBubble) { + // Only log metrics event + mLogger.log(addedBubble, BubbleLogger.Event.BUBBLE_BAR_BUBBLE_POSTED); // Nothing to do for adds, these are handled by launcher / in the bubble bar. } @Override public void updateBubble(Bubble updatedBubble) { + // Only log metrics event + mLogger.log(updatedBubble, BubbleLogger.Event.BUBBLE_BAR_BUBBLE_UPDATED); // Nothing to do for updates, these are handled by launcher / in the bubble bar. } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java index 1abe11998500..6d757d26a9bd 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java @@ -16,7 +16,6 @@ package com.android.wm.shell.bubbles; -import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.internal.util.FrameworkStatsLog; @@ -33,7 +32,6 @@ public class BubbleLogger { /** * Bubble UI event. */ - @VisibleForTesting public enum Event implements UiEventLogger.UiEventEnum { // region bubble events 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 9cfb0bb3900b..5996ef13a463 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -46,6 +46,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doReturn; @@ -2470,6 +2471,37 @@ public class BubblesTest extends SysuiTestCase { verify(stackView, never()).showOverflow(anyBoolean()); } + @EnableFlags(FLAG_ENABLE_BUBBLE_BAR) + @Test + public void testEventLogging_bubbleBar_addBubble() { + mBubbleProperties.mIsBubbleBarEnabled = true; + mPositioner.setIsLargeScreen(true); + FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); + mBubbleController.registerBubbleStateListener(bubbleStateListener); + + mEntryListener.onEntryAdded(mRow); + + verify(mBubbleLogger).log(argThat(b -> b.getKey().equals(mRow.getKey())), + eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_POSTED)); + } + + @EnableFlags(FLAG_ENABLE_BUBBLE_BAR) + @Test + public void testEventLogging_bubbleBar_updateBubble() { + mBubbleProperties.mIsBubbleBarEnabled = true; + mPositioner.setIsLargeScreen(true); + FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); + mBubbleController.registerBubbleStateListener(bubbleStateListener); + + mEntryListener.onEntryAdded(mRow); + // Mark the notification as updated + NotificationEntryHelper.modifyRanking(mRow).setTextChanged(true).build(); + mEntryListener.onEntryUpdated(mRow, /* fromSystem= */ true); + + verify(mBubbleLogger).log(argThat(b -> b.getKey().equals(mRow.getKey())), + eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_UPDATED)); + } + /** Creates a bubble using the userId and package. */ private Bubble createBubble(int userId, String pkg) { final UserHandle userHandle = new UserHandle(userId); |