Cancel existing launcher animation earlier to prevent unnecessary AllApps animation.

Prior to this change:
* User presses home before opening app transition finishes
* Close app transition starts
* AllAppsTransitionController#mProgress = 1.3 (starts offscreen)
* Launcher#onNewIntent makes call to AllAppsTransitionController#setStateWithAnimation
* targetProgress != mProgress (1 != 1.3),  so it runs an animator that looks odd
  ie. fast duration, only AllApps animates compared to expected full closing app transition

Change-Id: I755787aebf637675cb9aae23fc5784f5a5b6c811
This commit is contained in:
Jon Miranda
2018-02-15 11:32:25 -08:00
parent 5f72d3b8b6
commit 8b08a1fd81

View File

@@ -175,6 +175,7 @@ public class LauncherStateManager {
mConfig.reset();
if (!animated) {
preOnStateTransitionStart();
onStateTransitionStart(state);
for (StateHandler handler : getStateHandlers()) {
handler.setState(state);
@@ -231,6 +232,8 @@ public class LauncherStateManager {
protected AnimatorSet createAnimationToNewWorkspaceInternal(final LauncherState state,
AnimatorSetBuilder builder, final Runnable onCompleteRunnable) {
preOnStateTransitionStart();
for (StateHandler handler : getStateHandlers()) {
builder.startTag(handler);
handler.setStateWithAnimation(state, builder, mConfig);
@@ -269,6 +272,15 @@ public class LauncherStateManager {
return mConfig.mCurrentAnimation;
}
private void preOnStateTransitionStart() {
// If we are still animating to launcher from an app,
// finish it and let this state animation take over.
LauncherAppTransitionManager transitionManager = mLauncher.getAppTransitionManager();
if (transitionManager != null) {
transitionManager.finishLauncherAnimation();
}
}
private void onStateTransitionStart(LauncherState state) {
mState.onStateDisabled(mLauncher);
mState = state;
@@ -279,13 +291,6 @@ public class LauncherStateManager {
// Only disable clipping if needed, otherwise leave it as previous value.
mLauncher.getWorkspace().setClipChildren(false);
}
// If we are still animating to launcher from an app,
// finish it and let this state animation take over.
LauncherAppTransitionManager transitionManager = mLauncher.getAppTransitionManager();
if (transitionManager != null) {
transitionManager.finishLauncherAnimation();
}
}
private void onStateTransitionEnd(LauncherState state) {