desktop-exploded-view: Launch desktop task view should reverse its

exploded animation

Following CLs will support launching individual task window in the
desktop task view.

Flag: com.android.launcher3.enable_desktop_exploded_view
Test: Manual
Bug: 353948437
Change-Id: I5d084a7d8b231522bf5db1704cee1d6124affc22
This commit is contained in:
Xiaoqian Dai
2025-03-01 02:30:50 +00:00
parent 16020c58a9
commit 3dfd8bb2b5
8 changed files with 50 additions and 15 deletions
@@ -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),
)
}
@@ -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()) {
@@ -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
@@ -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());
@@ -132,7 +132,8 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
getOverviewInterpolator(state));
}
if (enableDesktopExplodedView()) {
setter.setFloat(mRecentsView, DESK_EXPLODE_PROGRESS, showAsGrid ? 1f : 0f,
setter.setFloat(mRecentsView, DESK_EXPLODE_PROGRESS,
state.showExplodedDesktopView() ? 1f : 0f,
getOverviewInterpolator(state));
}
@@ -15,6 +15,7 @@
*/
package com.android.quickstep.fallback;
import static com.android.launcher3.Flags.enableDesktopExplodedView;
import static com.android.launcher3.Flags.enableDesktopWindowingCarouselDetach;
import static com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS;
import static com.android.launcher3.uioverrides.states.BackgroundAppState.getOverviewScaleAndOffsetForBackgroundState;
@@ -46,16 +47,18 @@ public class RecentsState implements BaseState<RecentsState> {
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<RecentsState> {
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<RecentsState> {
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.
*/
@@ -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) {
@@ -68,6 +68,13 @@ public interface BaseState<T> {
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.
*/