From a70e23384f75968c9a0ff654b24e5cb254c2cbeb Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 5 May 2022 13:59:27 +0100 Subject: [PATCH] Fix overview and quickswitch gesture logging - Log Home -> Overview gesture - Log Home -> quickswitch as LAUNCHER_QUICKSWITCH_RIGHT Bug: 219686410 Test: Local log in StatsLogCompatManager Change-Id: Ic88fefd5af58dc03779f77b12611843c40706b1c --- .../NoButtonQuickSwitchTouchController.java | 9 ++++++--- .../PortraitStatesTouchController.java | 2 +- .../touch/AbstractStateChangeTouchController.java | 14 ++++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 2ca59ebac1..53dc9dd873 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -27,6 +27,7 @@ import static com.android.launcher3.anim.Interpolators.DEACCEL_3; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEDOWN; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEUP; import static com.android.launcher3.logging.StatsLogManager.getLauncherAtomEvent; @@ -451,9 +452,11 @@ public class NoButtonQuickSwitchTouchController implements TouchController, .withSrcState(LAUNCHER_STATE_HOME) .withDstState(targetState.statsLogOrdinal) .log(getLauncherAtomEvent(mStartState.statsLogOrdinal, targetState.statsLogOrdinal, - targetState.ordinal > mStartState.ordinal - ? LAUNCHER_UNKNOWN_SWIPEUP - : LAUNCHER_UNKNOWN_SWIPEDOWN)); + targetState == QUICK_SWITCH + ? LAUNCHER_QUICKSWITCH_RIGHT + : targetState.ordinal > mStartState.ordinal + ? LAUNCHER_UNKNOWN_SWIPEUP + : LAUNCHER_UNKNOWN_SWIPEDOWN)); mLauncher.getStateManager().goToState(targetState, false, forEndCallback(this::clearState)); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 1504c12d71..dbee9c1ac7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -261,7 +261,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr @Override protected void onReachedFinalState(LauncherState toState) { - super.onReinitToState(toState); + super.onReachedFinalState(toState); if (toState == ALL_APPS) { InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS); } diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index a125fbe8be..09b8228182 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -21,6 +21,7 @@ import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; +import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; @@ -330,9 +331,6 @@ public abstract class AbstractStateChangeTouchController Math.min(progress, 1) - endProgress) * durationMultiplier; } } - if (targetState != mStartState) { - logReachedState(targetState); - } mCurrentAnimation.setEndAction(() -> onSwipeInteractionCompleted(targetState)); ValueAnimator anim = mCurrentAnimation.getAnimationPlayer(); anim.setFloatValues(startProgress, endProgress); @@ -361,6 +359,8 @@ public abstract class AbstractStateChangeTouchController boolean shouldGoToTargetState = mGoingBetweenStates || (mToState != targetState); if (shouldGoToTargetState) { goToTargetState(targetState); + } else { + logReachedState(mToState); } } @@ -368,13 +368,19 @@ public abstract class AbstractStateChangeTouchController if (!mLauncher.isInState(targetState)) { // If we're already in the target state, don't jump to it at the end of the animation in // case the user started interacting with it before the animation finished. - mLauncher.getStateManager().goToState(targetState, false /* animated */); + mLauncher.getStateManager().goToState(targetState, false /* animated */, + forEndCallback(() -> logReachedState(targetState))); + } else { + logReachedState(targetState); } mLauncher.getRootView().getSysUiScrim().createSysuiMultiplierAnim( 1f).setDuration(0).start(); } private void logReachedState(LauncherState targetState) { + if (mStartState == targetState) { + return; + } // Transition complete. log the action mLauncher.getStatsLogManager().logger() .withSrcState(mStartState.statsLogOrdinal)