From 348edec2834a1ad1acd077eaa5185b0f84da9e7a Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 26 Feb 2021 15:40:47 -0500 Subject: [PATCH 1/2] Update comment Test: make Fixes: 181350653 Change-Id: Id16e8a0d36a4e3664a175f87e323179b648eed04 --- core/java/android/app/Notification.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index bc24e9767944d..109687776ae6b 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1612,7 +1612,8 @@ public class Notification implements Parcelable /** * {@code SemanticAction}: Mark the conversation associated with the notification as a - * priority. Note that this is only for use by the notification assistant services. + * priority. Note that this is only for use by the notification assistant services. The + * type will be ignored for actions an app adds to its own notifications. * @hide */ @SystemApi @@ -1620,7 +1621,8 @@ public class Notification implements Parcelable /** * {@code SemanticAction}: Mark content as a potential phishing attempt. - * Note that this is only for use by the notification assistant services. + * Note that this is only for use by the notification assistant services. The type will + * be ignored for actions an app adds to its own notifications. * @hide */ @SystemApi From b263722171e9ad07e323eed3034087bf99275cbb Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Tue, 9 Mar 2021 09:58:45 -0500 Subject: [PATCH 2/2] FGS notifs are no longer upranked With the relaxation of FGS visiblity rules in S, we no longer need to boost FGS notifications to the alerting section to ensure visibility on the lockscreen. Test: atest HighPriorirtProviderTest Bug: 182164793 Change-Id: I363c16708ab00bb3b2c4e3663bac2a6470a75274 --- .../provider/HighPriorityProvider.java | 8 +------ .../collection/HighPriorityProviderTest.java | 21 +------------------ 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/HighPriorityProvider.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/HighPriorityProvider.java index 18806effc545f..5a3f48cec290e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/HighPriorityProvider.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/HighPriorityProvider.java @@ -99,17 +99,11 @@ public class HighPriorityProvider { private boolean hasHighPriorityCharacteristics(NotificationEntry entry) { return !hasUserSetImportance(entry) - && (isImportantOngoing(entry) - || entry.getSbn().getNotification().hasMediaSession() + && (entry.getSbn().getNotification().hasMediaSession() || isPeopleNotification(entry) || isMessagingStyle(entry)); } - private boolean isImportantOngoing(NotificationEntry entry) { - return entry.getSbn().getNotification().isForegroundService() - && entry.getRanking().getImportance() >= NotificationManager.IMPORTANCE_LOW; - } - private boolean isMessagingStyle(NotificationEntry entry) { return Notification.MessagingStyle.class.equals( entry.getSbn().getNotification().getNotificationStyle()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java index 14877eec9a83c..30708a7cb2fe7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/HighPriorityProviderTest.java @@ -127,25 +127,7 @@ public class HighPriorityProviderTest extends SysuiTestCase { .getPeopleNotificationType(entry)) .thenReturn(TYPE_NON_PERSON); - // THEN it has high priority - assertTrue(mHighPriorityProvider.isHighPriority(entry)); - } - - @Test - public void minImportanceForeground() { - // GIVEN notification is low importance and is associated with a foreground service - final Notification notification = mock(Notification.class); - when(notification.isForegroundService()).thenReturn(true); - - final NotificationEntry entry = new NotificationEntryBuilder() - .setNotification(notification) - .setImportance(IMPORTANCE_MIN) - .build(); - when(mPeopleNotificationIdentifier - .getPeopleNotificationType(entry)) - .thenReturn(TYPE_NON_PERSON); - - // THEN it does NOT have high priority + // THEN it has low priority assertFalse(mHighPriorityProvider.isHighPriority(entry)); } @@ -155,7 +137,6 @@ public class HighPriorityProviderTest extends SysuiTestCase { // to less than IMPORTANCE_DEFAULT (ie: IMPORTANCE_LOW or IMPORTANCE_MIN) final Notification notification = new Notification.Builder(mContext, "test") .setStyle(new Notification.MessagingStyle("")) - .setFlag(Notification.FLAG_FOREGROUND_SERVICE, true) .build(); final NotificationChannel channel = new NotificationChannel("a", "a", IMPORTANCE_LOW);