Merge "Sorting and intrusiveness updates" into oc-dev
am: abfa176b45
Change-Id: I238c7b739ed7bf359804e9488cf13c27fbb21d2c
This commit is contained in:
@@ -73,11 +73,13 @@ public class NotificationComparator
|
||||
// Next: sufficiently import person to person communication
|
||||
boolean leftPeople = isImportantPeople(left);
|
||||
boolean rightPeople = isImportantPeople(right);
|
||||
final int contactAffinityComparison =
|
||||
Float.compare(left.getContactAffinity(), right.getContactAffinity());
|
||||
|
||||
if (leftPeople && rightPeople){
|
||||
// by contact proximity, close to far. if same proximity, check further fields.
|
||||
if (Float.compare(left.getContactAffinity(), right.getContactAffinity()) != 0) {
|
||||
return -1 * Float.compare(left.getContactAffinity(), right.getContactAffinity());
|
||||
if (contactAffinityComparison != 0) {
|
||||
return -1 * contactAffinityComparison;
|
||||
}
|
||||
} else if (leftPeople != rightPeople) {
|
||||
// People, messaging higher than non-messaging
|
||||
@@ -91,6 +93,11 @@ public class NotificationComparator
|
||||
return -1 * Integer.compare(leftImportance, rightImportance);
|
||||
}
|
||||
|
||||
// by contact proximity, close to far. if same proximity, check further fields.
|
||||
if (contactAffinityComparison != 0) {
|
||||
return -1 * contactAffinityComparison;
|
||||
}
|
||||
|
||||
// Whether or not the notification can bypass DND.
|
||||
final int leftPackagePriority = left.getPackagePriority();
|
||||
final int rightPackagePriority = right.getPackagePriority();
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.server.notification;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.service.notification.NotificationListenerService;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
@@ -46,12 +47,13 @@ public class NotificationIntrusivenessExtractor implements NotificationSignalExt
|
||||
}
|
||||
|
||||
if (record.getImportance() >= NotificationManager.IMPORTANCE_DEFAULT) {
|
||||
final Notification notification = record.getNotification();
|
||||
if ((notification.defaults & Notification.DEFAULT_VIBRATE) != 0 ||
|
||||
notification.vibrate != null ||
|
||||
(notification.defaults & Notification.DEFAULT_SOUND) != 0 ||
|
||||
notification.sound != null ||
|
||||
notification.fullScreenIntent != null) {
|
||||
if (record.getSound() != null && record.getSound() != Uri.EMPTY) {
|
||||
record.setRecentlyIntrusive(true);
|
||||
}
|
||||
if (record.getVibration() != null) {
|
||||
record.setRecentlyIntrusive(true);
|
||||
}
|
||||
if (record.getNotification().fullScreenIntent != null) {
|
||||
record.setRecentlyIntrusive(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user