diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt index 79328df325..23dc81d4e6 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt @@ -76,10 +76,7 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) : if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f, ) if (enableDesktopExplodedView()) { - DESK_EXPLODE_PROGRESS.set( - recentsView, - if (state.displayOverviewTasksAsGrid(launcher.deviceProfile)) 1f else 0f, - ) + DESK_EXPLODE_PROGRESS.set(recentsView, if (state.showExplodedDesktopView()) 1f else 0f) } TASK_THUMBNAIL_SPLASH_ALPHA.set( @@ -168,7 +165,7 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) : builder.setFloat( recentsView, DESK_EXPLODE_PROGRESS, - if (toState.isRecentsViewVisible) 1f else 0f, + if (toState.showExplodedDesktopView()) 1f else 0f, getOverviewInterpolator(fromState, toState), ) } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index b1196af0ed..a5b1ee7b53 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -96,6 +96,11 @@ public class BackgroundAppState extends OverviewState { return enableDesktopWindowingCarouselDetach(); } + @Override + public boolean showExplodedDesktopView() { + return false; + } + @Override protected float getDepthUnchecked(Context context) { if (Launcher.getLauncher(context).areDesktopTasksVisible()) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 5fdedccf99..963504f761 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -16,6 +16,7 @@ package com.android.launcher3.uioverrides.states; import static com.android.app.animation.Interpolators.DECELERATE_2; +import static com.android.launcher3.Flags.enableDesktopExplodedView; import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; @@ -170,6 +171,11 @@ public class OverviewState extends LauncherState { return false; } + @Override + public boolean showExplodedDesktopView() { + return enableDesktopExplodedView(); + } + @Override public boolean disallowTaskbarGlobalDrag() { // Disable global drag in overview diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 37c2d1c17b..855ff98062 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; import static com.android.app.animation.Interpolators.LINEAR; import static com.android.app.animation.Interpolators.TOUCH_RESPONSE; import static com.android.app.animation.Interpolators.clampToProgress; +import static com.android.launcher3.Flags.enableDesktopExplodedView; import static com.android.launcher3.Flags.enableGridOnlyOverview; import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; @@ -201,6 +202,9 @@ public final class TaskViewUtils { recentsView.getSizeStrategy(), targets, forDesktop); if (forDesktop) { remoteTargetHandles = gluer.assignTargetsForDesktop(targets, transitionInfo); + if (enableDesktopExplodedView()) { + ((DesktopTaskView) taskView).setRemoteTargetHandles(remoteTargetHandles); + } } else if (taskView.containsMultipleTasks()) { remoteTargetHandles = gluer.assignTargetsForSplitScreen(targets, ((GroupedTaskView) taskView).getSplitBoundsConfig()); diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 2631efea1c..554cea262f 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -132,7 +132,8 @@ public class FallbackRecentsStateController implements StateHandler { private static final int FLAG_TASK_THUMBNAIL_SPLASH = BaseState.getFlag(8); private static final int FLAG_DETACH_DESKTOP_CAROUSEL = BaseState.getFlag(9); private static final int FLAG_ADD_DESK_BUTTON = BaseState.getFlag(10); + private static final int FLAG_SHOW_EXPLODED_DESKTOP_VIEW = BaseState.getFlag(11); private static final RecentsState[] sAllStates = new RecentsState[6]; public static final RecentsState DEFAULT = new RecentsState(0, FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE - | FLAG_ADD_DESK_BUTTON); + | FLAG_ADD_DESK_BUTTON | FLAG_SHOW_EXPLODED_DESKTOP_VIEW); public static final RecentsState MODAL_TASK = new ModalState(1, FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL - | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE); + | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE + | FLAG_SHOW_EXPLODED_DESKTOP_VIEW); public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2, FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN | FLAG_RECENTS_VIEW_VISIBLE | FLAG_TASK_THUMBNAIL_SPLASH @@ -64,7 +67,7 @@ public class RecentsState implements BaseState { public static final RecentsState BG_LAUNCHER = new LauncherState(4, 0); public static final RecentsState OVERVIEW_SPLIT_SELECT = new RecentsState(5, FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_RECENTS_VIEW_VISIBLE | FLAG_CLOSE_POPUPS - | FLAG_DISABLE_RESTORE); + | FLAG_DISABLE_RESTORE | FLAG_SHOW_EXPLODED_DESKTOP_VIEW); /** Returns the corresponding RecentsState from ordinal provided */ public static RecentsState stateFromOrdinal(int ordinal) { @@ -174,6 +177,11 @@ public class RecentsState implements BaseState { return hasFlag(FLAG_DETACH_DESKTOP_CAROUSEL) && enableDesktopWindowingCarouselDetach(); } + @Override + public boolean showExplodedDesktopView() { + return hasFlag(FLAG_SHOW_EXPLODED_DESKTOP_VIEW) && enableDesktopExplodedView(); + } + /** * True if the state has overview panel visible. */ diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 3b943800e4..d350c77ec9 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2925,12 +2925,15 @@ public abstract class RecentsView< updateGridProperties(); } + BaseState endState = mSizeStrategy.stateFromGestureEndTarget(endTarget); + // Starting the desk exploded animation when the gesture from an app is released. if (enableDesktopExplodedView()) { if (animatorSet == null) { - mUtils.setDeskExplodeProgress(1); + mUtils.setDeskExplodeProgress(endState.showExplodedDesktopView() ? 1f : 0f); } else { animatorSet.play( - ObjectAnimator.ofFloat(this, DESK_EXPLODE_PROGRESS, 1)); + ObjectAnimator.ofFloat(this, DESK_EXPLODE_PROGRESS, + endState.showExplodedDesktopView() ? 1f : 0f)); } for (TaskView taskView : getTaskViews()) { @@ -2940,7 +2943,6 @@ public abstract class RecentsView< } } - BaseState endState = mSizeStrategy.stateFromGestureEndTarget(endTarget); if (endState.displayOverviewTasksAsGrid(mContainer.getDeviceProfile())) { TaskView runningTaskView = getRunningTaskView(); float runningTaskGridTranslationX = 0; @@ -3014,9 +3016,11 @@ public abstract class RecentsView< animateActionsViewIn(); if (mEnableDrawingLiveTile) { - for (TaskView taskView : getTaskViews()) { - if (taskView instanceof DesktopTaskView desktopTaskView) { - desktopTaskView.setRemoteTargetHandles(mRemoteTargetHandles); + if (enableDesktopExplodedView()) { + for (TaskView taskView : getTaskViews()) { + if (taskView instanceof DesktopTaskView desktopTaskView) { + desktopTaskView.setRemoteTargetHandles(mRemoteTargetHandles); + } } } TaskView runningTaskView = getRunningTaskView(); @@ -5780,6 +5784,9 @@ public abstract class RecentsView< if (taskView instanceof DesktopTaskView) { anim.play(ObjectAnimator.ofArgb(mContainer.getScrimView(), VIEW_BACKGROUND_COLOR, Color.TRANSPARENT)); + if (enableDesktopExplodedView()) { + anim.play(ObjectAnimator.ofFloat(this, DESK_EXPLODE_PROGRESS, 1f, 0f)); + } } DepthController depthController = getDepthController(); if (depthController != null) { diff --git a/src/com/android/launcher3/statemanager/BaseState.java b/src/com/android/launcher3/statemanager/BaseState.java index b7dd2bf01d..ea5415983c 100644 --- a/src/com/android/launcher3/statemanager/BaseState.java +++ b/src/com/android/launcher3/statemanager/BaseState.java @@ -68,6 +68,13 @@ public interface BaseState { return false; } + /** + * For this state, whether we should show desktop exploded view in Overview. + */ + default boolean showExplodedDesktopView() { + return false; + } + /** * For this state, whether fullscreen and desktop quickswitch carousel are detached. */