From 01320be908b6c8db7265f8d3ab7205668505d846 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 14 Apr 2021 14:51:03 -0700 Subject: [PATCH] Fix regression where StaggeredWorkspaceAnim didn't respect animateScrim Before, this happened to work because we skipped setting the scrim when doing an atomic animation, but the atomic animation code has been removed. Add an explicit SKIP_SCRIM config flag instead. Test: swipe up from overview to home, ensure scrim animates nicely Bug: 185411781 Change-Id: I7bc14a11d9d416cc7336ea29d21107dcdbdbf782 --- .../com/android/quickstep/util/StaggeredWorkspaceAnim.java | 3 ++- .../android/launcher3/WorkspaceStateTransitionAnimation.java | 5 ++++- src/com/android/launcher3/states/StateAnimationConfig.java | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index c12bd9b301..1df459ef8c 100644 --- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -22,6 +22,7 @@ import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; +import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -181,7 +182,7 @@ public class StaggeredWorkspaceAnim { */ private void prepareToAnimate(Launcher launcher, boolean animateOverviewScrim) { StateAnimationConfig config = new StateAnimationConfig(); - config.animFlags = SKIP_OVERVIEW | SKIP_DEPTH_CONTROLLER; + config.animFlags = SKIP_OVERVIEW | SKIP_DEPTH_CONTROLLER | SKIP_SCRIM; config.duration = 0; // setRecentsAttachedToAppWindow() will animate recents out. launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start(); diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index 24de19f20e..2956d07c8d 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -40,6 +40,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_F import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; +import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM; import android.animation.ValueAnimator; import android.view.View; @@ -151,7 +152,9 @@ public class WorkspaceStateTransitionAnimation { propertySetter.setFloat(mWorkspace.getPageIndicator(), VIEW_TRANSLATE_Y, hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator); - setScrim(propertySetter, state, config); + if (!config.hasAnimationFlag(SKIP_SCRIM)) { + setScrim(propertySetter, state, config); + } } /** diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java index 0dbfb0b15f..2f26b4f70f 100644 --- a/src/com/android/launcher3/states/StateAnimationConfig.java +++ b/src/com/android/launcher3/states/StateAnimationConfig.java @@ -31,12 +31,14 @@ public class StateAnimationConfig { SKIP_ALL_ANIMATIONS, SKIP_OVERVIEW, SKIP_DEPTH_CONTROLLER, + SKIP_SCRIM, }) @Retention(RetentionPolicy.SOURCE) public @interface AnimationFlags {} public static final int SKIP_ALL_ANIMATIONS = 1 << 0; public static final int SKIP_OVERVIEW = 1 << 1; public static final int SKIP_DEPTH_CONTROLLER = 1 << 2; + public static final int SKIP_SCRIM = 1 << 3; public long duration; public boolean userControlled;