From 2ea942b813683f85821ad78d8f2275b8fa17114e Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 21 Jul 2023 23:21:55 +0000 Subject: [PATCH] Add jank monitor for CUJ_QUICK_SWITCH from home screen Flag: None Test: adb logcat -b events | grep jank_cuj_events - Verified quick switch from home gets begin and end - Verified quick switch then swipe back or up to home gets begin and cancel - Verified quick switch then swipe up to overview gets begin and cancel Fixes: 290323639 Change-Id: I4f1991251b111c0531b30c48ba610ce85dcafdd3 --- .../NoButtonQuickSwitchTouchController.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index d3ef58936e..6f421eb14a 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -16,7 +16,6 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static android.view.MotionEvent.ACTION_DOWN; -import static android.view.MotionEvent.ACTION_MOVE; import static com.android.app.animation.Interpolators.ACCELERATE_0_75; import static com.android.app.animation.Interpolators.DECELERATE_3; @@ -87,6 +86,7 @@ import com.android.quickstep.util.WorkspaceRevealAnim; import com.android.quickstep.views.DesktopTaskView; import com.android.quickstep.views.LauncherRecentsView; import com.android.quickstep.views.RecentsView; +import com.android.systemui.shared.system.InteractionJankMonitorWrapper; /** * Handles quick switching to a recent task from the home screen. To give as much flexibility to @@ -191,6 +191,9 @@ public class NoButtonQuickSwitchTouchController implements TouchController, public void onDragStart(boolean start) { mMotionPauseDetector.clear(); if (start) { + InteractionJankMonitorWrapper.begin(mRecentsView, + InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); + mStartState = mLauncher.getStateManager().getState(); mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseDetected); @@ -325,6 +328,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, if (mMotionPauseDetector.isPaused() && noFling) { // Going to Overview. cancelAnimations(); + InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); StateAnimationConfig config = new StateAnimationConfig(); config.duration = ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW; @@ -441,6 +445,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController, RecentsView.SCROLL_VIBRATION_PRIMITIVE, RecentsView.SCROLL_VIBRATION_PRIMITIVE_SCALE, RecentsView.SCROLL_VIBRATION_FALLBACK); + } else { + InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); } nonOverviewAnim.setDuration(Math.max(xDuration, yDuration)); @@ -462,6 +468,11 @@ public class NoButtonQuickSwitchTouchController implements TouchController, : targetState.ordinal > mStartState.ordinal ? LAUNCHER_UNKNOWN_SWIPEUP : LAUNCHER_UNKNOWN_SWIPEDOWN)); + + if (targetState == QUICK_SWITCH_FROM_HOME) { + InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); + } + mLauncher.getStateManager().goToState(targetState, false, forEndCallback(this::clearState)); }