Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +0 −1 Original line number Diff line number Diff line Loading @@ -395,7 +395,6 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe } if (shouldAutoBubbleForFlags(mContext, entry) || shouldBubble(entry)) { // TODO: handle group summaries entry.setIsBubble(true); boolean suppressNotification = entry.getBubbleMetadata() != null && entry.getBubbleMetadata().getSuppressInitialNotification() && isForegroundApp(entry.notification.getPackageName()); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +2 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.Notification.CATEGORY_CALL; import static android.app.Notification.CATEGORY_EVENT; import static android.app.Notification.CATEGORY_MESSAGE; import static android.app.Notification.CATEGORY_REMINDER; import static android.app.Notification.FLAG_BUBBLE; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST; Loading Loading @@ -145,11 +146,6 @@ public final class NotificationEntry { */ private boolean hasSentReply; /** * Whether this notification should be displayed as a bubble. */ private boolean mIsBubble; /** * Whether this notification has been approved globally, at the app level, and at the channel * level for bubbling. Loading Loading @@ -222,12 +218,8 @@ public final class NotificationEntry { this.mHighPriority = highPriority; } public void setIsBubble(boolean bubbleable) { mIsBubble = bubbleable; } public boolean isBubble() { return mIsBubble; return (notification.getNotification().flags & FLAG_BUBBLE) != 0; } public void setBubbleDismissed(boolean userDismissed) { Loading packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java +15 −18 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ package com.android.systemui.bubbles; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; Loading @@ -42,7 +45,6 @@ import android.widget.FrameLayout; import androidx.test.filters.SmallTest; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.NotificationTestHelper; Loading Loading @@ -96,9 +98,9 @@ public class BubbleControllerTest extends SysuiTestCase { private NotificationTestHelper mNotificationTestHelper; private ExpandableNotificationRow mRow; private ExpandableNotificationRow mRow2; private ExpandableNotificationRow mNoChannelRow; private ExpandableNotificationRow mAutoExpandRow; private ExpandableNotificationRow mSuppressNotifRow; private ExpandableNotificationRow mNonBubbleNotifRow; @Mock private NotificationData mNotificationData; Loading @@ -106,9 +108,6 @@ public class BubbleControllerTest extends SysuiTestCase { private BubbleController.BubbleStateChangeListener mBubbleStateChangeListener; @Mock private BubbleController.BubbleExpandListener mBubbleExpandListener; @Mock NotificationVisibility mNotificationVisibility; @Mock private PendingIntent mDeleteIntent; Loading @@ -129,7 +128,7 @@ public class BubbleControllerTest extends SysuiTestCase { mNotificationTestHelper = new NotificationTestHelper(mContext); mRow = mNotificationTestHelper.createBubble(mDeleteIntent); mRow2 = mNotificationTestHelper.createBubble(mDeleteIntent); mNoChannelRow = mNotificationTestHelper.createBubble(mDeleteIntent); mNonBubbleNotifRow = mNotificationTestHelper.createRow(); // Some bubbles want to auto expand Notification.BubbleMetadata autoExpandMetadata = Loading @@ -146,7 +145,6 @@ public class BubbleControllerTest extends SysuiTestCase { // Return non-null notification data from the NEM when(mNotificationEntryManager.getNotificationData()).thenReturn(mNotificationData); when(mNotificationData.getChannel(mRow.getEntry().key)).thenReturn(mRow.getEntry().channel); when(mNotificationData.getChannel(mNoChannelRow.getEntry().key)).thenReturn(null); mBubbleData = new BubbleData(); mBubbleController = new TestableBubbleController(mContext, mStatusBarWindowController, Loading Loading @@ -391,8 +389,7 @@ public class BubbleControllerTest extends SysuiTestCase { mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry()); mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */); // Should be a bubble & should show in shade because we weren't forground assertTrue(mSuppressNotifRow.getEntry().isBubble()); // Should show in shade because we weren't forground assertTrue(mSuppressNotifRow.getEntry().showInShadeWhenBubble()); // # of bubbles should change Loading Loading @@ -428,8 +425,7 @@ public class BubbleControllerTest extends SysuiTestCase { mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry()); mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */); // Should be a bubble & should NOT show in shade because we were foreground assertTrue(mSuppressNotifRow.getEntry().isBubble()); // Should NOT show in shade because we were foreground assertFalse(mSuppressNotifRow.getEntry().showInShadeWhenBubble()); // # of bubbles should change Loading @@ -444,8 +440,6 @@ public class BubbleControllerTest extends SysuiTestCase { mEntryListener.onPendingEntryAdded(mRow.getEntry()); mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */); assertTrue(mRow.getEntry().isBubble()); // Simulate notification cancellation. mEntryListener.onEntryRemoved(mRow.getEntry(), null /* notificationVisibility (unused) */, false /* removedbyUser */); Loading @@ -454,15 +448,18 @@ public class BubbleControllerTest extends SysuiTestCase { } @Test public void testMarkNewNotificationAsBubble() { public void testMarkNewNotificationAsShowInShade() { mEntryListener.onPendingEntryAdded(mRow.getEntry()); assertTrue(mRow.getEntry().isBubble()); assertTrue(mRow.getEntry().showInShadeWhenBubble()); } @Test public void testMarkNewNotificationAsShowInShade() { mEntryListener.onPendingEntryAdded(mRow.getEntry()); assertTrue(mRow.getEntry().showInShadeWhenBubble()); public void testAddNotif_notBubble() { mEntryListener.onPendingEntryAdded(mNonBubbleNotifRow.getEntry()); mEntryListener.onPreEntryUpdated(mNonBubbleNotifRow.getEntry()); verify(mBubbleStateChangeListener, never()).onHasBubblesChanged(anyBoolean()); assertThat(mBubbleController.hasBubbles()).isFalse(); } @Test Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java +4 −18 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar; import static android.app.Notification.FLAG_BUBBLE; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; Loading Loading @@ -154,9 +155,7 @@ public class NotificationTestHelper { */ public ExpandableNotificationRow createBubble() throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeBubbleMetadata(null)); return generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); return createBubble(makeBubbleMetadata(null), PKG); } /** Loading @@ -166,21 +165,7 @@ public class NotificationTestHelper { */ public ExpandableNotificationRow createBubble(@Nullable PendingIntent deleteIntent) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeBubbleMetadata(deleteIntent)); return generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. * * @param bubbleMetadata the {@link BubbleMetadata} to use */ public ExpandableNotificationRow createBubble(BubbleMetadata bubbleMetadata) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, bubbleMetadata); return generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); return createBubble(makeBubbleMetadata(deleteIntent), PKG); } /** Loading @@ -192,6 +177,7 @@ public class NotificationTestHelper { throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, bubbleMetadata); n.flags |= FLAG_BUBBLE; return generateRow(n, pkg, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,6 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase { bubbleSbn.getNotification().contentIntent = mContentIntent; bubbleSbn.getNotification().flags |= Notification.FLAG_AUTO_CANCEL; // Do what BubbleController's NotificationEntryListener#onPendingEntryAdded does: mBubbleNotificationRow.getEntry().setIsBubble(true); mBubbleNotificationRow.getEntry().setShowInShadeWhenBubble(true); mActiveNotifications = new ArrayList<>(); Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +0 −1 Original line number Diff line number Diff line Loading @@ -395,7 +395,6 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe } if (shouldAutoBubbleForFlags(mContext, entry) || shouldBubble(entry)) { // TODO: handle group summaries entry.setIsBubble(true); boolean suppressNotification = entry.getBubbleMetadata() != null && entry.getBubbleMetadata().getSuppressInitialNotification() && isForegroundApp(entry.notification.getPackageName()); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +2 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.Notification.CATEGORY_CALL; import static android.app.Notification.CATEGORY_EVENT; import static android.app.Notification.CATEGORY_MESSAGE; import static android.app.Notification.CATEGORY_REMINDER; import static android.app.Notification.FLAG_BUBBLE; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST; Loading Loading @@ -145,11 +146,6 @@ public final class NotificationEntry { */ private boolean hasSentReply; /** * Whether this notification should be displayed as a bubble. */ private boolean mIsBubble; /** * Whether this notification has been approved globally, at the app level, and at the channel * level for bubbling. Loading Loading @@ -222,12 +218,8 @@ public final class NotificationEntry { this.mHighPriority = highPriority; } public void setIsBubble(boolean bubbleable) { mIsBubble = bubbleable; } public boolean isBubble() { return mIsBubble; return (notification.getNotification().flags & FLAG_BUBBLE) != 0; } public void setBubbleDismissed(boolean userDismissed) { Loading
packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java +15 −18 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ package com.android.systemui.bubbles; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; Loading @@ -42,7 +45,6 @@ import android.widget.FrameLayout; import androidx.test.filters.SmallTest; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.NotificationTestHelper; Loading Loading @@ -96,9 +98,9 @@ public class BubbleControllerTest extends SysuiTestCase { private NotificationTestHelper mNotificationTestHelper; private ExpandableNotificationRow mRow; private ExpandableNotificationRow mRow2; private ExpandableNotificationRow mNoChannelRow; private ExpandableNotificationRow mAutoExpandRow; private ExpandableNotificationRow mSuppressNotifRow; private ExpandableNotificationRow mNonBubbleNotifRow; @Mock private NotificationData mNotificationData; Loading @@ -106,9 +108,6 @@ public class BubbleControllerTest extends SysuiTestCase { private BubbleController.BubbleStateChangeListener mBubbleStateChangeListener; @Mock private BubbleController.BubbleExpandListener mBubbleExpandListener; @Mock NotificationVisibility mNotificationVisibility; @Mock private PendingIntent mDeleteIntent; Loading @@ -129,7 +128,7 @@ public class BubbleControllerTest extends SysuiTestCase { mNotificationTestHelper = new NotificationTestHelper(mContext); mRow = mNotificationTestHelper.createBubble(mDeleteIntent); mRow2 = mNotificationTestHelper.createBubble(mDeleteIntent); mNoChannelRow = mNotificationTestHelper.createBubble(mDeleteIntent); mNonBubbleNotifRow = mNotificationTestHelper.createRow(); // Some bubbles want to auto expand Notification.BubbleMetadata autoExpandMetadata = Loading @@ -146,7 +145,6 @@ public class BubbleControllerTest extends SysuiTestCase { // Return non-null notification data from the NEM when(mNotificationEntryManager.getNotificationData()).thenReturn(mNotificationData); when(mNotificationData.getChannel(mRow.getEntry().key)).thenReturn(mRow.getEntry().channel); when(mNotificationData.getChannel(mNoChannelRow.getEntry().key)).thenReturn(null); mBubbleData = new BubbleData(); mBubbleController = new TestableBubbleController(mContext, mStatusBarWindowController, Loading Loading @@ -391,8 +389,7 @@ public class BubbleControllerTest extends SysuiTestCase { mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry()); mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */); // Should be a bubble & should show in shade because we weren't forground assertTrue(mSuppressNotifRow.getEntry().isBubble()); // Should show in shade because we weren't forground assertTrue(mSuppressNotifRow.getEntry().showInShadeWhenBubble()); // # of bubbles should change Loading Loading @@ -428,8 +425,7 @@ public class BubbleControllerTest extends SysuiTestCase { mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry()); mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */); // Should be a bubble & should NOT show in shade because we were foreground assertTrue(mSuppressNotifRow.getEntry().isBubble()); // Should NOT show in shade because we were foreground assertFalse(mSuppressNotifRow.getEntry().showInShadeWhenBubble()); // # of bubbles should change Loading @@ -444,8 +440,6 @@ public class BubbleControllerTest extends SysuiTestCase { mEntryListener.onPendingEntryAdded(mRow.getEntry()); mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */); assertTrue(mRow.getEntry().isBubble()); // Simulate notification cancellation. mEntryListener.onEntryRemoved(mRow.getEntry(), null /* notificationVisibility (unused) */, false /* removedbyUser */); Loading @@ -454,15 +448,18 @@ public class BubbleControllerTest extends SysuiTestCase { } @Test public void testMarkNewNotificationAsBubble() { public void testMarkNewNotificationAsShowInShade() { mEntryListener.onPendingEntryAdded(mRow.getEntry()); assertTrue(mRow.getEntry().isBubble()); assertTrue(mRow.getEntry().showInShadeWhenBubble()); } @Test public void testMarkNewNotificationAsShowInShade() { mEntryListener.onPendingEntryAdded(mRow.getEntry()); assertTrue(mRow.getEntry().showInShadeWhenBubble()); public void testAddNotif_notBubble() { mEntryListener.onPendingEntryAdded(mNonBubbleNotifRow.getEntry()); mEntryListener.onPreEntryUpdated(mNonBubbleNotifRow.getEntry()); verify(mBubbleStateChangeListener, never()).onHasBubblesChanged(anyBoolean()); assertThat(mBubbleController.hasBubbles()).isFalse(); } @Test Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java +4 −18 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar; import static android.app.Notification.FLAG_BUBBLE; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; Loading Loading @@ -154,9 +155,7 @@ public class NotificationTestHelper { */ public ExpandableNotificationRow createBubble() throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeBubbleMetadata(null)); return generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); return createBubble(makeBubbleMetadata(null), PKG); } /** Loading @@ -166,21 +165,7 @@ public class NotificationTestHelper { */ public ExpandableNotificationRow createBubble(@Nullable PendingIntent deleteIntent) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, makeBubbleMetadata(deleteIntent)); return generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); } /** * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble. * * @param bubbleMetadata the {@link BubbleMetadata} to use */ public ExpandableNotificationRow createBubble(BubbleMetadata bubbleMetadata) throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, bubbleMetadata); return generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); return createBubble(makeBubbleMetadata(deleteIntent), PKG); } /** Loading @@ -192,6 +177,7 @@ public class NotificationTestHelper { throws Exception { Notification n = createNotification(false /* isGroupSummary */, null /* groupKey */, bubbleMetadata); n.flags |= FLAG_BUBBLE; return generateRow(n, pkg, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,6 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase { bubbleSbn.getNotification().contentIntent = mContentIntent; bubbleSbn.getNotification().flags |= Notification.FLAG_AUTO_CANCEL; // Do what BubbleController's NotificationEntryListener#onPendingEntryAdded does: mBubbleNotificationRow.getEntry().setIsBubble(true); mBubbleNotificationRow.getEntry().setShowInShadeWhenBubble(true); mActiveNotifications = new ArrayList<>(); Loading