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

Commit bfdc3a27 authored by Devarshi Bhatt's avatar Devarshi Bhatt
Browse files

Add instrumentation for window re-sizing CUJ in Desktop Windowing mode.

See go/windowing-jank-coverage-one-pager for more details.

Bug: 339585294
Test: perfetto trace(https://screenshot.googleplex.com/7wdneMGWi7DdZwV)
Flag: NONE new perfetto instrumentation
Change-Id: Id89104fb4f201b1010a03afad5b6c18d20187562
parent a872fb01
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -155,8 +155,13 @@ public class Cuj {
     */
    public static final int CUJ_FOLD_ANIM = 105;

    /**
     * Track window re-sizing interaction in desktop mode.
     */
    public static final int CUJ_DESKTOP_MODE_RESIZE_WINDOW = 106;

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

    /** @hide */
    @IntDef({
@@ -253,7 +258,8 @@ public class Cuj {
            CUJ_LAUNCHER_PRIVATE_SPACE_LOCK,
            CUJ_LAUNCHER_PRIVATE_SPACE_UNLOCK,
            CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW,
            CUJ_FOLD_ANIM
            CUJ_FOLD_ANIM,
            CUJ_DESKTOP_MODE_RESIZE_WINDOW
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CujType {}
@@ -361,6 +367,7 @@ public class Cuj {
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_PRIVATE_SPACE_UNLOCK] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_PRIVATE_SPACE_UNLOCK;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_MAXIMIZE_WINDOW;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_FOLD_ANIM] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__FOLD_ANIM;
        CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_RESIZE_WINDOW] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_RESIZE_WINDOW;
    }

    private Cuj() {
@@ -567,6 +574,8 @@ public class Cuj {
                return "DESKTOP_MODE_MAXIMIZE_WINDOW";
            case CUJ_FOLD_ANIM:
                return "FOLD_ANIM";
            case CUJ_DESKTOP_MODE_RESIZE_WINDOW:
                return "DESKTOP_MODE_RESIZE_WINDOW";
        }
        return "UNKNOWN";
    }
+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.wm.shell.windowdecor;

import static android.view.WindowManager.TRANSIT_CHANGE;

import static com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_RESIZE_WINDOW;

import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
@@ -33,6 +35,7 @@ import androidx.annotation.Nullable;

import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.InteractionJankMonitorUtils;
import com.android.wm.shell.transition.Transitions;

import java.util.function.Supplier;
@@ -89,6 +92,10 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
                mDesktopWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds());
        mRepositionStartPoint.set(x, y);
        if (isResizing()) {
            // Capture CUJ for re-sizing window in DW mode.
            InteractionJankMonitorUtils.beginTracing(CUJ_DESKTOP_MODE_RESIZE_WINDOW,
                    mDesktopWindowDecoration.mContext, mDesktopWindowDecoration.mTaskSurface,
                    /* tag= */ null);
            if (!mDesktopWindowDecoration.mTaskInfo.isFocused) {
                WindowContainerTransaction wct = new WindowContainerTransaction();
                wct.reorder(mDesktopWindowDecoration.mTaskInfo.token, true);
@@ -146,6 +153,7 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
                // won't be called.
                resetVeilIfVisible();
            }
            InteractionJankMonitorUtils.endTracing(CUJ_DESKTOP_MODE_RESIZE_WINDOW);
        } else {
            final WindowContainerTransaction wct = new WindowContainerTransaction();
            DragPositioningCallbackUtility.updateTaskBounds(mRepositionTaskBounds,