Loading core/java/com/android/internal/jank/Cuj.java +15 −2 Original line number Diff line number Diff line Loading @@ -313,8 +313,17 @@ public class Cuj { */ public static final int CUJ_DEFAULT_TASK_TO_TASK_ANIMATION = 128; /** * Track moving a window to another display in Desktop Windowing mode. * * <p>Tracking starts when the DesktopModeMoveToDisplayTransitionHandler starts animating the * task to move it to another display. This is triggered when the user presses a keyboard * shortcut or clicks the menu in the overview. Tracking ends when the animation completes.</p> */ public static final int CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY = 129; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_DEFAULT_TASK_TO_TASK_ANIMATION; @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY; /** @hide */ @IntDef({ Loading Loading @@ -434,7 +443,8 @@ public class Cuj { CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH, CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND, CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION CUJ_DEFAULT_TASK_TO_TASK_ANIMATION, CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -565,6 +575,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_EXPAND; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_SHRINK; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DEFAULT_TASK_TO_TASK_ANIMATION] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DEFAULT_TASK_TO_TASK_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY; } private Cuj() { Loading Loading @@ -817,6 +828,8 @@ public class Cuj { return "LAUNCHER_WORK_UTILITY_VIEW_SHRINK"; case CUJ_DEFAULT_TASK_TO_TASK_ANIMATION: return "DEFAULT_TASK_TO_TASK_ANIMATION"; case CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY: return "DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY"; } return "UNKNOWN"; } Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +9 −2 Original line number Diff line number Diff line Loading @@ -969,8 +969,15 @@ public abstract class WMShellModule { @WMSingleton @Provides static DesktopModeMoveToDisplayTransitionHandler provideMoveToDisplayTransitionHandler() { return new DesktopModeMoveToDisplayTransitionHandler(new SurfaceControl.Transaction()); static DesktopModeMoveToDisplayTransitionHandler provideMoveToDisplayTransitionHandler( InteractionJankMonitor interactionJankMonitor, @ShellMainThread Handler shellMainHandler, DisplayController displayController) { return new DesktopModeMoveToDisplayTransitionHandler( new SurfaceControl.Transaction(), interactionJankMonitor, shellMainHandler, displayController); } @WMSingleton Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeMoveToDisplayTransitionHandler.kt +22 −2 Original line number Diff line number Diff line Loading @@ -19,19 +19,26 @@ package com.android.wm.shell.desktopmode import android.animation.Animator import android.animation.AnimatorSet import android.animation.ValueAnimator import android.os.Handler import android.os.IBinder import android.view.Choreographer import android.view.SurfaceControl import android.window.TransitionInfo import android.window.TransitionRequestInfo import android.window.WindowContainerTransaction import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY import com.android.internal.jank.InteractionJankMonitor import com.android.wm.shell.common.DisplayController import com.android.wm.shell.shared.animation.Interpolators import com.android.wm.shell.transition.Transitions import kotlin.time.Duration.Companion.milliseconds /** Transition handler for moving a window to a different display. */ class DesktopModeMoveToDisplayTransitionHandler( private val animationTransaction: SurfaceControl.Transaction private val animationTransaction: SurfaceControl.Transaction, private val interactionJankMonitor: InteractionJankMonitor, private val shellMainHandler: Handler, private val displayController: DisplayController, ) : Transitions.TransitionHandler { override fun handleRequest( Loading Loading @@ -74,18 +81,31 @@ class DesktopModeMoveToDisplayTransitionHandler( } } ) animator.addListener( object : Animator.AnimatorListener { override fun onAnimationStart(animation: Animator) = Unit override fun onAnimationStart(animation: Animator) { val displayContext = displayController.getDisplayContext(changes[0].endDisplayId) if (displayContext == null) return interactionJankMonitor.begin( changes[0].leash, displayContext, shellMainHandler, CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY, ) } override fun onAnimationEnd(animation: Animator) { finishTransaction.apply() finishCallback.onTransitionFinished(null) interactionJankMonitor.end(CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY) } override fun onAnimationCancel(animation: Animator) { finishTransaction.apply() finishCallback.onTransitionFinished(null) interactionJankMonitor.cancel(CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY) } override fun onAnimationRepeat(animation: Animator) = Unit Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeMoveToDisplayTransitionHandlerTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ class DesktopModeMoveToDisplayTransitionHandlerTest : ShellTestCase() { @Before fun setUp() { handler = DesktopModeMoveToDisplayTransitionHandler(StubTransaction()) handler = DesktopModeMoveToDisplayTransitionHandler(StubTransaction(), mock(), mock(), mock()) } @Test Loading Loading
core/java/com/android/internal/jank/Cuj.java +15 −2 Original line number Diff line number Diff line Loading @@ -313,8 +313,17 @@ public class Cuj { */ public static final int CUJ_DEFAULT_TASK_TO_TASK_ANIMATION = 128; /** * Track moving a window to another display in Desktop Windowing mode. * * <p>Tracking starts when the DesktopModeMoveToDisplayTransitionHandler starts animating the * task to move it to another display. This is triggered when the user presses a keyboard * shortcut or clicks the menu in the overview. Tracking ends when the animation completes.</p> */ public static final int CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY = 129; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_DEFAULT_TASK_TO_TASK_ANIMATION; @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY; /** @hide */ @IntDef({ Loading Loading @@ -434,7 +443,8 @@ public class Cuj { CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH, CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND, CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION CUJ_DEFAULT_TASK_TO_TASK_ANIMATION, CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -565,6 +575,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_EXPAND; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_SHRINK; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DEFAULT_TASK_TO_TASK_ANIMATION] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DEFAULT_TASK_TO_TASK_ANIMATION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY; } private Cuj() { Loading Loading @@ -817,6 +828,8 @@ public class Cuj { return "LAUNCHER_WORK_UTILITY_VIEW_SHRINK"; case CUJ_DEFAULT_TASK_TO_TASK_ANIMATION: return "DEFAULT_TASK_TO_TASK_ANIMATION"; case CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY: return "DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY"; } return "UNKNOWN"; } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +9 −2 Original line number Diff line number Diff line Loading @@ -969,8 +969,15 @@ public abstract class WMShellModule { @WMSingleton @Provides static DesktopModeMoveToDisplayTransitionHandler provideMoveToDisplayTransitionHandler() { return new DesktopModeMoveToDisplayTransitionHandler(new SurfaceControl.Transaction()); static DesktopModeMoveToDisplayTransitionHandler provideMoveToDisplayTransitionHandler( InteractionJankMonitor interactionJankMonitor, @ShellMainThread Handler shellMainHandler, DisplayController displayController) { return new DesktopModeMoveToDisplayTransitionHandler( new SurfaceControl.Transaction(), interactionJankMonitor, shellMainHandler, displayController); } @WMSingleton Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeMoveToDisplayTransitionHandler.kt +22 −2 Original line number Diff line number Diff line Loading @@ -19,19 +19,26 @@ package com.android.wm.shell.desktopmode import android.animation.Animator import android.animation.AnimatorSet import android.animation.ValueAnimator import android.os.Handler import android.os.IBinder import android.view.Choreographer import android.view.SurfaceControl import android.window.TransitionInfo import android.window.TransitionRequestInfo import android.window.WindowContainerTransaction import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY import com.android.internal.jank.InteractionJankMonitor import com.android.wm.shell.common.DisplayController import com.android.wm.shell.shared.animation.Interpolators import com.android.wm.shell.transition.Transitions import kotlin.time.Duration.Companion.milliseconds /** Transition handler for moving a window to a different display. */ class DesktopModeMoveToDisplayTransitionHandler( private val animationTransaction: SurfaceControl.Transaction private val animationTransaction: SurfaceControl.Transaction, private val interactionJankMonitor: InteractionJankMonitor, private val shellMainHandler: Handler, private val displayController: DisplayController, ) : Transitions.TransitionHandler { override fun handleRequest( Loading Loading @@ -74,18 +81,31 @@ class DesktopModeMoveToDisplayTransitionHandler( } } ) animator.addListener( object : Animator.AnimatorListener { override fun onAnimationStart(animation: Animator) = Unit override fun onAnimationStart(animation: Animator) { val displayContext = displayController.getDisplayContext(changes[0].endDisplayId) if (displayContext == null) return interactionJankMonitor.begin( changes[0].leash, displayContext, shellMainHandler, CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY, ) } override fun onAnimationEnd(animation: Animator) { finishTransaction.apply() finishCallback.onTransitionFinished(null) interactionJankMonitor.end(CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY) } override fun onAnimationCancel(animation: Animator) { finishTransaction.apply() finishCallback.onTransitionFinished(null) interactionJankMonitor.cancel(CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY) } override fun onAnimationRepeat(animation: Animator) = Unit Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeMoveToDisplayTransitionHandlerTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ class DesktopModeMoveToDisplayTransitionHandlerTest : ShellTestCase() { @Before fun setUp() { handler = DesktopModeMoveToDisplayTransitionHandler(StubTransaction()) handler = DesktopModeMoveToDisplayTransitionHandler(StubTransaction(), mock(), mock(), mock()) } @Test Loading