summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ahan Wu <ahanwu@google.com> 2022-12-13 12:03:04 +0000
committer Ahan Wu <ahanwu@google.com> 2022-12-13 12:03:04 +0000
commit6ee0642fa433ae09d85f7fbb46f7781de4ececef (patch)
tree674887143d563c671200b74d905036b2919cadb3
parent2445d0816bb6bb06c1e8e66b10a02f7d874978e6 (diff)
Remove the exceptions of the return values of getNameOfCuj()
This CL aligns the results of getNameOfCuj() with the enum names, this would help keep the APC pipeline code simpler. bug: 261987639 Test: atest InteractionJankMonitorTest Change-Id: I69bfbbb197178badf7d14a5fb50f56ecaa663bb1
-rw-r--r--core/java/com/android/internal/jank/InteractionJankMonitor.java16
-rw-r--r--core/tests/coretests/src/com/android/internal/jank/InteractionJankMonitorTest.java26
2 files changed, 11 insertions, 31 deletions
diff --git a/core/java/com/android/internal/jank/InteractionJankMonitor.java b/core/java/com/android/internal/jank/InteractionJankMonitor.java
index 75f0bf574947..7bd6ec8f0f2c 100644
--- a/core/java/com/android/internal/jank/InteractionJankMonitor.java
+++ b/core/java/com/android/internal/jank/InteractionJankMonitor.java
@@ -780,17 +780,17 @@ public class InteractionJankMonitor {
// 2. The returned string should be the same with the name defined in atoms.proto.
switch (cujType) {
case CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE:
- return "SHADE_EXPAND_COLLAPSE";
+ return "NOTIFICATION_SHADE_EXPAND_COLLAPSE";
case CUJ_NOTIFICATION_SHADE_SCROLL_FLING:
- return "SHADE_SCROLL_FLING";
+ return "NOTIFICATION_SHADE_SCROLL_FLING";
case CUJ_NOTIFICATION_SHADE_ROW_EXPAND:
- return "SHADE_ROW_EXPAND";
+ return "NOTIFICATION_SHADE_ROW_EXPAND";
case CUJ_NOTIFICATION_SHADE_ROW_SWIPE:
- return "SHADE_ROW_SWIPE";
+ return "NOTIFICATION_SHADE_ROW_SWIPE";
case CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE:
- return "SHADE_QS_EXPAND_COLLAPSE";
+ return "NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE";
case CUJ_NOTIFICATION_SHADE_QS_SCROLL_SWIPE:
- return "SHADE_QS_SCROLL_SWIPE";
+ return "NOTIFICATION_SHADE_QS_SCROLL_SWIPE";
case CUJ_LAUNCHER_APP_LAUNCH_FROM_RECENTS:
return "LAUNCHER_APP_LAUNCH_FROM_RECENTS";
case CUJ_LAUNCHER_APP_LAUNCH_FROM_ICON:
@@ -880,9 +880,9 @@ public class InteractionJankMonitor {
case CUJ_SPLIT_SCREEN_EXIT:
return "SPLIT_SCREEN_EXIT";
case CUJ_LOCKSCREEN_LAUNCH_CAMERA:
- return "CUJ_LOCKSCREEN_LAUNCH_CAMERA";
+ return "LOCKSCREEN_LAUNCH_CAMERA";
case CUJ_SPLIT_SCREEN_RESIZE:
- return "CUJ_SPLIT_SCREEN_RESIZE";
+ return "SPLIT_SCREEN_RESIZE";
case CUJ_SETTINGS_SLIDER:
return "SETTINGS_SLIDER";
case CUJ_TAKE_SCREENSHOT:
diff --git a/core/tests/coretests/src/com/android/internal/jank/InteractionJankMonitorTest.java b/core/tests/coretests/src/com/android/internal/jank/InteractionJankMonitorTest.java
index 7674135719e9..8f83461baea7 100644
--- a/core/tests/coretests/src/com/android/internal/jank/InteractionJankMonitorTest.java
+++ b/core/tests/coretests/src/com/android/internal/jank/InteractionJankMonitorTest.java
@@ -20,7 +20,6 @@ import static android.text.TextUtils.formatSimple;
import static com.android.internal.jank.FrameTracker.REASON_CANCEL_TIMEOUT;
import static com.android.internal.jank.FrameTracker.REASON_END_NORMAL;
-import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_LAUNCH_CAMERA;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_ADD;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_APP_START;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_HEADS_UP_APPEAR;
@@ -32,7 +31,6 @@ import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_ROW_EXPAND;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_ROW_SWIPE;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_SCROLL_FLING;
-import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_TO_STATSD_INTERACTION_TYPE;
import static com.android.internal.jank.InteractionJankMonitor.MAX_LENGTH_OF_CUJ_NAME;
import static com.android.internal.jank.InteractionJankMonitor.getNameOfCuj;
@@ -92,7 +90,6 @@ import java.util.stream.Collectors;
public class InteractionJankMonitorTest {
private static final String CUJ_POSTFIX = "";
private static final SparseArray<String> ENUM_NAME_EXCEPTION_MAP = new SparseArray<>();
- private static final SparseArray<String> CUJ_NAME_EXCEPTION_MAP = new SparseArray<>();
private static final String ENUM_NAME_PREFIX =
"UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__";
@@ -129,22 +126,6 @@ public class InteractionJankMonitorTest {
CUJ_NOTIFICATION_SHADE_ROW_SWIPE, getEnumName("SHADE_ROW_SWIPE"));
ENUM_NAME_EXCEPTION_MAP.put(
CUJ_NOTIFICATION_SHADE_SCROLL_FLING, getEnumName("SHADE_SCROLL_FLING"));
-
- CUJ_NAME_EXCEPTION_MAP.put(
- CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE, "CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE");
- CUJ_NAME_EXCEPTION_MAP.put(
- CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE,
- "CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE");
- CUJ_NAME_EXCEPTION_MAP.put(
- CUJ_NOTIFICATION_SHADE_QS_SCROLL_SWIPE, "CUJ_NOTIFICATION_SHADE_QS_SCROLL_SWIPE");
- CUJ_NAME_EXCEPTION_MAP.put(
- CUJ_NOTIFICATION_SHADE_ROW_EXPAND, "CUJ_NOTIFICATION_SHADE_ROW_EXPAND");
- CUJ_NAME_EXCEPTION_MAP.put(
- CUJ_NOTIFICATION_SHADE_ROW_SWIPE, "CUJ_NOTIFICATION_SHADE_ROW_SWIPE");
- CUJ_NAME_EXCEPTION_MAP.put(
- CUJ_NOTIFICATION_SHADE_SCROLL_FLING, "CUJ_NOTIFICATION_SHADE_SCROLL_FLING");
- CUJ_NAME_EXCEPTION_MAP.put(CUJ_LOCKSCREEN_LAUNCH_CAMERA, "CUJ_LOCKSCREEN_LAUNCH_CAMERA");
- CUJ_NAME_EXCEPTION_MAP.put(CUJ_SPLIT_SCREEN_RESIZE, "CUJ_SPLIT_SCREEN_RESIZE");
}
private static String getEnumName(String name) {
@@ -272,9 +253,8 @@ public class InteractionJankMonitorTest {
: formatSimple("%s%s", ENUM_NAME_PREFIX, cujName.substring(4));
final int enumKey = CUJ_TO_STATSD_INTERACTION_TYPE[cuj];
final String enumName = enumsMap.get(enumKey);
- final String expectedNameOfCuj = CUJ_NAME_EXCEPTION_MAP.contains(cuj)
- ? CUJ_NAME_EXCEPTION_MAP.get(cuj)
- : formatSimple("CUJ_%s", getNameOfCuj(cuj));
+ final String expectedNameOfCuj = formatSimple("CUJ_%s", getNameOfCuj(cuj));
+
mExpect
.withMessage(formatSimple(
"%s (%d) not matches %s (%d)", cujName, cuj, enumName, enumKey))
@@ -323,7 +303,7 @@ public class InteractionJankMonitorTest {
// Since the length of the cuj name is tested in another test, no need to test it here.
// Too long postfix case, should trim the postfix and keep the cuj name completed.
final String expectedTrimmedName = formatSimple("J<%s::%s>", cujName,
- "ThisIsTheCujTagThisIsTheCujTagThisIsTheCujTagThisIsTheCujTagThisIsTheCujTagT...");
+ "ThisIsTheCujTagThisIsTheCujTagThisIsTheCujTagThisIsTheCujTagThi...");
Session longPostfix = new Session(cujType, tooLongTag);
assertThat(longPostfix.getName()).isEqualTo(expectedTrimmedName);
}