diff --git a/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransition.kt b/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransition.kt index 87a82f0af1..2406fb6620 100644 --- a/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransition.kt +++ b/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransition.kt @@ -22,6 +22,7 @@ import android.animation.ValueAnimator import android.content.Context import android.graphics.Rect import android.os.IBinder +import android.view.Choreographer import android.view.SurfaceControl.Transaction import android.view.WindowManager.TRANSIT_OPEN import android.view.WindowManager.TRANSIT_TO_BACK @@ -32,6 +33,8 @@ import android.window.TransitionInfo import android.window.TransitionInfo.Change import androidx.core.animation.addListener import com.android.app.animation.Interpolators +import com.android.internal.jank.Cuj +import com.android.internal.jank.InteractionJankMonitor import com.android.internal.policy.ScreenDecorationsUtils import com.android.quickstep.RemoteRunnable import com.android.wm.shell.shared.animation.MinimizeAnimator @@ -49,8 +52,11 @@ class DesktopAppLaunchTransition( private val context: Context, private val mainExecutor: Executor, private val launchType: AppLaunchType, + @Cuj.CujType private val cujType: Int, ) : RemoteTransitionStub() { + private val interactionJankMonitor = InteractionJankMonitor.getInstance() + enum class AppLaunchType( val boundsAnimationParams: WindowAnimator.BoundsAnimationParams, val alphaDurationMs: Long, @@ -127,7 +133,10 @@ class DesktopAppLaunchTransition( duration = launchType.alphaDurationMs interpolator = Interpolators.LINEAR addUpdateListener { animation -> - transaction.setAlpha(change.leash, animation.animatedValue as Float).apply() + transaction + .setAlpha(change.leash, animation.animatedValue as Float) + .setFrameTimeline(Choreographer.getInstance().vsyncId) + .apply() } } val clipRect = Rect(change.endAbsBounds).apply { offsetTo(0, 0) } @@ -137,8 +146,14 @@ class DesktopAppLaunchTransition( ScreenDecorationsUtils.getWindowCornerRadius(context), ) return AnimatorSet().apply { + interactionJankMonitor.begin(change.leash, context, context.mainThreadHandler, cujType) playTogether(boundsAnimator, alphaAnimator) - addListener(onEnd = { animation -> onAnimFinish(animation) }) + addListener( + onEnd = { animation -> + onAnimFinish(animation) + interactionJankMonitor.end(cujType) + } + ) } } diff --git a/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransitionManager.kt b/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransitionManager.kt index 6e363057a2..6cf9b9e962 100644 --- a/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransitionManager.kt +++ b/quickstep/src/com/android/launcher3/desktop/DesktopAppLaunchTransitionManager.kt @@ -23,6 +23,7 @@ import android.window.DesktopModeFlags import android.window.RemoteTransition import android.window.TransitionFilter import android.window.TransitionFilter.CONTAINER_ORDER_TOP +import com.android.internal.jank.Cuj import com.android.launcher3.desktop.DesktopAppLaunchTransition.AppLaunchType import com.android.launcher3.util.Executors.MAIN_EXECUTOR import com.android.quickstep.SystemUiProxy @@ -45,8 +46,13 @@ class DesktopAppLaunchTransitionManager( } remoteWindowLimitUnminimizeTransition = RemoteTransition( - DesktopAppLaunchTransition(context, MAIN_EXECUTOR, AppLaunchType.UNMINIMIZE), - "DesktopWindowLimitUnminimize" + DesktopAppLaunchTransition( + context, + MAIN_EXECUTOR, + AppLaunchType.UNMINIMIZE, + Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_INTENT, + ), + "DesktopWindowLimitUnminimize", ) systemUiProxy.registerRemoteTransition( remoteWindowLimitUnminimizeTransition, diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index cb811d6c70..88466d329c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -38,7 +38,6 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.desktop.DesktopAppLaunchTransition; -import com.android.launcher3.desktop.DesktopAppLaunchTransition.AppLaunchType; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer; import com.android.launcher3.util.DisplayController; @@ -286,7 +285,12 @@ public class KeyboardQuickSwitchViewController { ) { // This app is being unminimized - use our own transition runner. remoteTransition = new RemoteTransition( - new DesktopAppLaunchTransition(context, MAIN_EXECUTOR, UNMINIMIZE), + new DesktopAppLaunchTransition( + context, + MAIN_EXECUTOR, + UNMINIMIZE, + Cuj.CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH + ), "DesktopKeyboardQuickSwitchUnminimize"); } mControllers.taskbarActivityContext.handleGroupTaskLaunch( diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 9fe92029e4..2924a23e36 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -82,6 +82,7 @@ import androidx.annotation.VisibleForTesting; import androidx.core.graphics.Insets; import androidx.core.view.WindowInsetsCompat; +import com.android.internal.jank.Cuj; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; @@ -913,7 +914,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { ActivityOptions options = ActivityOptions.makeRemoteTransition( new RemoteTransition( new DesktopAppLaunchTransition( - /* context= */ this, getMainExecutor(), launchType), + /* context= */ this, + getMainExecutor(), + launchType, + Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON + ), "TaskbarDesktopLaunch")); return new ActivityOptionsWrapper(options, new RunnableList()); } @@ -1316,7 +1321,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { if (tag instanceof GroupTask groupTask) { RemoteTransition remoteTransition = (areDesktopTasksVisible() && canUnminimizeDesktopTask(groupTask.task1.key.id)) - ? createUnminimizeRemoteTransition() : null; + ? createUnminimizeRemoteTransition( + Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON) : null; if (areDesktopTasksVisible() && mControllers.uiController.isInOverviewUi()) { RunnableList runnableList = recents.launchRunningDesktopTaskView(); // Wrapping it in runnable so we post after DW is ready for the app @@ -1347,7 +1353,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } } else if (tag instanceof TaskItemInfo info && !Flags.enableMultiInstanceMenuTaskbar()) { RemoteTransition remoteTransition = canUnminimizeDesktopTask(info.getTaskId()) - ? createUnminimizeRemoteTransition() : null; + ? createUnminimizeRemoteTransition(Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON) + : null; TaskView taskView = null; if (recents != null) { @@ -1527,9 +1534,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext { ); } - private RemoteTransition createUnminimizeRemoteTransition() { + private RemoteTransition createUnminimizeRemoteTransition(@Cuj.CujType int cujType) { return new RemoteTransition( - new DesktopAppLaunchTransition(this, getMainExecutor(), AppLaunchType.UNMINIMIZE), + new DesktopAppLaunchTransition( + this, + getMainExecutor(), + AppLaunchType.UNMINIMIZE, + cujType + ), "TaskbarDesktopUnminimize"); }