Loading services/core/java/com/android/server/notification/BubbleExtractor.java +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class BubbleExtractor implements NotificationSignalExtractor { boolean canPresentAsBubble = canPresentAsBubble(record) && !mActivityManager.isLowRamDevice() && record.isConversation() && record.getShortcutInfo() != null && (record.getNotification().flags & FLAG_FOREGROUND_SERVICE) == 0; if (!mConfig.bubblesEnabled() Loading services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java +20 −2 Original line number Diff line number Diff line Loading @@ -431,7 +431,7 @@ public class BubbleExtractorTest extends UiServiceTestCase { } @Test public void testFlagBubble_false_notConversation() { public void testFlagBubble_false_noShortcut() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, DEFAULT_ALLOW_BUBBLE /* channel */); Loading @@ -439,7 +439,6 @@ public class BubbleExtractorTest extends UiServiceTestCase { setUpIntentBubble(true /* isValid */); NotificationRecord r = getNotificationRecord(true /* bubble */); // No longer a conversation: r.setShortcutInfo(null); r.getNotification().extras.putString(Notification.EXTRA_TEMPLATE, null); Loading @@ -450,6 +449,25 @@ public class BubbleExtractorTest extends UiServiceTestCase { assertFalse(r.getNotification().isBubbleNotification()); } @Test public void testFlagBubble_false_notConversation() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, DEFAULT_ALLOW_BUBBLE /* channel */); when(mActivityManager.isLowRamDevice()).thenReturn(false); setUpIntentBubble(true /* isValid */); NotificationRecord r = getNotificationRecord(true /* bubble */); r.userDemotedAppFromConvoSpace(true); r.getNotification().extras.putString(Notification.EXTRA_TEMPLATE, null); mBubbleExtractor.process(r); assertFalse(r.canBubble()); assertNull(r.getNotification().getBubbleMetadata()); assertFalse(r.getNotification().isBubbleNotification()); } @Test public void testFlagBubble_false_lowRamDevice() { setUpBubblesEnabled(true /* feature */, Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -5308,6 +5308,28 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { nr.getSbn().getKey()).getNotification().isBubbleNotification()); } @Test public void testFlagBubbleNotifs_noFlag_noShortcut() throws RemoteException { setUpPrefsForBubbles(PKG, mUid, true /* global */, BUBBLE_PREFERENCE_ALL /* app */, true /* channel */); Notification.Builder nb = getMessageStyleNotifBuilder(true, null, false); nb.setShortcutId(null); StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, null, mUid, 0, nb.build(), new UserHandle(mUid), null, 0); mBinderService.enqueueNotificationWithTag(PKG, PKG, sbn.getTag(), sbn.getId(), sbn.getNotification(), sbn.getUserId()); waitForIdle(); // no shortcut no bubble assertFalse(mService.getNotificationRecord( sbn.getKey()).getNotification().isBubbleNotification()); } @Test public void testFlagBubbleNotifs_noFlag_messaging_appNotAllowed() throws RemoteException { setUpPrefsForBubbles(PKG, mUid, Loading Loading
services/core/java/com/android/server/notification/BubbleExtractor.java +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class BubbleExtractor implements NotificationSignalExtractor { boolean canPresentAsBubble = canPresentAsBubble(record) && !mActivityManager.isLowRamDevice() && record.isConversation() && record.getShortcutInfo() != null && (record.getNotification().flags & FLAG_FOREGROUND_SERVICE) == 0; if (!mConfig.bubblesEnabled() Loading
services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java +20 −2 Original line number Diff line number Diff line Loading @@ -431,7 +431,7 @@ public class BubbleExtractorTest extends UiServiceTestCase { } @Test public void testFlagBubble_false_notConversation() { public void testFlagBubble_false_noShortcut() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, DEFAULT_ALLOW_BUBBLE /* channel */); Loading @@ -439,7 +439,6 @@ public class BubbleExtractorTest extends UiServiceTestCase { setUpIntentBubble(true /* isValid */); NotificationRecord r = getNotificationRecord(true /* bubble */); // No longer a conversation: r.setShortcutInfo(null); r.getNotification().extras.putString(Notification.EXTRA_TEMPLATE, null); Loading @@ -450,6 +449,25 @@ public class BubbleExtractorTest extends UiServiceTestCase { assertFalse(r.getNotification().isBubbleNotification()); } @Test public void testFlagBubble_false_notConversation() { setUpBubblesEnabled(true /* feature */, BUBBLE_PREFERENCE_ALL /* app */, DEFAULT_ALLOW_BUBBLE /* channel */); when(mActivityManager.isLowRamDevice()).thenReturn(false); setUpIntentBubble(true /* isValid */); NotificationRecord r = getNotificationRecord(true /* bubble */); r.userDemotedAppFromConvoSpace(true); r.getNotification().extras.putString(Notification.EXTRA_TEMPLATE, null); mBubbleExtractor.process(r); assertFalse(r.canBubble()); assertNull(r.getNotification().getBubbleMetadata()); assertFalse(r.getNotification().isBubbleNotification()); } @Test public void testFlagBubble_false_lowRamDevice() { setUpBubblesEnabled(true /* feature */, Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -5308,6 +5308,28 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { nr.getSbn().getKey()).getNotification().isBubbleNotification()); } @Test public void testFlagBubbleNotifs_noFlag_noShortcut() throws RemoteException { setUpPrefsForBubbles(PKG, mUid, true /* global */, BUBBLE_PREFERENCE_ALL /* app */, true /* channel */); Notification.Builder nb = getMessageStyleNotifBuilder(true, null, false); nb.setShortcutId(null); StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, null, mUid, 0, nb.build(), new UserHandle(mUid), null, 0); mBinderService.enqueueNotificationWithTag(PKG, PKG, sbn.getTag(), sbn.getId(), sbn.getNotification(), sbn.getUserId()); waitForIdle(); // no shortcut no bubble assertFalse(mService.getNotificationRecord( sbn.getKey()).getNotification().isBubbleNotification()); } @Test public void testFlagBubbleNotifs_noFlag_messaging_appNotAllowed() throws RemoteException { setUpPrefsForBubbles(PKG, mUid, Loading