Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +4 −2 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider; import com.android.systemui.statusbar.notification.people.PeopleHubModule; Loading Loading @@ -208,6 +209,7 @@ public abstract class SystemUIModule { NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, NotificationLockscreenUserManager notifUserManager, NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, CommonNotifCollection notifCollection, NotifPipeline notifPipeline, SysUiState sysUiState, NotifPipelineFlags notifPipelineFlags, DumpManager dumpManager, @Main Executor sysuiMainExecutor) { Loading @@ -216,7 +218,7 @@ public abstract class SystemUIModule { configurationController, statusBarService, notificationManager, visibilityProvider, interruptionStateProvider, zenModeController, notifUserManager, groupManager, entryManager, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor)); groupManager, entryManager, notifCollection, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor)); } } packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +24 −24 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.coordinator.BubbleCoordinator; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.notifcollection.DismissedByUserStats; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; Loading @@ -88,6 +89,7 @@ import com.android.wm.shell.bubbles.Bubbles; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Optional; Loading @@ -111,8 +113,10 @@ public class BubblesManager implements Dumpable { private final INotificationManager mNotificationManager; private final NotificationVisibilityProvider mVisibilityProvider; private final NotificationInterruptStateProvider mNotificationInterruptStateProvider; private final NotificationLockscreenUserManager mNotifUserManager; private final NotificationGroupManagerLegacy mNotificationGroupManager; private final NotificationEntryManager mNotificationEntryManager; private final CommonNotifCollection mCommonNotifCollection; private final NotifPipeline mNotifPipeline; private final Executor mSysuiMainExecutor; Loading @@ -139,6 +143,7 @@ public class BubblesManager implements Dumpable { NotificationLockscreenUserManager notifUserManager, NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, CommonNotifCollection notifCollection, NotifPipeline notifPipeline, SysUiState sysUiState, NotifPipelineFlags notifPipelineFlags, Loading @@ -150,8 +155,8 @@ public class BubblesManager implements Dumpable { configurationController, statusBarService, notificationManager, visibilityProvider, interruptionStateProvider, zenModeController, notifUserManager, groupManager, entryManager, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor); groupManager, entryManager, notifCollection, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor); } else { return null; } Loading @@ -172,6 +177,7 @@ public class BubblesManager implements Dumpable { NotificationLockscreenUserManager notifUserManager, NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, CommonNotifCollection notifCollection, NotifPipeline notifPipeline, SysUiState sysUiState, NotifPipelineFlags notifPipelineFlags, Loading @@ -184,8 +190,10 @@ public class BubblesManager implements Dumpable { mNotificationManager = notificationManager; mVisibilityProvider = visibilityProvider; mNotificationInterruptStateProvider = interruptionStateProvider; mNotifUserManager = notifUserManager; mNotificationGroupManager = groupManager; mNotificationEntryManager = entryManager; mCommonNotifCollection = notifCollection; mNotifPipeline = notifPipeline; mSysuiMainExecutor = sysuiMainExecutor; Loading Loading @@ -264,8 +272,7 @@ public class BubblesManager implements Dumpable { @Override public void getPendingOrActiveEntry(String key, Consumer<BubbleEntry> callback) { sysuiMainExecutor.execute(() -> { NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); callback.accept(entry == null ? null : notifToBubbleEntry(entry)); }); } Loading @@ -275,11 +282,11 @@ public class BubblesManager implements Dumpable { Consumer<List<BubbleEntry>> callback) { sysuiMainExecutor.execute(() -> { List<BubbleEntry> result = new ArrayList<>(); List<NotificationEntry> activeEntries = mNotificationEntryManager.getActiveNotificationsForCurrentUser(); for (int i = 0; i < activeEntries.size(); i++) { NotificationEntry entry = activeEntries.get(i); if (savedBubbleKeys.contains(entry.getKey()) final Collection<NotificationEntry> activeEntries = mCommonNotifCollection.getAllNotifs(); for (NotificationEntry entry : activeEntries) { if (mNotifUserManager.isCurrentProfile(entry.getSbn().getUserId()) && savedBubbleKeys.contains(entry.getKey()) && mNotificationInterruptStateProvider.shouldBubbleUp(entry) && entry.isBubble()) { result.add(notifToBubbleEntry(entry)); Loading @@ -292,8 +299,7 @@ public class BubblesManager implements Dumpable { @Override public void setNotificationInterruption(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null && entry.getImportance() >= NotificationManager.IMPORTANCE_HIGH) { entry.setInterruption(); Loading @@ -311,8 +317,7 @@ public class BubblesManager implements Dumpable { @Override public void notifyRemoveNotification(String key, int reason) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { for (NotifCallback cb : mCallbacks) { cb.removeNotification(entry, getDismissedByUserStats(entry, true), Loading @@ -334,8 +339,7 @@ public class BubblesManager implements Dumpable { @Override public void notifyMaybeCancelSummary(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { for (NotifCallback cb : mCallbacks) { cb.maybeCancelSummary(entry); Loading @@ -347,8 +351,7 @@ public class BubblesManager implements Dumpable { @Override public void removeNotificationEntry(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { mNotificationGroupManager.onEntryRemoved(entry); } Loading @@ -358,8 +361,7 @@ public class BubblesManager implements Dumpable { @Override public void updateNotificationBubbleButton(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null && entry.getRow() != null) { entry.getRow().updateBubbleButton(); } Loading @@ -369,8 +371,7 @@ public class BubblesManager implements Dumpable { @Override public void updateNotificationSuppression(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { mNotificationGroupManager.updateSuppression(entry); } Loading Loading @@ -402,8 +403,7 @@ public class BubblesManager implements Dumpable { @Override public void onUnbubbleConversation(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { onUserChangedBubble(entry, false /* shouldBubble */); } Loading Loading @@ -580,7 +580,7 @@ public class BubblesManager implements Dumpable { HashMap<String, Pair<BubbleEntry, Boolean>> pendingOrActiveNotif = new HashMap<>(); for (int i = 0; i < orderedKeys.length; i++) { String key = orderedKeys[i]; NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); BubbleEntry bubbleEntry = entry != null ? notifToBubbleEntry(entry) : null; Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +17 −20 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationTestHelper; Loading Loading @@ -152,6 +153,8 @@ public class BubblesTest extends SysuiTestCase { @Mock private NotificationEntryManager mNotificationEntryManager; @Mock private CommonNotifCollection mCommonNotifCollection; @Mock private NotificationGroupManagerLegacy mNotificationGroupManager; @Mock private WindowManager mWindowManager; Loading Loading @@ -299,9 +302,8 @@ public class BubblesTest extends SysuiTestCase { mBubbleEntry2User11 = BubblesManager.notifToBubbleEntry( mNotificationTestHelper.createBubble(handle)); // Return non-null notification data from the NEM when(mNotificationEntryManager .getActiveNotificationUnfiltered(mRow.getKey())).thenReturn(mRow); // Return non-null notification data from the CommonNotifCollection when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); mZenModeConfig.suppressedVisualEffects = 0; when(mZenModeController.getConfig()).thenReturn(mZenModeConfig); Loading Loading @@ -371,12 +373,14 @@ public class BubblesTest extends SysuiTestCase { mLockscreenUserManager, mNotificationGroupManager, mNotificationEntryManager, mCommonNotifCollection, mNotifPipeline, mSysUiState, mNotifPipelineFlags, mDumpManager, syncExecutor); // XXX: Does *this* need to be changed? // Get a reference to the BubbleController's entry listener verify(mNotificationEntryManager, atLeastOnce()) .addNotificationEntryListener(mEntryListenerCaptor.capture()); Loading Loading @@ -421,10 +425,8 @@ public class BubblesTest extends SysuiTestCase { public void testPromoteBubble_autoExpand() throws Exception { mBubbleController.updateBubble(mBubbleEntry2); mBubbleController.updateBubble(mBubbleEntry); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); mBubbleController.removeBubble( mRow.getKey(), Bubbles.DISMISS_USER_GESTURE); Loading Loading @@ -452,10 +454,8 @@ public class BubblesTest extends SysuiTestCase { mBubbleController.updateBubble(mBubbleEntry2); mBubbleController.updateBubble(mBubbleEntry, /* suppressFlyout */ false, /* showInShade */ true); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); mBubbleController.removeBubble( mRow.getKey(), Bubbles.DISMISS_USER_GESTURE); Loading Loading @@ -958,12 +958,9 @@ public class BubblesTest extends SysuiTestCase { mBubbleEntry2, /* suppressFlyout */ false, /* showInShade */ false); mBubbleController.updateBubble( mBubbleEntry3, /* suppressFlyout */ false, /* showInShade */ false); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow3.getKey())) .thenReturn(mRow3); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); when(mCommonNotifCollection.getEntry(mRow3.getKey())).thenReturn(mRow3); assertEquals(mBubbleData.getBubbles().size(), 3); mBubbleData.setMaxOverflowBubbles(1); Loading Loading @@ -1021,7 +1018,7 @@ public class BubblesTest extends SysuiTestCase { // GIVEN a group summary with a bubble child ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); mEntryListener.onPendingEntryAdded(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); Loading @@ -1046,7 +1043,7 @@ public class BubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onPendingEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); assertTrue(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey())); Loading @@ -1069,7 +1066,7 @@ public class BubblesTest extends SysuiTestCase { // GIVEN a group summary with two (non-bubble) children and one bubble child ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(2); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); mEntryListener.onPendingEntryAdded(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java +11 −9 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ import com.android.systemui.statusbar.notification.NotificationFilter; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; Loading Loading @@ -133,6 +134,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { @Mock private NotificationEntryManager mNotificationEntryManager; @Mock private CommonNotifCollection mCommonNotifCollection; @Mock private NotificationGroupManagerLegacy mNotificationGroupManager; @Mock private BubblesManager.NotifCallback mNotifCallback; Loading Loading @@ -336,6 +339,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { mLockscreenUserManager, mNotificationGroupManager, mNotificationEntryManager, mCommonNotifCollection, mNotifPipeline, mSysUiState, mNotifPipelineFlags, Loading Loading @@ -404,8 +408,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { public void testRemoveBubble_withDismissedNotif_notInOverflow() { mEntryListener.onEntryAdded(mRow); mBubbleController.updateBubble(mBubbleEntry); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); assertTrue(mBubbleController.hasBubbles()); assertBubbleNotificationNotSuppressedFromShade(mBubbleEntry); Loading Loading @@ -887,7 +890,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); assertTrue(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey())); Loading @@ -911,7 +914,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); assertTrue(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey())); Loading @@ -935,7 +938,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(2); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); Loading Loading @@ -1011,10 +1014,9 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { */ @Test public void testOverflowLoadedOnce() { when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); // XXX when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); mEntryListener.onEntryAdded(mRow); mEntryListener.onEntryAdded(mRow2); Loading Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +4 −2 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider; import com.android.systemui.statusbar.notification.people.PeopleHubModule; Loading Loading @@ -208,6 +209,7 @@ public abstract class SystemUIModule { NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, NotificationLockscreenUserManager notifUserManager, NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, CommonNotifCollection notifCollection, NotifPipeline notifPipeline, SysUiState sysUiState, NotifPipelineFlags notifPipelineFlags, DumpManager dumpManager, @Main Executor sysuiMainExecutor) { Loading @@ -216,7 +218,7 @@ public abstract class SystemUIModule { configurationController, statusBarService, notificationManager, visibilityProvider, interruptionStateProvider, zenModeController, notifUserManager, groupManager, entryManager, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor)); groupManager, entryManager, notifCollection, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor)); } }
packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +24 −24 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.coordinator.BubbleCoordinator; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.notifcollection.DismissedByUserStats; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; Loading @@ -88,6 +89,7 @@ import com.android.wm.shell.bubbles.Bubbles; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Optional; Loading @@ -111,8 +113,10 @@ public class BubblesManager implements Dumpable { private final INotificationManager mNotificationManager; private final NotificationVisibilityProvider mVisibilityProvider; private final NotificationInterruptStateProvider mNotificationInterruptStateProvider; private final NotificationLockscreenUserManager mNotifUserManager; private final NotificationGroupManagerLegacy mNotificationGroupManager; private final NotificationEntryManager mNotificationEntryManager; private final CommonNotifCollection mCommonNotifCollection; private final NotifPipeline mNotifPipeline; private final Executor mSysuiMainExecutor; Loading @@ -139,6 +143,7 @@ public class BubblesManager implements Dumpable { NotificationLockscreenUserManager notifUserManager, NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, CommonNotifCollection notifCollection, NotifPipeline notifPipeline, SysUiState sysUiState, NotifPipelineFlags notifPipelineFlags, Loading @@ -150,8 +155,8 @@ public class BubblesManager implements Dumpable { configurationController, statusBarService, notificationManager, visibilityProvider, interruptionStateProvider, zenModeController, notifUserManager, groupManager, entryManager, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor); groupManager, entryManager, notifCollection, notifPipeline, sysUiState, notifPipelineFlags, dumpManager, sysuiMainExecutor); } else { return null; } Loading @@ -172,6 +177,7 @@ public class BubblesManager implements Dumpable { NotificationLockscreenUserManager notifUserManager, NotificationGroupManagerLegacy groupManager, NotificationEntryManager entryManager, CommonNotifCollection notifCollection, NotifPipeline notifPipeline, SysUiState sysUiState, NotifPipelineFlags notifPipelineFlags, Loading @@ -184,8 +190,10 @@ public class BubblesManager implements Dumpable { mNotificationManager = notificationManager; mVisibilityProvider = visibilityProvider; mNotificationInterruptStateProvider = interruptionStateProvider; mNotifUserManager = notifUserManager; mNotificationGroupManager = groupManager; mNotificationEntryManager = entryManager; mCommonNotifCollection = notifCollection; mNotifPipeline = notifPipeline; mSysuiMainExecutor = sysuiMainExecutor; Loading Loading @@ -264,8 +272,7 @@ public class BubblesManager implements Dumpable { @Override public void getPendingOrActiveEntry(String key, Consumer<BubbleEntry> callback) { sysuiMainExecutor.execute(() -> { NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); callback.accept(entry == null ? null : notifToBubbleEntry(entry)); }); } Loading @@ -275,11 +282,11 @@ public class BubblesManager implements Dumpable { Consumer<List<BubbleEntry>> callback) { sysuiMainExecutor.execute(() -> { List<BubbleEntry> result = new ArrayList<>(); List<NotificationEntry> activeEntries = mNotificationEntryManager.getActiveNotificationsForCurrentUser(); for (int i = 0; i < activeEntries.size(); i++) { NotificationEntry entry = activeEntries.get(i); if (savedBubbleKeys.contains(entry.getKey()) final Collection<NotificationEntry> activeEntries = mCommonNotifCollection.getAllNotifs(); for (NotificationEntry entry : activeEntries) { if (mNotifUserManager.isCurrentProfile(entry.getSbn().getUserId()) && savedBubbleKeys.contains(entry.getKey()) && mNotificationInterruptStateProvider.shouldBubbleUp(entry) && entry.isBubble()) { result.add(notifToBubbleEntry(entry)); Loading @@ -292,8 +299,7 @@ public class BubblesManager implements Dumpable { @Override public void setNotificationInterruption(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null && entry.getImportance() >= NotificationManager.IMPORTANCE_HIGH) { entry.setInterruption(); Loading @@ -311,8 +317,7 @@ public class BubblesManager implements Dumpable { @Override public void notifyRemoveNotification(String key, int reason) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { for (NotifCallback cb : mCallbacks) { cb.removeNotification(entry, getDismissedByUserStats(entry, true), Loading @@ -334,8 +339,7 @@ public class BubblesManager implements Dumpable { @Override public void notifyMaybeCancelSummary(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { for (NotifCallback cb : mCallbacks) { cb.maybeCancelSummary(entry); Loading @@ -347,8 +351,7 @@ public class BubblesManager implements Dumpable { @Override public void removeNotificationEntry(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { mNotificationGroupManager.onEntryRemoved(entry); } Loading @@ -358,8 +361,7 @@ public class BubblesManager implements Dumpable { @Override public void updateNotificationBubbleButton(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null && entry.getRow() != null) { entry.getRow().updateBubbleButton(); } Loading @@ -369,8 +371,7 @@ public class BubblesManager implements Dumpable { @Override public void updateNotificationSuppression(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { mNotificationGroupManager.updateSuppression(entry); } Loading Loading @@ -402,8 +403,7 @@ public class BubblesManager implements Dumpable { @Override public void onUnbubbleConversation(String key) { sysuiMainExecutor.execute(() -> { final NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); if (entry != null) { onUserChangedBubble(entry, false /* shouldBubble */); } Loading Loading @@ -580,7 +580,7 @@ public class BubblesManager implements Dumpable { HashMap<String, Pair<BubbleEntry, Boolean>> pendingOrActiveNotif = new HashMap<>(); for (int i = 0; i < orderedKeys.length; i++) { String key = orderedKeys[i]; NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); final NotificationEntry entry = mCommonNotifCollection.getEntry(key); BubbleEntry bubbleEntry = entry != null ? notifToBubbleEntry(entry) : null; Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +17 −20 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationTestHelper; Loading Loading @@ -152,6 +153,8 @@ public class BubblesTest extends SysuiTestCase { @Mock private NotificationEntryManager mNotificationEntryManager; @Mock private CommonNotifCollection mCommonNotifCollection; @Mock private NotificationGroupManagerLegacy mNotificationGroupManager; @Mock private WindowManager mWindowManager; Loading Loading @@ -299,9 +302,8 @@ public class BubblesTest extends SysuiTestCase { mBubbleEntry2User11 = BubblesManager.notifToBubbleEntry( mNotificationTestHelper.createBubble(handle)); // Return non-null notification data from the NEM when(mNotificationEntryManager .getActiveNotificationUnfiltered(mRow.getKey())).thenReturn(mRow); // Return non-null notification data from the CommonNotifCollection when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); mZenModeConfig.suppressedVisualEffects = 0; when(mZenModeController.getConfig()).thenReturn(mZenModeConfig); Loading Loading @@ -371,12 +373,14 @@ public class BubblesTest extends SysuiTestCase { mLockscreenUserManager, mNotificationGroupManager, mNotificationEntryManager, mCommonNotifCollection, mNotifPipeline, mSysUiState, mNotifPipelineFlags, mDumpManager, syncExecutor); // XXX: Does *this* need to be changed? // Get a reference to the BubbleController's entry listener verify(mNotificationEntryManager, atLeastOnce()) .addNotificationEntryListener(mEntryListenerCaptor.capture()); Loading Loading @@ -421,10 +425,8 @@ public class BubblesTest extends SysuiTestCase { public void testPromoteBubble_autoExpand() throws Exception { mBubbleController.updateBubble(mBubbleEntry2); mBubbleController.updateBubble(mBubbleEntry); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); mBubbleController.removeBubble( mRow.getKey(), Bubbles.DISMISS_USER_GESTURE); Loading Loading @@ -452,10 +454,8 @@ public class BubblesTest extends SysuiTestCase { mBubbleController.updateBubble(mBubbleEntry2); mBubbleController.updateBubble(mBubbleEntry, /* suppressFlyout */ false, /* showInShade */ true); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); mBubbleController.removeBubble( mRow.getKey(), Bubbles.DISMISS_USER_GESTURE); Loading Loading @@ -958,12 +958,9 @@ public class BubblesTest extends SysuiTestCase { mBubbleEntry2, /* suppressFlyout */ false, /* showInShade */ false); mBubbleController.updateBubble( mBubbleEntry3, /* suppressFlyout */ false, /* showInShade */ false); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow3.getKey())) .thenReturn(mRow3); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); when(mCommonNotifCollection.getEntry(mRow3.getKey())).thenReturn(mRow3); assertEquals(mBubbleData.getBubbles().size(), 3); mBubbleData.setMaxOverflowBubbles(1); Loading Loading @@ -1021,7 +1018,7 @@ public class BubblesTest extends SysuiTestCase { // GIVEN a group summary with a bubble child ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); mEntryListener.onPendingEntryAdded(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); Loading @@ -1046,7 +1043,7 @@ public class BubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onPendingEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); assertTrue(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey())); Loading @@ -1069,7 +1066,7 @@ public class BubblesTest extends SysuiTestCase { // GIVEN a group summary with two (non-bubble) children and one bubble child ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(2); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); mEntryListener.onPendingEntryAdded(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java +11 −9 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ import com.android.systemui.statusbar.notification.NotificationFilter; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; Loading Loading @@ -133,6 +134,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { @Mock private NotificationEntryManager mNotificationEntryManager; @Mock private CommonNotifCollection mCommonNotifCollection; @Mock private NotificationGroupManagerLegacy mNotificationGroupManager; @Mock private BubblesManager.NotifCallback mNotifCallback; Loading Loading @@ -336,6 +339,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { mLockscreenUserManager, mNotificationGroupManager, mNotificationEntryManager, mCommonNotifCollection, mNotifPipeline, mSysUiState, mNotifPipelineFlags, Loading Loading @@ -404,8 +408,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { public void testRemoveBubble_withDismissedNotif_notInOverflow() { mEntryListener.onEntryAdded(mRow); mBubbleController.updateBubble(mBubbleEntry); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); assertTrue(mBubbleController.hasBubbles()); assertBubbleNotificationNotSuppressedFromShade(mBubbleEntry); Loading Loading @@ -887,7 +890,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); assertTrue(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey())); Loading @@ -911,7 +914,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(0); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); assertTrue(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey())); Loading @@ -935,7 +938,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { ExpandableNotificationRow groupSummary = mNotificationTestHelper.createGroup(2); ExpandableNotificationRow groupedBubble = mNotificationTestHelper.createBubbleInGroup(); mEntryListener.onEntryAdded(groupedBubble.getEntry()); when(mNotificationEntryManager.getPendingOrActiveNotif(groupedBubble.getEntry().getKey())) when(mCommonNotifCollection.getEntry(groupedBubble.getEntry().getKey())) .thenReturn(groupedBubble.getEntry()); groupSummary.addChildNotification(groupedBubble); Loading Loading @@ -1011,10 +1014,9 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { */ @Test public void testOverflowLoadedOnce() { when(mNotificationEntryManager.getPendingOrActiveNotif(mRow.getKey())) .thenReturn(mRow); when(mNotificationEntryManager.getPendingOrActiveNotif(mRow2.getKey())) .thenReturn(mRow2); // XXX when(mCommonNotifCollection.getEntry(mRow.getKey())).thenReturn(mRow); when(mCommonNotifCollection.getEntry(mRow2.getKey())).thenReturn(mRow2); mEntryListener.onEntryAdded(mRow); mEntryListener.onEntryAdded(mRow2); Loading