Do not change state in the middle of quickstep gesture

Changing states causing quickscrub to get cancelled and recentsView to
get reset to page 0, causing an abrupt jump.

Bug: 80537625
Bug: 80497058
Change-Id: I19cfe4380bbff15734b9d90dc31596904da27483
This commit is contained in:
Sunny Goyal
2018-06-01 12:18:19 -07:00
parent 87168ca1f7
commit d936f6a5e9
2 changed files with 19 additions and 2 deletions

View File

@@ -243,9 +243,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
if (wasVisible) {
DeviceProfile dp = activity.getDeviceProfile();
long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
activity.getStateManager().goToState(startState, false);
callback.accept(activity.getStateManager()
.createAnimationToNewWorkspace(endState, accuracy));
.createAnimationToNewWorkspace(startState, endState, accuracy));
return;
}

View File

@@ -296,6 +296,24 @@ public class LauncherStateManager {
}
}
/**
* Creates a {@link AnimatorPlaybackController} that can be used for a controlled
* state transition. The UI is force-set to fromState before creating the controller.
* @param fromState the initial state for the transition.
* @param state the final state for the transition.
* @param duration intended duration for normal playback. Use higher duration for better
* accuracy.
*/
public AnimatorPlaybackController createAnimationToNewWorkspace(
LauncherState fromState, LauncherState state, long duration) {
mConfig.reset();
for (StateHandler handler : getStateHandlers()) {
handler.setState(fromState);
}
return createAnimationToNewWorkspace(state, duration);
}
/**
* Creates a {@link AnimatorPlaybackController} that can be used for a controlled
* state transition.