summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wu Ahan <ahanwu@google.com> 2020-11-12 02:36:09 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-11-12 02:36:09 +0000
commit88dd4d99f6a7c836d3232b6c4a27d6a51a461e39 (patch)
tree06f68883093ebddee975b4785c8769d8b10f3a5c
parent4ae37befa974bd0b4d2f4bbefd8decfbe4e2e5b8 (diff)
parent72d5d080a22d1edc55df3f44404cbfb66348c784 (diff)
Merge "Support translation between interaction type and cuj type"
-rw-r--r--core/java/com/android/internal/jank/InteractionJankMonitor.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/core/java/com/android/internal/jank/InteractionJankMonitor.java b/core/java/com/android/internal/jank/InteractionJankMonitor.java
index 137430b7de14..bb7e2af2db6b 100644
--- a/core/java/com/android/internal/jank/InteractionJankMonitor.java
+++ b/core/java/com/android/internal/jank/InteractionJankMonitor.java
@@ -348,6 +348,57 @@ public class InteractionJankMonitor {
}
/**
+ * A helper method to translate interaction type to CUJ name.
+ *
+ * @param interactionType the interaction type defined in AtomsProto.java
+ * @return the name of the interaction type
+ */
+ public static String getNameOfInteraction(int interactionType) {
+ // There is an offset amount of 1 between cujType and interactionType.
+ return getNameOfCuj(interactionType - 1);
+ }
+
+ private static String getNameOfCuj(int cujType) {
+ switch (cujType) {
+ case CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE:
+ return "SHADE_EXPAND_COLLAPSE";
+ case CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE_LOCK:
+ return "SHADE_EXPAND_COLLAPSE_LOCK";
+ case CUJ_NOTIFICATION_SHADE_SCROLL_FLING:
+ return "SHADE_SCROLL_FLING";
+ case CUJ_NOTIFICATION_SHADE_ROW_EXPAND:
+ return "SHADE_ROW_EXPAND";
+ case CUJ_NOTIFICATION_SHADE_ROW_SWIPE:
+ return "SHADE_ROW_SWIPE";
+ case CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE:
+ return "SHADE_QS_EXPAND_COLLAPSE";
+ case CUJ_NOTIFICATION_SHADE_QS_SCROLL_SWIPE:
+ return "SHADE_QS_SCROLL_SWIPE";
+ case CUJ_LAUNCHER_APP_LAUNCH_FROM_RECENTS:
+ return "LAUNCHER_APP_LAUNCH_FROM_RECENTS";
+ case CUJ_LAUNCHER_APP_LAUNCH_FROM_ICON:
+ return "LAUNCHER_APP_LAUNCH_FROM_ICON";
+ case CUJ_LAUNCHER_APP_CLOSE_TO_HOME:
+ return "LAUNCHER_APP_CLOSE_TO_HOME";
+ case CUJ_LAUNCHER_APP_CLOSE_TO_PIP:
+ return "LAUNCHER_APP_CLOSE_TO_PIP";
+ case CUJ_LAUNCHER_QUICK_SWITCH:
+ return "LAUNCHER_QUICK_SWITCH";
+ case CUJ_NOTIFICATION_HEADS_UP_APPEAR:
+ return "NOTIFICATION_HEADS_UP_APPEAR";
+ case CUJ_NOTIFICATION_HEADS_UP_DISAPPEAR:
+ return "NOTIFICATION_HEADS_UP_DISAPPEAR";
+ case CUJ_NOTIFICATION_ADD:
+ return "NOTIFICATION_ADD";
+ case CUJ_NOTIFICATION_REMOVE:
+ return "NOTIFICATION_REMOVE";
+ case CUJ_NOTIFICATION_APP_START:
+ return "NOTIFICATION_APP_START";
+ }
+ return "UNKNOWN";
+ }
+
+ /**
* A class to represent a session.
*/
public static class Session {