Merge "add a log for notification alerts." into mnc-dev
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index c01d816..49d4c22 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -75,6 +75,8 @@
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 2d15d13..cd4f826 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 @@
}
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 @@
+ " with attributes " + audioAttributes);
player.playAsync(soundUri, record.sbn.getUser(), looping,
audioAttributes);
- buzzBeepBlinked = true;
+ beep = true;
}
} catch (RemoteException e) {
} finally {
@@ -2383,7 +2386,7 @@
: mFallbackVibrationPattern,
((notification.flags & Notification.FLAG_INSISTENT) != 0)
? 0: -1, audioAttributesForNotification(notification));
- buzzBeepBlinked = true;
+ buzz = true;
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -2394,7 +2397,7 @@
notification.vibrate,
((notification.flags & Notification.FLAG_INSISTENT) != 0)
? 0: -1, audioAttributesForNotification(notification));
- buzzBeepBlinked = true;
+ buzz = true;
}
}
}
@@ -2408,11 +2411,13 @@
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);
}
}