From e6749c164f7e01f88661a0c74761ed0a4adc44e2 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Thu, 23 Apr 2020 16:13:22 -0700 Subject: [PATCH] Add flagRemoved check back in BubbleExtractor This was accidentally removed in ag/10606620 There was a mistake in the test that caused it to pass. Test: atest BubbleExtractorTest Fixes: 154753435 Change-Id: I7cb254b78f48c23087150b54ad74375dacf5c9a0 --- .../java/com/android/server/notification/BubbleExtractor.java | 4 +++- .../com/android/server/notification/BubbleExtractorTest.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/notification/BubbleExtractor.java b/services/core/java/com/android/server/notification/BubbleExtractor.java index 27802ffc013d9..b1a09c1c0d377 100644 --- a/services/core/java/com/android/server/notification/BubbleExtractor.java +++ b/services/core/java/com/android/server/notification/BubbleExtractor.java @@ -94,7 +94,9 @@ public class BubbleExtractor implements NotificationSignalExtractor { && record.isConversation() && !mActivityManager.isLowRamDevice() && (record.getNotification().flags & FLAG_FOREGROUND_SERVICE) == 0; - final boolean applyFlag = fulfillsPolicy && canPresentAsBubble(record); + final boolean applyFlag = fulfillsPolicy + && canPresentAsBubble(record) + && !record.isFlagBubbleRemoved(); if (applyFlag) { record.getNotification().flags |= FLAG_BUBBLE; } else { diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java index 3c376c9972ac3..229bd3f35caca 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java @@ -257,6 +257,7 @@ public class BubbleExtractorTest extends UiServiceTestCase { BUBBLE_PREFERENCE_ALL /* app */, true /* channel */); when(mActivityManager.isLowRamDevice()).thenReturn(false); + setUpShortcutBubble(true /* isValid */); NotificationRecord r = getNotificationRecord(true /* bubble */); r.setFlagBubbleRemoved(true);