From 03e80d715b77085c7f9623eeffc3014678d37c28 Mon Sep 17 00:00:00 2001 From: lbill Date: Thu, 14 Jul 2022 07:41:10 +0000 Subject: [PATCH] Instrument CUJ_SHADE_CLEAR_ALL with InteractionJankMonitor In NotificationStackScrollLayout - Begin instrument in clearNotifications() - End in onClearAllAnimationsEnd() Note: due to all child views run clear anim concurrently, we just monitor parent(NSSL). Bug: 238863970 Test: atest SystemUITests Test: make and get perfetto trace Change-Id: I705d03357a5a458a7f9eae5ecc5c4cfd7811cf7c --- .../com/android/internal/jank/InteractionJankMonitor.java | 8 +++++++- .../notification/stack/NotificationStackScrollLayout.java | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/java/com/android/internal/jank/InteractionJankMonitor.java b/core/java/com/android/internal/jank/InteractionJankMonitor.java index 22340c6b0c55e..2d669ab584734 100644 --- a/core/java/com/android/internal/jank/InteractionJankMonitor.java +++ b/core/java/com/android/internal/jank/InteractionJankMonitor.java @@ -53,6 +53,7 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_APP_LAUNCH_FROM_QS_TILE; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_APP_LAUNCH_FROM_SETTINGS_BUTTON; +import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_CLEAR_ALL; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_DIALOG_OPEN; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_EXPAND_COLLAPSE_LOCK; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_HEADS_UP_APPEAR; @@ -210,6 +211,7 @@ public class InteractionJankMonitor { public static final int CUJ_USER_DIALOG_OPEN = 59; public static final int CUJ_TASKBAR_EXPAND = 60; public static final int CUJ_TASKBAR_COLLAPSE = 61; + public static final int CUJ_SHADE_CLEAR_ALL = 62; private static final int NO_STATSD_LOGGING = -1; @@ -280,6 +282,7 @@ public class InteractionJankMonitor { UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__USER_DIALOG_OPEN, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__TASKBAR_EXPAND, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__TASKBAR_COLLAPSE, + UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_CLEAR_ALL, }; private static volatile InteractionJankMonitor sInstance; @@ -361,7 +364,8 @@ public class InteractionJankMonitor { CUJ_SHADE_DIALOG_OPEN, CUJ_USER_DIALOG_OPEN, CUJ_TASKBAR_EXPAND, - CUJ_TASKBAR_COLLAPSE + CUJ_TASKBAR_COLLAPSE, + CUJ_SHADE_CLEAR_ALL }) @Retention(RetentionPolicy.SOURCE) public @interface CujType { @@ -804,6 +808,8 @@ public class InteractionJankMonitor { return "TASKBAR_EXPAND"; case CUJ_TASKBAR_COLLAPSE: return "TASKBAR_COLLAPSE"; + case CUJ_SHADE_CLEAR_ALL: + return "SHADE_CLEAR_ALL"; } return "UNKNOWN"; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 2fd02d9f1cd97..defae5b6941f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.stack; import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_SCROLL_FLING; +import static com.android.internal.jank.InteractionJankMonitor.CUJ_SHADE_CLEAR_ALL; import static com.android.systemui.statusbar.notification.stack.NotificationPriorityBucketKt.BUCKET_SILENT; import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_SWIPE; import static com.android.systemui.util.DumpUtilsKt.println; @@ -5246,6 +5247,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable setClearAllInProgress(true); mShadeNeedsToClose = closeShade; + InteractionJankMonitor.getInstance().begin(this, CUJ_SHADE_CLEAR_ALL); // Decrease the delay for every row we animate to give the sense of // accelerating the swipes final int rowDelayDecrement = 5; @@ -6158,6 +6160,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private void onClearAllAnimationsEnd( List viewsToRemove, @SelectedRows int selectedRows) { + InteractionJankMonitor.getInstance().end(CUJ_SHADE_CLEAR_ALL); if (mClearAllAnimationListener != null) { mClearAllAnimationListener.onAnimationEnd(viewsToRemove, selectedRows); }