Merge changes I363c1670,Id16e8a0d into sc-dev
* changes: FGS notifs are no longer upranked Update comment
This commit is contained in:
committed by
Android (Google) Code Review
commit
58050d1515
@@ -1611,7 +1611,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
|
||||
@@ -1619,7 +1620,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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user