From 1422e89e92141863df239a9c7e4a03cec6352568 Mon Sep 17 00:00:00 2001 From: Daniel Andersson Date: Tue, 11 Feb 2025 15:05:44 -0800 Subject: [PATCH] desktop-exploded-view: Explode desktops when swiping up from home This change makes it so that the explode animation only happens when swiping up from the desk. In other cases, the desk is immediately set to its exploded state. The desk explode progress is now exposed as a FloatProperty in RecentsViewUtils. Flag: com.android.launcher3.enable_desktop_exploded_view Test: Manual Bug: 367353392 Change-Id: I5adec7db1fdc933860dce7fcca0a47cec0672ee7 --- .../uioverrides/RecentsViewStateController.kt | 18 ++++++++++++++++++ .../FallbackRecentsStateController.java | 6 ++++++ .../android/quickstep/views/DesktopTaskView.kt | 5 ----- .../android/quickstep/views/RecentsView.java | 13 ++++++++----- .../quickstep/views/RecentsViewUtils.kt | 18 ++++++++++++++++++ 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt index c8f46a9dd7..cca8bf8e17 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt @@ -20,6 +20,7 @@ import com.android.app.animation.Interpolators.AGGRESSIVE_EASE_IN_OUT import com.android.app.animation.Interpolators.FINAL_FRAME import com.android.app.animation.Interpolators.INSTANT import com.android.app.animation.Interpolators.LINEAR +import com.android.launcher3.Flags.enableDesktopExplodedView import com.android.launcher3.Flags.enableLargeDesktopWindowingTile import com.android.launcher3.LauncherState import com.android.launcher3.anim.AnimatedFloat @@ -51,6 +52,7 @@ import com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION import com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION import com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION import com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA +import com.android.quickstep.views.RecentsViewUtils.Companion.DESK_EXPLODE_PROGRESS import com.android.quickstep.views.TaskView.Companion.FLAG_UPDATE_ALL /** @@ -74,6 +76,13 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) : recentsView, if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f, ) + if (enableDesktopExplodedView()) { + DESK_EXPLODE_PROGRESS.set( + recentsView, + if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f, + ) + } + TASK_THUMBNAIL_SPLASH_ALPHA.set( recentsView, if (state.showTaskThumbnailSplash()) 1f else 0f, @@ -156,6 +165,15 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) : getOverviewInterpolator(fromState, toState), ) + if (enableDesktopExplodedView()) { + builder.setFloat( + recentsView, + DESK_EXPLODE_PROGRESS, + if (toState.isRecentsViewVisible) 1f else 0f, + getOverviewInterpolator(fromState, toState), + ) + } + if (enableLargeDesktopWindowingTile()) { builder.setFloat( recentsView, diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index b4b80c5705..56dd696550 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -18,6 +18,7 @@ package com.android.quickstep.fallback; import static com.android.app.animation.Interpolators.FINAL_FRAME; import static com.android.app.animation.Interpolators.INSTANT; import static com.android.app.animation.Interpolators.LINEAR; +import static com.android.launcher3.Flags.enableDesktopExplodedView; import static com.android.launcher3.Flags.enableLargeDesktopWindowingTile; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; @@ -36,6 +37,7 @@ import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLA import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; import static com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA; +import static com.android.quickstep.views.RecentsViewUtils.DESK_EXPLODE_PROGRESS; import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL; import android.util.FloatProperty; @@ -123,6 +125,10 @@ public class FallbackRecentsStateController implements StateHandler explodeProgress = progress }.animateToValue(0.0f, 1.0f) - private fun positionTaskWindows() { if (taskContainers.isEmpty()) { return diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index c5a76cb067..32854a7c10 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -72,6 +72,7 @@ import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_RO import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS; import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_TASKS; import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SELECT_ACTIVE; +import static com.android.quickstep.views.RecentsViewUtils.DESK_EXPLODE_PROGRESS; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -2910,13 +2911,15 @@ public abstract class RecentsView< } if (enableDesktopExplodedView()) { + if (animatorSet == null) { + mUtils.setDeskExplodeProgress(1); + } else { + animatorSet.play( + ObjectAnimator.ofFloat(this, DESK_EXPLODE_PROGRESS, 1)); + } + for (TaskView taskView : getTaskViews()) { if (taskView instanceof DesktopTaskView desktopTaskView) { - if (animatorSet == null) { - desktopTaskView.setExplodeProgress(1.0f); - } else { - animatorSet.play(desktopTaskView.startWindowExplodeAnimation()); - } desktopTaskView.setRemoteTargetHandles(remoteTargetHandles); } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt b/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt index f742ec3898..8df743053c 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt +++ b/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt @@ -17,6 +17,7 @@ package com.android.quickstep.views import android.graphics.Rect +import android.util.FloatProperty import android.view.View import androidx.core.view.children import com.android.launcher3.Flags.enableLargeDesktopWindowingTile @@ -294,7 +295,24 @@ class RecentsViewUtils(private val recentsView: RecentsView<*, *>) { } } + var deskExplodeProgress: Float = 0f + set(value) { + field = value + taskViews.filterIsInstance().forEach { it.explodeProgress = field } + } + companion object { + @JvmField + val DESK_EXPLODE_PROGRESS = + object : FloatProperty>("deskExplodeProgress") { + override fun setValue(recentsView: RecentsView<*, *>, value: Float) { + recentsView.mUtils.deskExplodeProgress = value + } + + override fun get(recentsView: RecentsView<*, *>) = + recentsView.mUtils.deskExplodeProgress + } + val TEMP_RECT = Rect() } }