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

Commit b8a71816 authored by Anushree Ganjam's avatar Anushree Ganjam
Browse files

[Refactor] Use constants from Cuj.java instead of InteractionJankMonitorWrapper.

Bug: 303105164
Test: Manual
Flag: NA
Change-Id: I05a36fc0421502cd472dd79035b73a69d05592d2
parent 8a401e88
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -64,8 +64,6 @@ import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATI
import static com.android.launcher3.views.FloatingIconView.getFloatingIconView;
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch;
import static com.android.systemui.shared.system.InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME;
import static com.android.systemui.shared.system.InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME_FALLBACK;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;

@@ -117,6 +115,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;

import com.android.internal.jank.Cuj;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory;
import com.android.launcher3.anim.AnimationSuccessListener;
@@ -1652,7 +1651,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        // is initialized.
        if (launcherIsForceInvisibleOrOpening) {
            addCujInstrumentation(anim, playFallBackAnimation
                    ? CUJ_APP_CLOSE_TO_HOME_FALLBACK : CUJ_APP_CLOSE_TO_HOME);
                    ? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
                    : Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);

            anim.addListener(new AnimatorListenerAdapter() {
                @Override
@@ -1768,19 +1768,18 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
            if (launchingFromWidget) {
                composeWidgetLaunchAnimator(anim, (LauncherAppWidgetHostView) mV, appTargets,
                        wallpaperTargets, nonAppTargets, launcherClosing);
                addCujInstrumentation(
                        anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_WIDGET);
                addCujInstrumentation(anim, Cuj.CUJ_LAUNCHER_APP_LAUNCH_FROM_WIDGET);
                skipFirstFrame = true;
            } else if (launchingFromRecents) {
                composeRecentsLaunchAnimator(anim, mV, appTargets, wallpaperTargets, nonAppTargets,
                        launcherClosing);
                addCujInstrumentation(
                        anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_RECENTS);
                        anim, Cuj.CUJ_LAUNCHER_APP_LAUNCH_FROM_RECENTS);
                skipFirstFrame = true;
            } else {
                composeIconLaunchAnimator(anim, mV, appTargets, wallpaperTargets, nonAppTargets,
                        launcherClosing);
                addCujInstrumentation(anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_ICON);
                addCujInstrumentation(anim, Cuj.CUJ_LAUNCHER_APP_LAUNCH_FROM_ICON);
                skipFirstFrame = false;
            }

+6 −5
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.launcher3.uioverrides.touchcontrollers;

import static android.view.MotionEvent.ACTION_DOWN;

import static com.android.app.animation.Interpolators.ACCELERATE_0_75;
import static com.android.app.animation.Interpolators.DECELERATE_3;
import static com.android.app.animation.Interpolators.LINEAR;
@@ -65,6 +66,7 @@ import android.graphics.PointF;
import android.view.MotionEvent;
import android.view.animation.Interpolator;

import com.android.internal.jank.Cuj;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -190,8 +192,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
    public void onDragStart(boolean start) {
        mMotionPauseDetector.clear();
        if (start) {
            InteractionJankMonitorWrapper.begin(mRecentsView,
                    InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
            InteractionJankMonitorWrapper.begin(mRecentsView, Cuj.CUJ_LAUNCHER_QUICK_SWITCH);

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

@@ -327,7 +328,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        if (mMotionPauseDetector.isPaused() && noFling) {
            // Going to Overview.
            cancelAnimations();
            InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_QUICK_SWITCH);

            StateAnimationConfig config = new StateAnimationConfig();
            config.duration = ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW;
@@ -445,7 +446,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
                    RecentsView.SCROLL_VIBRATION_PRIMITIVE_SCALE,
                    RecentsView.SCROLL_VIBRATION_FALLBACK);
        } else {
            InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
        }

        nonOverviewAnim.setDuration(Math.max(xDuration, yDuration));
@@ -469,7 +470,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
                                        : LAUNCHER_UNKNOWN_SWIPEDOWN));

        if (targetState == QUICK_SWITCH_FROM_HOME) {
            InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
            InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
        }

        mLauncher.getStateManager().goToState(targetState, false, forEndCallback(this::clearState));
+11 −16
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import android.view.MotionEvent;

import com.android.app.animation.Interpolators;
import com.android.internal.jank.Cuj;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
@@ -185,18 +186,15 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                InteractionJankMonitorWrapper.begin(
                        mLauncher.getRootView(), InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
                        mLauncher.getRootView(), Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS);
                InteractionJankMonitorWrapper.begin(
                        mLauncher.getRootView(),
                        InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
                        mLauncher.getRootView(), Cuj.CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE);
                break;

            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP:
                InteractionJankMonitorWrapper.cancel(
                        InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
                InteractionJankMonitorWrapper.cancel(
                        InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
                InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS);
                InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE);
                break;
        }
        return super.onControllerInterceptTouchEvent(ev);
@@ -207,11 +205,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
    protected void onReinitToState(LauncherState newToState) {
        super.onReinitToState(newToState);
        if (newToState != ALL_APPS) {
            InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS);
        }
        if (newToState != NORMAL) {
            InteractionJankMonitorWrapper.cancel(
                    InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE);
        }
    }

@@ -219,18 +216,16 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
    protected void onReachedFinalState(LauncherState toState) {
        super.onReachedFinalState(toState);
        if (toState == ALL_APPS) {
            InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
            InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS);
        } else if (toState == NORMAL) {
            InteractionJankMonitorWrapper.end(
                    InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
            InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE);
        }
    }

    @Override
    protected void clearState() {
        super.clearState();
        InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
        InteractionJankMonitorWrapper.cancel(
                InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
        InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS);
        InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE);
    }
}
+8 −10
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;

import com.android.internal.jank.Cuj;
import com.android.internal.util.LatencyTracker;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
@@ -1024,12 +1025,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                    }
                    mHandled = true;

                    InteractionJankMonitorWrapper.begin(mRecentsView, Cuj.CUJ_LAUNCHER_QUICK_SWITCH,
                            2000 /* ms timeout */);
                    InteractionJankMonitorWrapper.begin(mRecentsView,
                            InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH, 2000 /* ms timeout */);
                            Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
                    InteractionJankMonitorWrapper.begin(mRecentsView,
                            InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME);
                    InteractionJankMonitorWrapper.begin(mRecentsView,
                            InteractionJankMonitorWrapper.CUJ_APP_SWIPE_TO_RECENTS);
                            Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);

                    rv.post(() -> rv.getViewTreeObserver().removeOnDrawListener(this));
                }
@@ -1145,16 +1146,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        View postResumeLastTask = mActivityInterface.onSettledOnEndTarget(endTarget);

        if (endTarget != NEW_TASK) {
            InteractionJankMonitorWrapper.cancel(
                    InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
        }
        if (endTarget != HOME) {
            InteractionJankMonitorWrapper.cancel(
                    InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
        }
        if (endTarget != RECENTS) {
            InteractionJankMonitorWrapper.cancel(
                    InteractionJankMonitorWrapper.CUJ_APP_SWIPE_TO_RECENTS);
            InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS);
        }

        switch (endTarget) {
+2 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;

import com.android.internal.jank.Cuj;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StatefulActivity;
@@ -262,7 +263,7 @@ public class OverviewCommandHelper {
        if (activity != null) {
            InteractionJankMonitorWrapper.begin(
                    activity.getRootView(),
                    InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
                    Cuj.CUJ_LAUNCHER_QUICK_SWITCH);
        }

        GestureState gestureState = mService.createGestureState(GestureState.DEFAULT_STATE,
Loading