Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a895f05 authored by Tony Wickham's avatar Tony Wickham
Browse files

Add CUJ annotations for going to Recents from Home

Bug: 321756829
Flag: none
Test: switchToOverview, e.g. TaplTestsQuickstep
Test: Manually check traces for:
  - Home to quick switch to Overview
  - Home to quick switch to app
  - Home to Overview
  - Home to Overview to Home (one gesture)
Change-Id: I7e09957202b844d5db49f6c8545f864e7ace3522
parent bece5be7
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -38,6 +38,7 @@ import android.graphics.PointF;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.view.ViewConfiguration;


import com.android.internal.jank.Cuj;
import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.Utilities;
@@ -53,6 +54,7 @@ import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.MotionPauseDetector;
import com.android.quickstep.util.MotionPauseDetector;
import com.android.quickstep.util.OverviewToHomeAnim;
import com.android.quickstep.util.OverviewToHomeAnim;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;


import java.util.function.Consumer;
import java.util.function.Consumer;


@@ -148,6 +150,8 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
        mMotionPauseDetector.clear();
        mMotionPauseDetector.clear();


        if (handlingOverviewAnim()) {
        if (handlingOverviewAnim()) {
            InteractionJankMonitorWrapper.begin(mRecentsView, Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS,
                    "Home");
            mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseDetected);
            mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseDetected);
        }
        }


@@ -182,6 +186,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
        if (mStartedOverview) {
        if (mStartedOverview) {
            goToOverviewOrHomeOnDragEnd(velocity);
            goToOverviewOrHomeOnDragEnd(velocity);
        } else {
        } else {
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);
            super.onDragEnd(velocity);
            super.onDragEnd(velocity);
        }
        }


@@ -237,6 +242,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch


    private void maybeSwipeInteractionToOverviewComplete() {
    private void maybeSwipeInteractionToOverviewComplete() {
        if (mReachedOverview && !mDetector.isDraggingState()) {
        if (mReachedOverview && !mDetector.isDraggingState()) {
            InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);
            onSwipeInteractionCompleted(OVERVIEW);
            onSwipeInteractionCompleted(OVERVIEW);
        }
        }
    }
    }
@@ -280,6 +286,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
        if (goToHomeInsteadOfOverview) {
        if (goToHomeInsteadOfOverview) {
            new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(NORMAL), null)
            new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(NORMAL), null)
                    .animateWithVelocity(velocity);
                    .animateWithVelocity(velocity);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);
        }
        }
        if (mReachedOverview) {
        if (mReachedOverview) {
            float distanceDp = dpiFromPx(Math.max(
            float distanceDp = dpiFromPx(Math.max(
+5 −0
Original line number Original line Diff line number Diff line
@@ -193,6 +193,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        mMotionPauseDetector.clear();
        mMotionPauseDetector.clear();
        if (start) {
        if (start) {
            InteractionJankMonitorWrapper.begin(mRecentsView, Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
            InteractionJankMonitorWrapper.begin(mRecentsView, Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
            InteractionJankMonitorWrapper.begin(mRecentsView, Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS,
                    "Home");


            mStartState = mLauncher.getStateManager().getState();
            mStartState = mLauncher.getStateManager().getState();


@@ -350,6 +352,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
                    .dispatchOnStart();
                    .dispatchOnStart();
            return;
            return;
        }
        }
        InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);


        final LauncherState targetState;
        final LauncherState targetState;
        if (horizontalFling && verticalFling) {
        if (horizontalFling && verticalFling) {
@@ -471,6 +474,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController,


        if (targetState == QUICK_SWITCH_FROM_HOME) {
        if (targetState == QUICK_SWITCH_FROM_HOME) {
            InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
            InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
        } else if (targetState == OVERVIEW) {
            InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);
        }
        }


        mLauncher.getStateManager().goToState(targetState, false, forEndCallback(this::clearState));
        mLauncher.getStateManager().goToState(targetState, false, forEndCallback(this::clearState));