Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +4 −1 Original line number Diff line number Diff line Loading @@ -1246,9 +1246,12 @@ public class BubbleController implements ConfigurationChangeListener, */ public void dragBubbleToDismiss(String bubbleKey, long timestamp) { String selectedBubbleKey = mBubbleData.getSelectedBubbleKey(); if (mBubbleData.hasAnyBubbleWithKey(bubbleKey)) { Bubble bubbleToDismiss = mBubbleData.getAnyBubbleWithkey(bubbleKey); if (bubbleToDismiss != null) { mBubbleData.dismissBubbleWithKey( bubbleKey, Bubbles.DISMISS_USER_GESTURE_FROM_LAUNCHER, timestamp); mLogger.log(bubbleToDismiss, BubbleLogger.Event.BUBBLE_BAR_BUBBLE_DISMISSED_DRAG_BUBBLE); } if (mBubbleData.hasBubbles()) { // We still have bubbles, if we dragged an individual bubble to dismiss we were expanded Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +23 −3 Original line number Diff line number Diff line Loading @@ -198,6 +198,8 @@ import com.android.wm.shell.taskview.TaskView; import com.android.wm.shell.taskview.TaskViewTransitions; import com.android.wm.shell.transition.Transitions; import kotlin.Lazy; import org.junit.After; import org.junit.Before; import org.junit.Test; Loading @@ -216,7 +218,6 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.Executor; import kotlin.Lazy; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; Loading Loading @@ -2481,7 +2482,7 @@ public class BubblesTest extends SysuiTestCase { mEntryListener.onEntryAdded(mRow); verify(mBubbleLogger).log(argThat(b -> b.getKey().equals(mRow.getKey())), verify(mBubbleLogger).log(eqBubbleWithKey(mRow.getKey()), eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_POSTED)); } Loading @@ -2498,10 +2499,25 @@ public class BubblesTest extends SysuiTestCase { NotificationEntryHelper.modifyRanking(mRow).setTextChanged(true).build(); mEntryListener.onEntryUpdated(mRow, /* fromSystem= */ true); verify(mBubbleLogger).log(argThat(b -> b.getKey().equals(mRow.getKey())), verify(mBubbleLogger).log(eqBubbleWithKey(mRow.getKey()), eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_UPDATED)); } @EnableFlags(FLAG_ENABLE_BUBBLE_BAR) @Test public void testEventLogging_bubbleBar_dragBubbleToDismiss() { mBubbleProperties.mIsBubbleBarEnabled = true; mPositioner.setIsLargeScreen(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mEntryListener.onEntryAdded(mRow); mBubbleController.dragBubbleToDismiss(mRow.getKey(), 1L); verify(mBubbleLogger).log(eqBubbleWithKey(mRow.getKey()), eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_DISMISSED_DRAG_BUBBLE)); } /** Creates a bubble using the userId and package. */ private Bubble createBubble(int userId, String pkg) { final UserHandle userHandle = new UserHandle(userId); Loading Loading @@ -2687,6 +2703,10 @@ public class BubblesTest extends SysuiTestCase { assertThat(mSysUiStateBubblesManageMenuExpanded).isEqualTo(manageMenuExpanded); } private Bubble eqBubbleWithKey(String key) { return argThat(b -> b.getKey().equals(key)); } private static class FakeBubbleStateListener implements Bubbles.BubbleStateListener { int mStateChangeCalls = 0; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +4 −1 Original line number Diff line number Diff line Loading @@ -1246,9 +1246,12 @@ public class BubbleController implements ConfigurationChangeListener, */ public void dragBubbleToDismiss(String bubbleKey, long timestamp) { String selectedBubbleKey = mBubbleData.getSelectedBubbleKey(); if (mBubbleData.hasAnyBubbleWithKey(bubbleKey)) { Bubble bubbleToDismiss = mBubbleData.getAnyBubbleWithkey(bubbleKey); if (bubbleToDismiss != null) { mBubbleData.dismissBubbleWithKey( bubbleKey, Bubbles.DISMISS_USER_GESTURE_FROM_LAUNCHER, timestamp); mLogger.log(bubbleToDismiss, BubbleLogger.Event.BUBBLE_BAR_BUBBLE_DISMISSED_DRAG_BUBBLE); } if (mBubbleData.hasBubbles()) { // We still have bubbles, if we dragged an individual bubble to dismiss we were expanded Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +23 −3 Original line number Diff line number Diff line Loading @@ -198,6 +198,8 @@ import com.android.wm.shell.taskview.TaskView; import com.android.wm.shell.taskview.TaskViewTransitions; import com.android.wm.shell.transition.Transitions; import kotlin.Lazy; import org.junit.After; import org.junit.Before; import org.junit.Test; Loading @@ -216,7 +218,6 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.Executor; import kotlin.Lazy; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; Loading Loading @@ -2481,7 +2482,7 @@ public class BubblesTest extends SysuiTestCase { mEntryListener.onEntryAdded(mRow); verify(mBubbleLogger).log(argThat(b -> b.getKey().equals(mRow.getKey())), verify(mBubbleLogger).log(eqBubbleWithKey(mRow.getKey()), eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_POSTED)); } Loading @@ -2498,10 +2499,25 @@ public class BubblesTest extends SysuiTestCase { NotificationEntryHelper.modifyRanking(mRow).setTextChanged(true).build(); mEntryListener.onEntryUpdated(mRow, /* fromSystem= */ true); verify(mBubbleLogger).log(argThat(b -> b.getKey().equals(mRow.getKey())), verify(mBubbleLogger).log(eqBubbleWithKey(mRow.getKey()), eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_UPDATED)); } @EnableFlags(FLAG_ENABLE_BUBBLE_BAR) @Test public void testEventLogging_bubbleBar_dragBubbleToDismiss() { mBubbleProperties.mIsBubbleBarEnabled = true; mPositioner.setIsLargeScreen(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mEntryListener.onEntryAdded(mRow); mBubbleController.dragBubbleToDismiss(mRow.getKey(), 1L); verify(mBubbleLogger).log(eqBubbleWithKey(mRow.getKey()), eq(BubbleLogger.Event.BUBBLE_BAR_BUBBLE_DISMISSED_DRAG_BUBBLE)); } /** Creates a bubble using the userId and package. */ private Bubble createBubble(int userId, String pkg) { final UserHandle userHandle = new UserHandle(userId); Loading Loading @@ -2687,6 +2703,10 @@ public class BubblesTest extends SysuiTestCase { assertThat(mSysUiStateBubblesManageMenuExpanded).isEqualTo(manageMenuExpanded); } private Bubble eqBubbleWithKey(String key) { return argThat(b -> b.getKey().equals(key)); } private static class FakeBubbleStateListener implements Bubbles.BubbleStateListener { int mStateChangeCalls = 0; Loading