Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +2 −1 Original line number Diff line number Diff line Loading @@ -1137,7 +1137,8 @@ public class BubbleController { if (reason == DISMISS_USER_CHANGED || reason == DISMISS_NO_BUBBLE_UP) { continue; } if (reason == DISMISS_NOTIF_CANCEL) { if (reason == DISMISS_NOTIF_CANCEL || reason == DISMISS_SHORTCUT_REMOVED) { bubblesToBeRemovedFromRepository.add(bubble); } if (!mBubbleData.hasBubbleInStackWithKey(bubble.getKey())) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java +22 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,22 @@ public class NotificationTestHelper { return row; } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. */ public ExpandableNotificationRow createShortcutBubble(String shortcutId) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeShortcutBubbleMetadata(shortcutId)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble and is part * of a group of notifications. Loading Loading @@ -506,6 +522,12 @@ public class NotificationTestHelper { .build(); } private BubbleMetadata makeShortcutBubbleMetadata(String shortcutId) { return new BubbleMetadata.Builder(shortcutId) .setDesiredHeight(314) .build(); } private static class MockSmartReplyInflater implements SmartReplyStateInflater { @Override public InflatedSmartReplyState inflateSmartReplyState(NotificationEntry entry) { Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,8 @@ public class BubblesTest extends SysuiTestCase { private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor; @Captor private ArgumentCaptor<NotificationRemoveInterceptor> mRemoveInterceptorCaptor; @Captor private ArgumentCaptor<List<Bubble>> mBubbleListCaptor; private BubblesManager mBubblesManager; // TODO(178618782): Move tests on the controller directly to the shell Loading Loading @@ -1165,6 +1167,22 @@ public class BubblesTest extends SysuiTestCase { verify(mDataRepository, times(1)).loadBubbles(anyInt(), any()); } /** * Verifies that shortcut deletions triggers that bubble being removed from XML. */ @Test public void testDeleteShortcutsDeletesXml() throws Exception { ExpandableNotificationRow row = mNotificationTestHelper.createShortcutBubble("shortcutId"); BubbleEntry shortcutBubbleEntry = BubblesManager.notifToBubbleEntry(row.getEntry()); mBubbleController.updateBubble(shortcutBubbleEntry); mBubbleData.dismissBubbleWithKey(shortcutBubbleEntry.getKey(), Bubbles.DISMISS_SHORTCUT_REMOVED); verify(mDataRepository, atLeastOnce()).removeBubbles(anyInt(), mBubbleListCaptor.capture()); assertThat(mBubbleListCaptor.getValue().get(0).getKey()).isEqualTo( shortcutBubbleEntry.getKey()); } /** * Verifies that the package manager for the user is used when loading info for the bubble. Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.WindowManagerShellWrapper; import com.android.wm.shell.bubbles.Bubble; import com.android.wm.shell.bubbles.BubbleData; import com.android.wm.shell.bubbles.BubbleDataRepository; import com.android.wm.shell.bubbles.BubbleEntry; Loading Loading @@ -167,6 +168,9 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { @Captor private ArgumentCaptor<NotifCollectionListener> mNotifListenerCaptor; @Captor private ArgumentCaptor<List<Bubble>> mBubbleListCaptor; private BubblesManager mBubblesManager; private TestableBubbleController mBubbleController; private NotificationShadeWindowControllerImpl mNotificationShadeWindowController; Loading Loading @@ -1013,6 +1017,23 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { verify(mDataRepository, times(1)).loadBubbles(anyInt(), any()); } /** * Verifies that shortcut deletions triggers that bubble being removed from XML. */ @Test public void testDeleteShortcutsDeletesXml() throws Exception { ExpandableNotificationRow row = mNotificationTestHelper.createShortcutBubble("shortcutId"); BubbleEntry shortcutBubbleEntry = BubblesManager.notifToBubbleEntry(row.getEntry()); mBubbleController.updateBubble(shortcutBubbleEntry); mBubbleData.dismissBubbleWithKey(shortcutBubbleEntry.getKey(), Bubbles.DISMISS_SHORTCUT_REMOVED); verify(mDataRepository, atLeastOnce()).removeBubbles(anyInt(), mBubbleListCaptor.capture()); assertThat(mBubbleListCaptor.getValue().get(0).getKey()).isEqualTo( shortcutBubbleEntry.getKey()); } @Test public void testShowManageMenuChangesSysuiState() { mBubbleController.updateBubble(mBubbleEntry); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +2 −1 Original line number Diff line number Diff line Loading @@ -1137,7 +1137,8 @@ public class BubbleController { if (reason == DISMISS_USER_CHANGED || reason == DISMISS_NO_BUBBLE_UP) { continue; } if (reason == DISMISS_NOTIF_CANCEL) { if (reason == DISMISS_NOTIF_CANCEL || reason == DISMISS_SHORTCUT_REMOVED) { bubblesToBeRemovedFromRepository.add(bubble); } if (!mBubbleData.hasBubbleInStackWithKey(bubble.getKey())) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java +22 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,22 @@ public class NotificationTestHelper { return row; } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. */ public ExpandableNotificationRow createShortcutBubble(String shortcutId) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeShortcutBubbleMetadata(shortcutId)); n.flags |= FLAG_BUBBLE; ExpandableNotificationRow row = generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); modifyRanking(row.getEntry()) .setCanBubble(true) .build(); return row; } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble and is part * of a group of notifications. Loading Loading @@ -506,6 +522,12 @@ public class NotificationTestHelper { .build(); } private BubbleMetadata makeShortcutBubbleMetadata(String shortcutId) { return new BubbleMetadata.Builder(shortcutId) .setDesiredHeight(314) .build(); } private static class MockSmartReplyInflater implements SmartReplyStateInflater { @Override public InflatedSmartReplyState inflateSmartReplyState(NotificationEntry entry) { Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,8 @@ public class BubblesTest extends SysuiTestCase { private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor; @Captor private ArgumentCaptor<NotificationRemoveInterceptor> mRemoveInterceptorCaptor; @Captor private ArgumentCaptor<List<Bubble>> mBubbleListCaptor; private BubblesManager mBubblesManager; // TODO(178618782): Move tests on the controller directly to the shell Loading Loading @@ -1165,6 +1167,22 @@ public class BubblesTest extends SysuiTestCase { verify(mDataRepository, times(1)).loadBubbles(anyInt(), any()); } /** * Verifies that shortcut deletions triggers that bubble being removed from XML. */ @Test public void testDeleteShortcutsDeletesXml() throws Exception { ExpandableNotificationRow row = mNotificationTestHelper.createShortcutBubble("shortcutId"); BubbleEntry shortcutBubbleEntry = BubblesManager.notifToBubbleEntry(row.getEntry()); mBubbleController.updateBubble(shortcutBubbleEntry); mBubbleData.dismissBubbleWithKey(shortcutBubbleEntry.getKey(), Bubbles.DISMISS_SHORTCUT_REMOVED); verify(mDataRepository, atLeastOnce()).removeBubbles(anyInt(), mBubbleListCaptor.capture()); assertThat(mBubbleListCaptor.getValue().get(0).getKey()).isEqualTo( shortcutBubbleEntry.getKey()); } /** * Verifies that the package manager for the user is used when loading info for the bubble. Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.WindowManagerShellWrapper; import com.android.wm.shell.bubbles.Bubble; import com.android.wm.shell.bubbles.BubbleData; import com.android.wm.shell.bubbles.BubbleDataRepository; import com.android.wm.shell.bubbles.BubbleEntry; Loading Loading @@ -167,6 +168,9 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { @Captor private ArgumentCaptor<NotifCollectionListener> mNotifListenerCaptor; @Captor private ArgumentCaptor<List<Bubble>> mBubbleListCaptor; private BubblesManager mBubblesManager; private TestableBubbleController mBubbleController; private NotificationShadeWindowControllerImpl mNotificationShadeWindowController; Loading Loading @@ -1013,6 +1017,23 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { verify(mDataRepository, times(1)).loadBubbles(anyInt(), any()); } /** * Verifies that shortcut deletions triggers that bubble being removed from XML. */ @Test public void testDeleteShortcutsDeletesXml() throws Exception { ExpandableNotificationRow row = mNotificationTestHelper.createShortcutBubble("shortcutId"); BubbleEntry shortcutBubbleEntry = BubblesManager.notifToBubbleEntry(row.getEntry()); mBubbleController.updateBubble(shortcutBubbleEntry); mBubbleData.dismissBubbleWithKey(shortcutBubbleEntry.getKey(), Bubbles.DISMISS_SHORTCUT_REMOVED); verify(mDataRepository, atLeastOnce()).removeBubbles(anyInt(), mBubbleListCaptor.capture()); assertThat(mBubbleListCaptor.getValue().get(0).getKey()).isEqualTo( shortcutBubbleEntry.getKey()); } @Test public void testShowManageMenuChangesSysuiState() { mBubbleController.updateBubble(mBubbleEntry); Loading