From 6abeeb91194818e1d19f75336b03d1e305af0842 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Thu, 26 May 2016 14:44:38 -0400 Subject: [PATCH] add metrics for gestural notification expansions Bug: 28146482 Change-Id: If202846c0d235830c7b41d76b55bdcc21d0ab90d --- .../com/android/systemui/statusbar/ExpandableNotificationRow.java | 8 ++++++++ .../src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 6 ++++++ .../systemui/statusbar/stack/NotificationStackScrollLayout.java | 6 ++++-- proto/src/metrics_constants.proto | 6 ++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 6f6b02def040..88c150301cff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -1491,6 +1491,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mLoggingKey = key; } + public void onExpandedByGesture(boolean userExpanded) { + int event = MetricsEvent.ACTION_NOTIFICATION_GESTURE_EXPANDER; + if (mGroupManager.isSummaryOfGroup(getStatusBarNotification())) { + event = MetricsEvent.ACTION_NOTIFICATION_GROUP_GESTURE_EXPANDER; + } + MetricsLogger.action(mContext, event, userExpanded); + } + @Override public float getIncreasedPaddingAmount() { if (mIsSummaryWithChildren) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 31fa3bf92ade..92081340768a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -4339,6 +4339,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // ---------------------- DragDownHelper.OnDragDownListener ------------------------------------ + + /* Only ever called as a consequence of a lockscreen expansion gesture. */ @Override public boolean onDraggedDown(View startingChild, int dragLengthY) { if (hasActiveNotifications()) { @@ -4349,6 +4351,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // We have notifications, go to locked shade. goToLockedShade(startingChild); + if (startingChild instanceof ExpandableNotificationRow) { + ExpandableNotificationRow row = (ExpandableNotificationRow) startingChild; + row.onExpandedByGesture(true /* drag down is always an open */); + } return true; } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 19f407492e1f..cab25340562c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -959,11 +959,13 @@ public class NotificationStackScrollLayout extends ViewGroup && (mIsExpanded || !((ExpandableNotificationRow) v).isPinned()); } + /* Only ever called as a consequence of an expansion gesture in the shade. */ @Override public void setUserExpandedChild(View v, boolean userExpanded) { if (v instanceof ExpandableNotificationRow) { - ((ExpandableNotificationRow) v).setUserExpanded(userExpanded, - true /* allowChildrenExpansion */); + ExpandableNotificationRow row = (ExpandableNotificationRow) v; + row.setUserExpanded(userExpanded, true /* allowChildrenExpansion */); + row.onExpandedByGesture(userExpanded); } } diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index f8cdf9b3a736..a1487e368706 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -2212,6 +2212,12 @@ message MetricsEvent { // Notification group expansion state toggled by the expand affordance. ACTION_NOTIFICATION_GROUP_EXPANDER = 408; + // Notification expansion state toggled by the expand gesture. + ACTION_NOTIFICATION_GESTURE_EXPANDER = 409; + + // Notification group expansion state toggled by the expand gesture. + ACTION_NOTIFICATION_GROUP_GESTURE_EXPANDER = 410; + // Add new aosp constants above this line. // END OF AOSP CONSTANTS } -- 2.11.0