Merge "also log user-initiated notification collapse events" into oc-mr1-dev

This commit is contained in:
Chris Wren
2017-09-14 19:55:32 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ message MetricsEvent {
// The view became hidden.
TYPE_CLOSE = 2;
// The view switched to detail mode (most relevant for quick settings tiles)
// The view switched to detail mode (most relevant for quick settings tiles and notifications)
TYPE_DETAIL = 3;
// The view or control was activated.
@@ -70,6 +70,9 @@ message MetricsEvent {
// Type for APP_TRANSITION_REPORTED_DRAWN event: The activity was started with restoring from
// a bundle.
TYPE_TRANSITION_REPORTED_DRAWN_WITH_BUNDLE = 13;
// The view switched to summary mode (most relevant for notifications)
TYPE_COLLAPSE = 14;
}
// Types of alerts, as bit field values

View File

@@ -756,10 +756,11 @@ public class NotificationManagerService extends SystemService {
if (r != null) {
r.stats.onExpansionChanged(userAction, expanded);
final long now = System.currentTimeMillis();
if (userAction && expanded) {
if (userAction) {
MetricsLogger.action(r.getLogMaker(now)
.setCategory(MetricsEvent.NOTIFICATION_ITEM)
.setType(MetricsEvent.TYPE_DETAIL));
.setType(expanded ? MetricsEvent.TYPE_DETAIL
: MetricsEvent.TYPE_COLLAPSE));
}
EventLogTags.writeNotificationExpansion(key,
userAction ? 1 : 0, expanded ? 1 : 0,