summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-12-04 14:51:50 -0500
committerDaniel Sandler <dsandler@android.com>2012-12-04 17:01:12 -0500
commit526fa0e6d5cfe6ca3f390982c169b43fcb7d6f78 (patch)
treeb04e69e730419c7f3d5a375c271c9c13b70aa004 /services
parente0a676a3bb0e7b9aced9359a021e4c5d2ffef752 (diff)
downloadframeworks_base-526fa0e6d5cfe6ca3f390982c169b43fcb7d6f78.zip
frameworks_base-526fa0e6d5cfe6ca3f390982c169b43fcb7d6f78.tar.gz
frameworks_base-526fa0e6d5cfe6ca3f390982c169b43fcb7d6f78.tar.bz2
PRIORITY_MIN notifications should be truly ambient.
If your notification is set to MIN priority, it will never attempt to interrupt the user, either by an icon (already implemented), or (new in this patch) by LED, vibration, or sound. Bug: 7648785 Change-Id: Ia0f8e010e62029d8d8ef1955dd20b7c79fb68398
Diffstat (limited to 'services')
-rwxr-xr-xservices/java/com/android/server/NotificationManagerService.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index e2be577..37d7ce7 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -110,6 +110,11 @@ public class NotificationManagerService extends INotificationManager.Stub
private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10;
private static final int SCORE_DISPLAY_THRESHOLD = Notification.PRIORITY_MIN * NOTIFICATION_PRIORITY_MULTIPLIER;
+ // Notifications with scores below this will not interrupt the user, either via LED or
+ // sound or vibration
+ private static final int SCORE_INTERRUPTION_THRESHOLD =
+ Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
+
private static final boolean ENABLE_BLOCKED_NOTIFICATIONS = true;
private static final boolean ENABLE_BLOCKED_TOASTS = true;
@@ -991,6 +996,9 @@ public class NotificationManagerService extends INotificationManager.Stub
return;
}
+ // Should this notification make noise, vibe, or use the LED?
+ final boolean canInterrupt = (score >= SCORE_INTERRUPTION_THRESHOLD);
+
synchronized (mNotificationList) {
NotificationRecord r = new NotificationRecord(pkg, tag, id,
callingUid, callingPid, userId,
@@ -1042,7 +1050,8 @@ public class NotificationManagerService extends INotificationManager.Stub
long identity = Binder.clearCallingIdentity();
try {
r.statusBarKey = mStatusBar.addNotification(n);
- if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
+ if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0
+ && canInterrupt) {
mAttentionLight.pulse();
}
}
@@ -1073,6 +1082,7 @@ public class NotificationManagerService extends INotificationManager.Stub
&& (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 ))
&& (r.userId == UserHandle.USER_ALL ||
(r.userId == userId && r.userId == currentUser))
+ && canInterrupt
&& mSystemReady) {
final AudioManager audioManager = (AudioManager) mContext
@@ -1171,7 +1181,8 @@ public class NotificationManagerService extends INotificationManager.Stub
}
//Slog.i(TAG, "notification.lights="
// + ((old.notification.lights.flags & Notification.FLAG_SHOW_LIGHTS) != 0));
- if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
+ if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0
+ && canInterrupt) {
mLights.add(r);
updateLightsLocked();
} else {