Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr protected StateAnimationConfig getConfigForStates( LauncherState fromState, LauncherState toState) { final StateAnimationConfig config = new StateAnimationConfig(); config.userControlled = true; config.animProps |= StateAnimationConfig.USER_CONTROLLED; if (fromState == NORMAL && toState == ALL_APPS) { AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mLauncher, config); } else if (fromState == ALL_APPS && toState == NORMAL) { Loading src/com/android/launcher3/allapps/AllAppsTransitionController.java +2 −2 Original line number Diff line number Diff line Loading @@ -342,7 +342,7 @@ public class AllAppsTransitionController }); } if(FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get() && config.userControlled if (FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get() && config.isUserControlled() && Utilities.ATLEAST_S) { if (toState == ALL_APPS) { builder.addOnFrameListener( Loading @@ -367,7 +367,7 @@ public class AllAppsTransitionController // need to decide depending on the release velocity Interpolator verticalProgressInterpolator = config.getInterpolator(ANIM_VERTICAL_PROGRESS, config.userControlled ? LINEAR : DECELERATE_1_7); config.isUserControlled() ? LINEAR : DECELERATE_1_7); Animator anim = createSpringAnimation(mProgress, targetProgress); anim.setInterpolator(verticalProgressInterpolator); builder.add(anim); Loading src/com/android/launcher3/statemanager/StateManager.java +15 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.launcher3.statemanager; import static android.animation.ValueAnimator.areAnimatorsEnabled; import static com.android.launcher3.anim.AnimatorPlaybackController.callListenerCommandRecursively; import static com.android.launcher3.states.StateAnimationConfig.HANDLE_STATE_APPLY; import static com.android.launcher3.states.StateAnimationConfig.SKIP_ALL_ANIMATIONS; import android.animation.Animator; Loading @@ -36,6 +37,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.states.StateAnimationConfig.AnimationFlags; import com.android.launcher3.states.StateAnimationConfig.AnimationPropertyFlags; import com.android.launcher3.testing.shared.TestProtocol; import java.io.PrintWriter; Loading Loading @@ -189,7 +191,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { public void reapplyState(boolean cancelCurrentAnimation) { boolean wasInAnimation = mConfig.currentAnimation != null; if (cancelCurrentAnimation) { if (cancelCurrentAnimation && (mConfig.animProps & HANDLE_STATE_APPLY) == 0) { // Animation canceling can trigger a cleanup routine, causing problems when we are in a // launcher state that relies on member variable data. So if we are in one of those // states, accelerate the current animation to its end point rather than canceling it Loading Loading @@ -237,7 +239,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { listener.onAnimationEnd(null); } return; } else if ((!mConfig.userControlled && animated && mConfig.targetState == state) } else if ((!mConfig.isUserControlled() && animated && mConfig.targetState == state) || mState.shouldPreserveDataStateOnReapply()) { // We are running the same animation as requested, and/or target state should not be // reset -- allow the current animation to complete instead of canceling it. Loading Loading @@ -343,7 +345,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { public AnimatorPlaybackController createAnimationToNewWorkspace(STATE_TYPE state, StateAnimationConfig config) { config.userControlled = true; config.animProps |= StateAnimationConfig.USER_CONTROLLED; cancelAnimation(); config.copyTo(mConfig); mConfig.playbackController = createAnimationToNewWorkspaceInternal(state) Loading Loading @@ -418,7 +420,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { } public void moveToRestState(boolean isAnimated) { if (mConfig.currentAnimation != null && mConfig.userControlled) { if (mConfig.currentAnimation != null && mConfig.isUserControlled()) { // The user is doing something. Lets not mess it up return; } Loading Loading @@ -450,10 +452,18 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { } } /** * Sets the provided controller as the current user controlled state animation */ public void setCurrentUserControlledAnimation(AnimatorPlaybackController controller) { setCurrentAnimation(controller, StateAnimationConfig.USER_CONTROLLED); } public void setCurrentAnimation(AnimatorPlaybackController controller, @AnimationPropertyFlags int animationProps) { clearCurrentAnimation(); setCurrentAnimation(controller.getTarget()); mConfig.userControlled = true; mConfig.animProps = animationProps; mConfig.playbackController = controller; } Loading src/com/android/launcher3/statemanager/StatefulActivity.java +1 −9 Original line number Diff line number Diff line Loading @@ -126,16 +126,8 @@ public abstract class StatefulActivity<STATE_TYPE extends BaseState<STATE_TYPE>> @Override public void reapplyUi() { reapplyUi(true /* cancelCurrentAnimation */); } /** * Re-applies if any state transition is not running, optionally cancelling * the transition if requested. */ public void reapplyUi(boolean cancelCurrentAnimation) { getRootView().dispatchInsets(); getStateManager().reapplyState(cancelCurrentAnimation); getStateManager().reapplyState(true /* cancelCurrentAnimation */); } @Override Loading src/com/android/launcher3/states/StateAnimationConfig.java +17 −2 Original line number Diff line number Diff line Loading @@ -40,8 +40,19 @@ public class StateAnimationConfig { public static final int SKIP_DEPTH_CONTROLLER = 1 << 2; public static final int SKIP_SCRIM = 1 << 3; @IntDef(flag = true, value = { USER_CONTROLLED, HANDLE_STATE_APPLY }) @Retention(RetentionPolicy.SOURCE) public @interface AnimationPropertyFlags {} // Indicates that the animation is controlled by the user public static final int USER_CONTROLLED = 1 << 0; // Indicates that he animation can survive state UI resets due to inset or config changes public static final int HANDLE_STATE_APPLY = 1 << 1; public long duration; public boolean userControlled; public @AnimationPropertyFlags int animProps = 0; public @AnimationFlags int animFlags = 0; Loading Loading @@ -105,12 +116,16 @@ public class StateAnimationConfig { public void copyTo(StateAnimationConfig target) { target.duration = duration; target.animFlags = animFlags; target.userControlled = userControlled; target.animProps = animProps; for (int i = 0; i < ANIM_TYPES_COUNT; i++) { target.mInterpolators[i] = mInterpolators[i]; } } public boolean isUserControlled() { return (animProps & USER_CONTROLLED) != 0; } /** * Returns the interpolator set for animId or fallback if nothing is set * Loading Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr protected StateAnimationConfig getConfigForStates( LauncherState fromState, LauncherState toState) { final StateAnimationConfig config = new StateAnimationConfig(); config.userControlled = true; config.animProps |= StateAnimationConfig.USER_CONTROLLED; if (fromState == NORMAL && toState == ALL_APPS) { AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mLauncher, config); } else if (fromState == ALL_APPS && toState == NORMAL) { Loading
src/com/android/launcher3/allapps/AllAppsTransitionController.java +2 −2 Original line number Diff line number Diff line Loading @@ -342,7 +342,7 @@ public class AllAppsTransitionController }); } if(FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get() && config.userControlled if (FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get() && config.isUserControlled() && Utilities.ATLEAST_S) { if (toState == ALL_APPS) { builder.addOnFrameListener( Loading @@ -367,7 +367,7 @@ public class AllAppsTransitionController // need to decide depending on the release velocity Interpolator verticalProgressInterpolator = config.getInterpolator(ANIM_VERTICAL_PROGRESS, config.userControlled ? LINEAR : DECELERATE_1_7); config.isUserControlled() ? LINEAR : DECELERATE_1_7); Animator anim = createSpringAnimation(mProgress, targetProgress); anim.setInterpolator(verticalProgressInterpolator); builder.add(anim); Loading
src/com/android/launcher3/statemanager/StateManager.java +15 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.launcher3.statemanager; import static android.animation.ValueAnimator.areAnimatorsEnabled; import static com.android.launcher3.anim.AnimatorPlaybackController.callListenerCommandRecursively; import static com.android.launcher3.states.StateAnimationConfig.HANDLE_STATE_APPLY; import static com.android.launcher3.states.StateAnimationConfig.SKIP_ALL_ANIMATIONS; import android.animation.Animator; Loading @@ -36,6 +37,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.states.StateAnimationConfig.AnimationFlags; import com.android.launcher3.states.StateAnimationConfig.AnimationPropertyFlags; import com.android.launcher3.testing.shared.TestProtocol; import java.io.PrintWriter; Loading Loading @@ -189,7 +191,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { public void reapplyState(boolean cancelCurrentAnimation) { boolean wasInAnimation = mConfig.currentAnimation != null; if (cancelCurrentAnimation) { if (cancelCurrentAnimation && (mConfig.animProps & HANDLE_STATE_APPLY) == 0) { // Animation canceling can trigger a cleanup routine, causing problems when we are in a // launcher state that relies on member variable data. So if we are in one of those // states, accelerate the current animation to its end point rather than canceling it Loading Loading @@ -237,7 +239,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { listener.onAnimationEnd(null); } return; } else if ((!mConfig.userControlled && animated && mConfig.targetState == state) } else if ((!mConfig.isUserControlled() && animated && mConfig.targetState == state) || mState.shouldPreserveDataStateOnReapply()) { // We are running the same animation as requested, and/or target state should not be // reset -- allow the current animation to complete instead of canceling it. Loading Loading @@ -343,7 +345,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { public AnimatorPlaybackController createAnimationToNewWorkspace(STATE_TYPE state, StateAnimationConfig config) { config.userControlled = true; config.animProps |= StateAnimationConfig.USER_CONTROLLED; cancelAnimation(); config.copyTo(mConfig); mConfig.playbackController = createAnimationToNewWorkspaceInternal(state) Loading Loading @@ -418,7 +420,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { } public void moveToRestState(boolean isAnimated) { if (mConfig.currentAnimation != null && mConfig.userControlled) { if (mConfig.currentAnimation != null && mConfig.isUserControlled()) { // The user is doing something. Lets not mess it up return; } Loading Loading @@ -450,10 +452,18 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> { } } /** * Sets the provided controller as the current user controlled state animation */ public void setCurrentUserControlledAnimation(AnimatorPlaybackController controller) { setCurrentAnimation(controller, StateAnimationConfig.USER_CONTROLLED); } public void setCurrentAnimation(AnimatorPlaybackController controller, @AnimationPropertyFlags int animationProps) { clearCurrentAnimation(); setCurrentAnimation(controller.getTarget()); mConfig.userControlled = true; mConfig.animProps = animationProps; mConfig.playbackController = controller; } Loading
src/com/android/launcher3/statemanager/StatefulActivity.java +1 −9 Original line number Diff line number Diff line Loading @@ -126,16 +126,8 @@ public abstract class StatefulActivity<STATE_TYPE extends BaseState<STATE_TYPE>> @Override public void reapplyUi() { reapplyUi(true /* cancelCurrentAnimation */); } /** * Re-applies if any state transition is not running, optionally cancelling * the transition if requested. */ public void reapplyUi(boolean cancelCurrentAnimation) { getRootView().dispatchInsets(); getStateManager().reapplyState(cancelCurrentAnimation); getStateManager().reapplyState(true /* cancelCurrentAnimation */); } @Override Loading
src/com/android/launcher3/states/StateAnimationConfig.java +17 −2 Original line number Diff line number Diff line Loading @@ -40,8 +40,19 @@ public class StateAnimationConfig { public static final int SKIP_DEPTH_CONTROLLER = 1 << 2; public static final int SKIP_SCRIM = 1 << 3; @IntDef(flag = true, value = { USER_CONTROLLED, HANDLE_STATE_APPLY }) @Retention(RetentionPolicy.SOURCE) public @interface AnimationPropertyFlags {} // Indicates that the animation is controlled by the user public static final int USER_CONTROLLED = 1 << 0; // Indicates that he animation can survive state UI resets due to inset or config changes public static final int HANDLE_STATE_APPLY = 1 << 1; public long duration; public boolean userControlled; public @AnimationPropertyFlags int animProps = 0; public @AnimationFlags int animFlags = 0; Loading Loading @@ -105,12 +116,16 @@ public class StateAnimationConfig { public void copyTo(StateAnimationConfig target) { target.duration = duration; target.animFlags = animFlags; target.userControlled = userControlled; target.animProps = animProps; for (int i = 0; i < ANIM_TYPES_COUNT; i++) { target.mInterpolators[i] = mInterpolators[i]; } } public boolean isUserControlled() { return (animProps & USER_CONTROLLED) != 0; } /** * Returns the interpolator set for animId or fallback if nothing is set * Loading