Loading core/java/android/view/InsetsController.java +11 −5 Original line number Diff line number Diff line Loading @@ -302,11 +302,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation public static final int ANIMATION_TYPE_NONE = -1; /** Running animation will show insets */ @VisibleForTesting public static final int ANIMATION_TYPE_SHOW = 0; /** Running animation will hide insets */ @VisibleForTesting public static final int ANIMATION_TYPE_HIDE = 1; /** Running animation is controlled by user via {@link #controlWindowInsetsAnimation} */ Loading Loading @@ -447,21 +445,21 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (mInputMethodJankContext == null) return; ImeTracker.forJank().onRequestAnimation( mInputMethodJankContext, mShow ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE, getAnimationType(), !mHasAnimationCallbacks); } @Override public void onAnimationCancel(Animator animation) { if (mInputMethodJankContext == null) return; ImeTracker.forJank().onCancelAnimation(); ImeTracker.forJank().onCancelAnimation(getAnimationType()); } @Override public void onAnimationEnd(Animator animation) { onAnimationFinish(); if (mInputMethodJankContext == null) return; ImeTracker.forJank().onFinishAnimation(); ImeTracker.forJank().onFinishAnimation(getAnimationType()); } }); if (!mHasAnimationCallbacks) { Loading Loading @@ -562,6 +560,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } } /** * Returns the current animation type. */ @AnimationType private int getAnimationType() { return mShow ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE; } } /** Loading core/java/android/view/inputmethod/ImeTracker.java +44 −10 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package android.view.inputmethod; import static android.view.InsetsController.ANIMATION_TYPE_HIDE; import static android.view.InsetsController.ANIMATION_TYPE_SHOW; import static com.android.internal.inputmethod.InputMethodDebug.softInputDisplayReasonToString; import static com.android.internal.jank.InteractionJankMonitor.CUJ_IME_INSETS_ANIMATION; import static com.android.internal.jank.InteractionJankMonitor.CUJ_IME_INSETS_HIDE_ANIMATION; import static com.android.internal.jank.InteractionJankMonitor.CUJ_IME_INSETS_SHOW_ANIMATION; import static com.android.internal.util.LatencyTracker.ACTION_REQUEST_IME_HIDDEN; import static com.android.internal.util.LatencyTracker.ACTION_REQUEST_IME_SHOWN; Loading Loading @@ -696,20 +700,22 @@ public interface ImeTracker { /** * Called when the animation, which is going to be monitored, starts. * * @param jankContext context which is needed by {@link InteractionJankMonitor} * @param animType {@link AnimationType} * @param jankContext context which is needed by {@link InteractionJankMonitor}. * @param animType the animation type. * @param useSeparatedThread {@code true} if the animation is handled by the app, * {@code false} if the animation will be scheduled on the * {@link android.view.InsetsAnimationThread} * {@link android.view.InsetsAnimationThread}. */ public void onRequestAnimation(@NonNull InputMethodJankContext jankContext, @AnimationType int animType, boolean useSeparatedThread) { final int cujType = getImeInsetsCujFromAnimation(animType); if (jankContext.getDisplayContext() == null || jankContext.getTargetSurfaceControl() == null) { || jankContext.getTargetSurfaceControl() == null || cujType == -1) { return; } final Configuration.Builder builder = Configuration.Builder.withSurface( CUJ_IME_INSETS_ANIMATION, cujType, jankContext.getDisplayContext(), jankContext.getTargetSurfaceControl()) .setTag(String.format(Locale.US, "%d@%d@%s", animType, Loading @@ -719,16 +725,44 @@ public interface ImeTracker { /** * Called when the animation, which is going to be monitored, cancels. * * @param animType the animation type. */ public void onCancelAnimation() { InteractionJankMonitor.getInstance().cancel(CUJ_IME_INSETS_ANIMATION); public void onCancelAnimation(@AnimationType int animType) { final int cujType = getImeInsetsCujFromAnimation(animType); if (cujType == -1) { InteractionJankMonitor.getInstance().cancel(cujType); } } /** * Called when the animation, which is going to be monitored, ends. * * @param animType the animation type. */ public void onFinishAnimation() { InteractionJankMonitor.getInstance().end(CUJ_IME_INSETS_ANIMATION); public void onFinishAnimation(@AnimationType int animType) { final int cujType = getImeInsetsCujFromAnimation(animType); if (cujType != -1) { InteractionJankMonitor.getInstance().end(cujType); } } /** * A helper method to translate animation type to CUJ type for IME animations. * * @param animType the animation type. * @return the integer in {@link com.android.internal.jank.InteractionJankMonitor.CujType}, * or {@code -1} if the animation type is not supported for tracking yet. */ private static int getImeInsetsCujFromAnimation(@AnimationType int animType) { switch (animType) { case ANIMATION_TYPE_SHOW: return CUJ_IME_INSETS_SHOW_ANIMATION; case ANIMATION_TYPE_HIDE: return CUJ_IME_INSETS_HIDE_ANIMATION; default: return -1; } } } Loading core/java/com/android/internal/jank/InteractionJankMonitor.java +14 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,8 @@ 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.FrameTracker.REASON_END_UNKNOWN; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__BIOMETRIC_PROMPT_TRANSITION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_ANIMATION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_HIDE_ANIMATION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_SHOW_ANIMATION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_ALL_APPS_SCROLL; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_CLOSE_TO_HOME; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK; Loading Loading @@ -257,7 +258,6 @@ public class InteractionJankMonitor { public static final int CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS = 66; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE = 67; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME = 68; public static final int CUJ_IME_INSETS_ANIMATION = 69; public static final int CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION = 70; public static final int CUJ_LAUNCHER_OPEN_SEARCH_RESULT = 71; // 72 - 77 are reserved for b/281564325. Loading @@ -269,8 +269,10 @@ public class InteractionJankMonitor { */ public static final int CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK = 78; public static final int CUJ_SHADE_EXPAND_FROM_STATUS_BAR = 79; public static final int CUJ_IME_INSETS_SHOW_ANIMATION = 80; public static final int CUJ_IME_INSETS_HIDE_ANIMATION = 81; private static final int LAST_CUJ = CUJ_SHADE_EXPAND_FROM_STATUS_BAR; private static final int LAST_CUJ = CUJ_IME_INSETS_HIDE_ANIMATION; private static final int NO_STATSD_LOGGING = -1; // Used to convert CujType to InteractionType enum value for statsd logging. Loading Loading @@ -348,7 +350,7 @@ public class InteractionJankMonitor { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_SWIPE_TO_RECENTS; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_SWIPE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_TO_HOME; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_IME_INSETS_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[69] = NO_STATSD_LOGGING; // This is deprecated. CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_CLOCK_MOVE_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_OPEN_SEARCH_RESULT] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_OPEN_SEARCH_RESULT; // 72 - 77 are reserved for b/281564325. Loading @@ -360,6 +362,8 @@ public class InteractionJankMonitor { CUJ_TO_STATSD_INTERACTION_TYPE[77] = NO_STATSD_LOGGING; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_SHADE_EXPAND_FROM_STATUS_BAR] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_EXPAND_FROM_STATUS_BAR; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_IME_INSETS_SHOW_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_SHOW_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_IME_INSETS_HIDE_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_HIDE_ANIMATION; } private static class InstanceHolder { Loading Loading @@ -456,11 +460,12 @@ public class InteractionJankMonitor { CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS, CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE, CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME, CUJ_IME_INSETS_ANIMATION, CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION, CUJ_LAUNCHER_OPEN_SEARCH_RESULT, CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK, CUJ_SHADE_EXPAND_FROM_STATUS_BAR, CUJ_IME_INSETS_SHOW_ANIMATION, CUJ_IME_INSETS_HIDE_ANIMATION, }) @Retention(RetentionPolicy.SOURCE) public @interface CujType { Loading Loading @@ -1066,8 +1071,6 @@ public class InteractionJankMonitor { return "LAUNCHER_CLOSE_ALL_APPS_SWIPE"; case CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME: return "LAUNCHER_CLOSE_ALL_APPS_TO_HOME"; case CUJ_IME_INSETS_ANIMATION: return "IME_INSETS_ANIMATION"; case CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION: return "LOCKSCREEN_CLOCK_MOVE_ANIMATION"; case CUJ_LAUNCHER_OPEN_SEARCH_RESULT: Loading @@ -1076,6 +1079,10 @@ public class InteractionJankMonitor { return "LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK"; case CUJ_SHADE_EXPAND_FROM_STATUS_BAR: return "SHADE_EXPAND_FROM_STATUS_BAR"; case CUJ_IME_INSETS_SHOW_ANIMATION: return "IME_INSETS_SHOW_ANIMATION"; case CUJ_IME_INSETS_HIDE_ANIMATION: return "IME_INSETS_HIDE_ANIMATION"; } return "UNKNOWN"; } Loading core/tests/coretests/src/com/android/internal/jank/InteractionJankMonitorTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ import org.mockito.ArgumentCaptor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; Loading @@ -93,6 +94,8 @@ public class InteractionJankMonitorTest { private static final String ENUM_NAME_PREFIX = "UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__"; private static final ArrayList<String> DEPRECATED_VALUES = new ArrayList<>(); private ViewAttachTestActivity mActivity; private View mView; private HandlerThread mWorker; Loading Loading @@ -126,6 +129,7 @@ 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")); DEPRECATED_VALUES.add(ENUM_NAME_PREFIX + "IME_INSETS_ANIMATION"); } private static String getEnumName(String name) { Loading Loading @@ -239,6 +243,7 @@ public class InteractionJankMonitorTest { Map<Integer, String> enumsMap = Arrays.stream(FrameworkStatsLog.class.getDeclaredFields()) .filter(f -> f.getName().startsWith(ENUM_NAME_PREFIX) && !DEPRECATED_VALUES.contains(f.getName()) && Modifier.isStatic(f.getModifiers()) && f.getType() == int.class) .collect(Collectors.toMap(this::getIntFieldChecked, Field::getName)); Loading Loading
core/java/android/view/InsetsController.java +11 −5 Original line number Diff line number Diff line Loading @@ -302,11 +302,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation public static final int ANIMATION_TYPE_NONE = -1; /** Running animation will show insets */ @VisibleForTesting public static final int ANIMATION_TYPE_SHOW = 0; /** Running animation will hide insets */ @VisibleForTesting public static final int ANIMATION_TYPE_HIDE = 1; /** Running animation is controlled by user via {@link #controlWindowInsetsAnimation} */ Loading Loading @@ -447,21 +445,21 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (mInputMethodJankContext == null) return; ImeTracker.forJank().onRequestAnimation( mInputMethodJankContext, mShow ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE, getAnimationType(), !mHasAnimationCallbacks); } @Override public void onAnimationCancel(Animator animation) { if (mInputMethodJankContext == null) return; ImeTracker.forJank().onCancelAnimation(); ImeTracker.forJank().onCancelAnimation(getAnimationType()); } @Override public void onAnimationEnd(Animator animation) { onAnimationFinish(); if (mInputMethodJankContext == null) return; ImeTracker.forJank().onFinishAnimation(); ImeTracker.forJank().onFinishAnimation(getAnimationType()); } }); if (!mHasAnimationCallbacks) { Loading Loading @@ -562,6 +560,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } } /** * Returns the current animation type. */ @AnimationType private int getAnimationType() { return mShow ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE; } } /** Loading
core/java/android/view/inputmethod/ImeTracker.java +44 −10 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package android.view.inputmethod; import static android.view.InsetsController.ANIMATION_TYPE_HIDE; import static android.view.InsetsController.ANIMATION_TYPE_SHOW; import static com.android.internal.inputmethod.InputMethodDebug.softInputDisplayReasonToString; import static com.android.internal.jank.InteractionJankMonitor.CUJ_IME_INSETS_ANIMATION; import static com.android.internal.jank.InteractionJankMonitor.CUJ_IME_INSETS_HIDE_ANIMATION; import static com.android.internal.jank.InteractionJankMonitor.CUJ_IME_INSETS_SHOW_ANIMATION; import static com.android.internal.util.LatencyTracker.ACTION_REQUEST_IME_HIDDEN; import static com.android.internal.util.LatencyTracker.ACTION_REQUEST_IME_SHOWN; Loading Loading @@ -696,20 +700,22 @@ public interface ImeTracker { /** * Called when the animation, which is going to be monitored, starts. * * @param jankContext context which is needed by {@link InteractionJankMonitor} * @param animType {@link AnimationType} * @param jankContext context which is needed by {@link InteractionJankMonitor}. * @param animType the animation type. * @param useSeparatedThread {@code true} if the animation is handled by the app, * {@code false} if the animation will be scheduled on the * {@link android.view.InsetsAnimationThread} * {@link android.view.InsetsAnimationThread}. */ public void onRequestAnimation(@NonNull InputMethodJankContext jankContext, @AnimationType int animType, boolean useSeparatedThread) { final int cujType = getImeInsetsCujFromAnimation(animType); if (jankContext.getDisplayContext() == null || jankContext.getTargetSurfaceControl() == null) { || jankContext.getTargetSurfaceControl() == null || cujType == -1) { return; } final Configuration.Builder builder = Configuration.Builder.withSurface( CUJ_IME_INSETS_ANIMATION, cujType, jankContext.getDisplayContext(), jankContext.getTargetSurfaceControl()) .setTag(String.format(Locale.US, "%d@%d@%s", animType, Loading @@ -719,16 +725,44 @@ public interface ImeTracker { /** * Called when the animation, which is going to be monitored, cancels. * * @param animType the animation type. */ public void onCancelAnimation() { InteractionJankMonitor.getInstance().cancel(CUJ_IME_INSETS_ANIMATION); public void onCancelAnimation(@AnimationType int animType) { final int cujType = getImeInsetsCujFromAnimation(animType); if (cujType == -1) { InteractionJankMonitor.getInstance().cancel(cujType); } } /** * Called when the animation, which is going to be monitored, ends. * * @param animType the animation type. */ public void onFinishAnimation() { InteractionJankMonitor.getInstance().end(CUJ_IME_INSETS_ANIMATION); public void onFinishAnimation(@AnimationType int animType) { final int cujType = getImeInsetsCujFromAnimation(animType); if (cujType != -1) { InteractionJankMonitor.getInstance().end(cujType); } } /** * A helper method to translate animation type to CUJ type for IME animations. * * @param animType the animation type. * @return the integer in {@link com.android.internal.jank.InteractionJankMonitor.CujType}, * or {@code -1} if the animation type is not supported for tracking yet. */ private static int getImeInsetsCujFromAnimation(@AnimationType int animType) { switch (animType) { case ANIMATION_TYPE_SHOW: return CUJ_IME_INSETS_SHOW_ANIMATION; case ANIMATION_TYPE_HIDE: return CUJ_IME_INSETS_HIDE_ANIMATION; default: return -1; } } } Loading
core/java/com/android/internal/jank/InteractionJankMonitor.java +14 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,8 @@ 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.FrameTracker.REASON_END_UNKNOWN; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__BIOMETRIC_PROMPT_TRANSITION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_ANIMATION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_HIDE_ANIMATION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_SHOW_ANIMATION; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_ALL_APPS_SCROLL; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_CLOSE_TO_HOME; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK; Loading Loading @@ -257,7 +258,6 @@ public class InteractionJankMonitor { public static final int CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS = 66; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE = 67; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME = 68; public static final int CUJ_IME_INSETS_ANIMATION = 69; public static final int CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION = 70; public static final int CUJ_LAUNCHER_OPEN_SEARCH_RESULT = 71; // 72 - 77 are reserved for b/281564325. Loading @@ -269,8 +269,10 @@ public class InteractionJankMonitor { */ public static final int CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK = 78; public static final int CUJ_SHADE_EXPAND_FROM_STATUS_BAR = 79; public static final int CUJ_IME_INSETS_SHOW_ANIMATION = 80; public static final int CUJ_IME_INSETS_HIDE_ANIMATION = 81; private static final int LAST_CUJ = CUJ_SHADE_EXPAND_FROM_STATUS_BAR; private static final int LAST_CUJ = CUJ_IME_INSETS_HIDE_ANIMATION; private static final int NO_STATSD_LOGGING = -1; // Used to convert CujType to InteractionType enum value for statsd logging. Loading Loading @@ -348,7 +350,7 @@ public class InteractionJankMonitor { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_SWIPE_TO_RECENTS; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_SWIPE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_TO_HOME; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_IME_INSETS_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[69] = NO_STATSD_LOGGING; // This is deprecated. CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_CLOCK_MOVE_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_OPEN_SEARCH_RESULT] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_OPEN_SEARCH_RESULT; // 72 - 77 are reserved for b/281564325. Loading @@ -360,6 +362,8 @@ public class InteractionJankMonitor { CUJ_TO_STATSD_INTERACTION_TYPE[77] = NO_STATSD_LOGGING; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_SHADE_EXPAND_FROM_STATUS_BAR] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_EXPAND_FROM_STATUS_BAR; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_IME_INSETS_SHOW_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_SHOW_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_IME_INSETS_HIDE_ANIMATION] = UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__IME_INSETS_HIDE_ANIMATION; } private static class InstanceHolder { Loading Loading @@ -456,11 +460,12 @@ public class InteractionJankMonitor { CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS, CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE, CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME, CUJ_IME_INSETS_ANIMATION, CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION, CUJ_LAUNCHER_OPEN_SEARCH_RESULT, CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK, CUJ_SHADE_EXPAND_FROM_STATUS_BAR, CUJ_IME_INSETS_SHOW_ANIMATION, CUJ_IME_INSETS_HIDE_ANIMATION, }) @Retention(RetentionPolicy.SOURCE) public @interface CujType { Loading Loading @@ -1066,8 +1071,6 @@ public class InteractionJankMonitor { return "LAUNCHER_CLOSE_ALL_APPS_SWIPE"; case CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME: return "LAUNCHER_CLOSE_ALL_APPS_TO_HOME"; case CUJ_IME_INSETS_ANIMATION: return "IME_INSETS_ANIMATION"; case CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION: return "LOCKSCREEN_CLOCK_MOVE_ANIMATION"; case CUJ_LAUNCHER_OPEN_SEARCH_RESULT: Loading @@ -1076,6 +1079,10 @@ public class InteractionJankMonitor { return "LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK"; case CUJ_SHADE_EXPAND_FROM_STATUS_BAR: return "SHADE_EXPAND_FROM_STATUS_BAR"; case CUJ_IME_INSETS_SHOW_ANIMATION: return "IME_INSETS_SHOW_ANIMATION"; case CUJ_IME_INSETS_HIDE_ANIMATION: return "IME_INSETS_HIDE_ANIMATION"; } return "UNKNOWN"; } Loading
core/tests/coretests/src/com/android/internal/jank/InteractionJankMonitorTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ import org.mockito.ArgumentCaptor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; Loading @@ -93,6 +94,8 @@ public class InteractionJankMonitorTest { private static final String ENUM_NAME_PREFIX = "UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__"; private static final ArrayList<String> DEPRECATED_VALUES = new ArrayList<>(); private ViewAttachTestActivity mActivity; private View mView; private HandlerThread mWorker; Loading Loading @@ -126,6 +129,7 @@ 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")); DEPRECATED_VALUES.add(ENUM_NAME_PREFIX + "IME_INSETS_ANIMATION"); } private static String getEnumName(String name) { Loading Loading @@ -239,6 +243,7 @@ public class InteractionJankMonitorTest { Map<Integer, String> enumsMap = Arrays.stream(FrameworkStatsLog.class.getDeclaredFields()) .filter(f -> f.getName().startsWith(ENUM_NAME_PREFIX) && !DEPRECATED_VALUES.contains(f.getName()) && Modifier.isStatic(f.getModifiers()) && f.getType() == int.class) .collect(Collectors.toMap(this::getIntFieldChecked, Field::getName)); Loading