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

Commit 792f3290 authored by Sergey Pinkevich's avatar Sergey Pinkevich Committed by Android (Google) Code Review
Browse files

Merge "[Logging] Add instrumentation for SplitScreen > Desktop CUJ" into main

parents 302afd61 d9564fd4
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -459,7 +459,7 @@ public class Cuj {
    public static final int CUJ_LAUNCHER_WIDGET_PICKER_APP_EXPAND = 142;

    /**
     * Track exiting from Desktop Windowing mode and moving into Split screen mode.
     * Tracks exiting from Desktop Windowing mode and moving into Split screen mode.
     *
     * <p>Tracking starts when user initiates exiting from Desktop Windowing (by tapping the
     * split-screen button in the app header menu) and finishes when transition to Split screen is
@@ -467,8 +467,17 @@ public class Cuj {
     */
    public static final int CUJ_DESKTOP_MODE_MOVE_TO_SPLIT_SCREEN = 143;

    /**
     * Tracks exiting from Split screen mode and entering into Desktop Windowing mode.
     *
     * <p>Tracking begins when a user exits Split screen mode (by tapping the Desktop Windowing
     * button or using the drop event of drag-and-drop) and ends when the transition to Desktop
     * Windowing mode is complete (the animation has finished, and the mode is ready for user input)
     */
    public static final int CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN = 144;

    // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE.
    @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_MOVE_TO_SPLIT_SCREEN;
    @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN;

    /** @hide */
    @IntDef({
@@ -604,6 +613,7 @@ public class Cuj {
            CUJ_LAUNCHER_WIDGET_PICKER_OPEN,
            CUJ_LAUNCHER_WIDGET_PICKER_APP_EXPAND,
            CUJ_DESKTOP_MODE_MOVE_TO_SPLIT_SCREEN,
            CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CujType {}
@@ -749,6 +759,7 @@ public class Cuj {
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WIDGET_PICKER_OPEN] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WIDGET_PICKER_OPEN;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WIDGET_PICKER_APP_EXPAND] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WIDGET_PICKER_APP_EXPAND;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_MOVE_TO_SPLIT_SCREEN] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_MOVE_TO_SPLIT_SCREEN;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN;
    }

    private Cuj() {
@@ -1031,6 +1042,8 @@ public class Cuj {
                return "LAUNCHER_WIDGET_PICKER_APP_EXPAND";
            case CUJ_DESKTOP_MODE_MOVE_TO_SPLIT_SCREEN:
                return "DESKTOP_MODE_MOVE_TO_SPLIT_SCREEN";
            case CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN:
                return "DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN";
        }
        return "UNKNOWN";
    }
+22 −8
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ import com.android.app.tracing.traceSection
import com.android.internal.annotations.VisibleForTesting
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.Cuj.CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN
import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_SNAP_RESIZE
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.policy.DesktopModeCompatPolicy
@@ -5463,7 +5464,19 @@ class DesktopTasksController(
                latencyTracker.onActionStart(
                    LatencyTracker.ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG
                )
                // Start a new jank interaction for the drag release to desktop window animation.
                if (
                    taskInfo.configuration.windowConfiguration.getWindowingMode() ===
                        WINDOWING_MODE_MULTI_WINDOW
                ) {
                    interactionJankMonitor.begin(
                        taskSurface,
                        context,
                        handler,
                        CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN,
                    )
                } else {
                    // Start a new jank interaction for the drag release to desktop window
                    // animation.
                    interactionJankMonitor.begin(
                        taskSurface,
                        context,
@@ -5471,6 +5484,7 @@ class DesktopTasksController(
                        CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE,
                        "to_desktop",
                    )
                }
                desktopModeUiEventLogger.log(
                    taskInfo,
                    DesktopUiEventEnum.DESKTOP_WINDOW_APP_HANDLE_DRAG_TO_DESKTOP_MODE,
+3 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.internal.annotations.VisibleForTesting
import com.android.internal.dynamicanimation.animation.SpringForce
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.Cuj.CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.protolog.ProtoLog
import com.android.internal.util.LatencyTracker
@@ -1002,6 +1003,7 @@ sealed class DragToDesktopTransitionHandler(
            // This transition being aborted is neither the start, nor the cancel transition, so
            // it must be the finish transition (DRAG_RELEASE); cancel its jank interaction.
            interactionJankMonitor.cancel(CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE)
            interactionJankMonitor.cancel(CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN)
        }
    }

@@ -1497,6 +1499,7 @@ constructor(
                startTransitionFinishCb.onTransitionFinished(/* wct= */ null)
                clearState()
                interactionJankMonitor.end(CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE)
                interactionJankMonitor.end(CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN)
            })
            .start()
    }
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.desktopmode;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;

import static com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_ENTER_MODE_APP_HANDLE_MENU;
import static com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN;
import static com.android.wm.shell.desktopmode.DesktopModeTransitionTypes.getEnterTransitionType;
import static com.android.wm.shell.desktopmode.DesktopModeTransitionTypes.isEnterDesktopModeTransition;

@@ -203,6 +204,7 @@ public class EnterDesktopTaskTransitionHandler implements Transitions.Transition
                mTransitions.getMainExecutor().execute(
                        () -> finishCallback.onTransitionFinished(null));
                mInteractionJankMonitor.end(CUJ_DESKTOP_MODE_ENTER_MODE_APP_HANDLE_MENU);
                mInteractionJankMonitor.end(CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN);
            }
        });
        animator.start();
+9 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static android.view.WindowInsets.Type.statusBars;
import static android.window.DesktopExperienceFlags.ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS;

import static com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_ENTER_MODE_APP_HANDLE_MENU;
import static com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN;
import static com.android.wm.shell.desktopmode.DesktopModeEventLogger.Companion.InputMethod;
import static com.android.wm.shell.desktopmode.DesktopModeEventLogger.Companion.MinimizeReason;
import static com.android.wm.shell.desktopmode.DesktopModeEventLogger.Companion.ResizeTrigger;
@@ -879,8 +880,14 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            return;
        }
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        if (decoration.getTaskInfo().configuration.windowConfiguration.getWindowingMode()
                == WINDOWING_MODE_MULTI_WINDOW) {
            mInteractionJankMonitor.begin(decoration.getTaskSurface(), mContext, mMainHandler,
                    CUJ_DESKTOP_MODE_MOVE_FROM_SPLIT_SCREEN);
        } else {
            mInteractionJankMonitor.begin(decoration.getTaskSurface(), mContext, mMainHandler,
                    CUJ_DESKTOP_MODE_ENTER_MODE_APP_HANDLE_MENU);
        }
        mLatencyTracker.onActionStart(LatencyTracker.ACTION_DESKTOP_MODE_ENTER_APP_HANDLE_MENU);
        // App sometimes draws before the insets from WindowDecoration#relayout have
        // been added, so they must be added here