summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Wren <cwren@android.com> 2015-06-05 11:23:44 -0400
committer Chris Wren <cwren@android.com> 2015-06-05 13:49:59 -0400
commit82ba59de0ea32cdfa1423823bce7fa20c878cd02 (patch)
treef4dadf9de947a258fac8b0496cbef20b7fcb87c4
parentc92550e4b44da843a530dcde0ed26f221d3df0fc (diff)
add a log for notification alerts.
Bug: 21242827 Change-Id: I1b8beee5cc12a9cd23e81554f7f2236ddc29e2b6
-rw-r--r--services/core/java/com/android/server/EventLogTags.logtags2
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java17
2 files changed, 13 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index c01d81680750..49d4c221397d 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -75,6 +75,8 @@ option java_package com.android.server
27530 notification_canceled (key|3),(reason|1),(lifespan|1),(freshness|1),(exposure|1)
# replaces 27510 with a row per notification
27531 notification_visibility (key|3),(visibile|1),(lifespan|1),(freshness|1)
+# a notification emited noise, vibration, or light
+27532 notification_alert (key|3),(buzz|1),(beep|1),(blink|1)
# ---------------------------
# Watchdog.java
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 2d15d1369721..cd4f82619b33 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2261,7 +2261,10 @@ public class NotificationManagerService extends SystemService {
}
private void buzzBeepBlinkLocked(NotificationRecord record) {
- boolean buzzBeepBlinked = false;
+ boolean buzz = false;
+ boolean beep = false;
+ boolean blink = false;
+
final Notification notification = record.sbn.getNotification();
// Should this notification make noise, vibe, or use the LED?
@@ -2343,7 +2346,7 @@ public class NotificationManagerService extends SystemService {
+ " with attributes " + audioAttributes);
player.playAsync(soundUri, record.sbn.getUser(), looping,
audioAttributes);
- buzzBeepBlinked = true;
+ beep = true;
}
} catch (RemoteException e) {
} finally {
@@ -2383,7 +2386,7 @@ public class NotificationManagerService extends SystemService {
: mFallbackVibrationPattern,
((notification.flags & Notification.FLAG_INSISTENT) != 0)
? 0: -1, audioAttributesForNotification(notification));
- buzzBeepBlinked = true;
+ buzz = true;
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -2394,7 +2397,7 @@ public class NotificationManagerService extends SystemService {
notification.vibrate,
((notification.flags & Notification.FLAG_INSISTENT) != 0)
? 0: -1, audioAttributesForNotification(notification));
- buzzBeepBlinked = true;
+ buzz = true;
}
}
}
@@ -2408,11 +2411,13 @@ public class NotificationManagerService extends SystemService {
if (mUseAttentionLight) {
mAttentionLight.pulse();
}
- buzzBeepBlinked = true;
+ blink = true;
} else if (wasShowLights) {
updateLightsLocked();
}
- if (buzzBeepBlinked) {
+ if (buzz || beep || blink) {
+ EventLogTags.writeNotificationAlert(record.getKey(),
+ buzz ? 1 : 0, beep ? 1 : 0, blink ? 1 : 0);
mHandler.post(mBuzzBeepBlinked);
}
}