OSDN Git Service

Only noisy notifications can be bumped for intrusiveness.
authorJulia Reynolds <juliacr@google.com>
Thu, 3 Mar 2016 20:10:21 +0000 (15:10 -0500)
committerJulia Reynolds <juliacr@google.com>
Thu, 3 Mar 2016 20:49:40 +0000 (15:49 -0500)
Bug: 27431139
Change-Id: I5a1d2e2ac33bb9db04df2b6eea7d0baec2552c36

services/core/java/com/android/server/notification/NotificationIntrusivenessExtractor.java

index b57cc75..bcdeb66 100644 (file)
@@ -23,7 +23,7 @@ import android.util.Log;
 import android.util.Slog;
 
 /**
- * This {@link com.android.server.notification.NotificationSignalExtractor} noticies noisy
+ * This {@link com.android.server.notification.NotificationSignalExtractor} notices noisy
  * notifications and marks them to get a temporary ranking bump.
  */
 public class NotificationIntrusivenessExtractor implements NotificationSignalExtractor {
@@ -44,9 +44,15 @@ public class NotificationIntrusivenessExtractor implements NotificationSignalExt
             return null;
         }
 
-        final Notification notification = record.getNotification();
-        if (record.getImportance() > NotificationListenerService.Ranking.IMPORTANCE_DEFAULT) {
-            record.setRecentlyIntrusive(true);
+        if (record.getImportance() >= NotificationListenerService.Ranking.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) {
+                record.setRecentlyIntrusive(true);
+            }
         }
 
         return new RankingReconsideration(record.getKey(), HANG_TIME_MS) {