From f7342718c0deda6f65e23df3c6a1f933ebd8afe9 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Thu, 14 Sep 2017 10:55:55 -0400 Subject: [PATCH] also log user-initiated notification collapse events Bug: 62787514 Test: runtest systemui-notification Change-Id: I8e7e3bad5d2d5bbd0cebe2c5927e83b4ead4db1c --- proto/src/metrics_constants.proto | 5 ++++- .../server/notification/NotificationManagerService.java | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index 324f117e07b07..7672e55bf4774 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -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 diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 79a8dd87ad480..fac498cceb476 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -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,