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

Commit 51e0d8f7 authored by Eric Sum's avatar Eric Sum Committed by Android (Google) Code Review
Browse files

Merge "Add ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG latency." into main

parents f2aefe77 686af717
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.provider.DeviceConfig.NAMESPACE_LATENCY_TRACKER;
import static com.android.internal.util.FrameworkStatsLog.UIACTION_LATENCY_REPORTED__ACTION__ACTION_BACK_SYSTEM_ANIMATION;
import static com.android.internal.util.FrameworkStatsLog.UIACTION_LATENCY_REPORTED__ACTION__ACTION_CHECK_CREDENTIAL;
import static com.android.internal.util.FrameworkStatsLog.UIACTION_LATENCY_REPORTED__ACTION__ACTION_CHECK_CREDENTIAL_UNLOCKED;
import static com.android.internal.util.FrameworkStatsLog.UIACTION_LATENCY_REPORTED__ACTION__ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG;
import static com.android.internal.util.FrameworkStatsLog.UIACTION_LATENCY_REPORTED__ACTION__ACTION_EXPAND_PANEL;
import static com.android.internal.util.FrameworkStatsLog.UIACTION_LATENCY_REPORTED__ACTION__ACTION_FACE_WAKE_AND_UNLOCK;
import static com.android.internal.util.FrameworkStatsLog.UIACTION_LATENCY_REPORTED__ACTION__ACTION_FINGERPRINT_WAKE_AND_UNLOCK;
@@ -266,6 +267,15 @@ public class LatencyTracker {
     */
    public static final int ACTION_SHADE_WINDOW_DISPLAY_CHANGE = 29;

    /**
     * Applicable when the user drags a full screen app's handle into the desktop drop zone to enter
     * desktop mode. This measure the time from when the user releases their finger in the drop zone
     * to when the animation for entering desktop mode visually begins. During this period, the
     * home task and app headers for each window are initialized. Both have historically been
     * expensive. See b/381396057 and b/360452034 respectively.
     */
    public static final int ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG = 30;

    private static final int[] ACTIONS_ALL = {
        ACTION_EXPAND_PANEL,
        ACTION_TOGGLE_RECENTS,
@@ -297,6 +307,7 @@ public class LatencyTracker {
        ACTION_NOTIFICATIONS_HIDDEN_FOR_MEASURE_WITH_SHADE_OPEN,
        ACTION_KEYGUARD_FACE_UNLOCK_TO_HOME,
        ACTION_SHADE_WINDOW_DISPLAY_CHANGE,
        ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG,
    };

    /** @hide */
@@ -331,10 +342,10 @@ public class LatencyTracker {
        ACTION_NOTIFICATIONS_HIDDEN_FOR_MEASURE_WITH_SHADE_OPEN,
        ACTION_KEYGUARD_FACE_UNLOCK_TO_HOME,
        ACTION_SHADE_WINDOW_DISPLAY_CHANGE,
        ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Action {
    }
    public @interface Action {}

    @VisibleForTesting
    public static final int[] STATSD_ACTION = new int[] {
@@ -368,6 +379,7 @@ public class LatencyTracker {
            UIACTION_LATENCY_REPORTED__ACTION__ACTION_NOTIFICATIONS_HIDDEN_FOR_MEASURE_WITH_SHADE_OPEN,
            UIACTION_LATENCY_REPORTED__ACTION__ACTION_KEYGUARD_FACE_UNLOCK_TO_HOME,
            UIACTION_LATENCY_REPORTED__ACTION__ACTION_SHADE_WINDOW_DISPLAY_CHANGE,
            UIACTION_LATENCY_REPORTED__ACTION__ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG,
    };

    private final Object mLock = new Object();
@@ -568,6 +580,8 @@ public class LatencyTracker {
                return "ACTION_KEYGUARD_FACE_UNLOCK_TO_HOME";
            case UIACTION_LATENCY_REPORTED__ACTION__ACTION_SHADE_WINDOW_DISPLAY_CHANGE:
                return "ACTION_SHADE_WINDOW_DISPLAY_CHANGE";
            case UIACTION_LATENCY_REPORTED__ACTION__ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG:
                return "ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG";
            default:
                throw new IllegalArgumentException("Invalid action");
        }
+9 −3
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELE
import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_SNAP_RESIZE
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.protolog.ProtoLog
import com.android.internal.util.LatencyTracker
import com.android.window.flags.Flags
import com.android.wm.shell.Flags.enableFlexibleSplit
import com.android.wm.shell.R
@@ -748,9 +749,9 @@ class DesktopTasksController(
        desktopModeEnterExitTransitionListener?.onEnterDesktopModeTransitionStarted(
            DRAG_TO_DESKTOP_FINISH_ANIM_DURATION_MS.toInt()
        )
        transition?.let {
            taskIdToMinimize?.let { taskId ->
                addPendingMinimizeTransition(it, taskId, MinimizeReason.TASK_LIMIT)
        if (transition != null) {
            taskIdToMinimize?.let {
                addPendingMinimizeTransition(transition, it, MinimizeReason.TASK_LIMIT)
            }
            exitResult.asExit()?.runOnTransitionStart?.invoke(transition)
            if (DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) {
@@ -765,6 +766,9 @@ class DesktopTasksController(
            } else {
                taskRepository.setActiveDesk(displayId = taskInfo.displayId, deskId = deskId)
            }
        } else {
            LatencyTracker.getInstance(context)
                .onActionCancel(LatencyTracker.ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG)
        }
    }

@@ -3084,6 +3088,8 @@ class DesktopTasksController(
        val indicatorType = indicator.updateIndicatorType(inputCoordinates)
        when (indicatorType) {
            IndicatorType.TO_DESKTOP_INDICATOR -> {
                LatencyTracker.getInstance(context)
                    .onActionStart(LatencyTracker.ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG)
                // Start a new jank interaction for the drag release to desktop window animation.
                interactionJankMonitor.begin(
                    taskSurface,
+5 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_HOLD
import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.protolog.ProtoLog
import com.android.internal.util.LatencyTracker
import com.android.wm.shell.RootTaskDisplayAreaOrganizer
import com.android.wm.shell.animation.FloatProperties
import com.android.wm.shell.bubbles.BubbleController
@@ -568,8 +569,12 @@ sealed class DragToDesktopTransitionHandler(
            )
            // Call finishCallback to merge animation before startTransitionFinishCb is called
            finishCallback.onTransitionFinished(/* wct= */ null)
            LatencyTracker.getInstance(context)
                .onActionEnd(LatencyTracker.ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG)
            animateEndDragToDesktop(startTransaction = startT, startTransitionFinishCb)
        } else if (isCancelTransition) {
            LatencyTracker.getInstance(context)
                .onActionCancel(LatencyTracker.ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG)
            info.changes.forEach { change ->
                startT.show(change.leash)
                startTransactionFinishT.show(change.leash)