Merge "Fix issues with starting new recents animation before previous onRecentsAnimationStart" into sc-v2-dev
This commit is contained in:
commit
f9d2082cf3
|
@ -1049,6 +1049,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||||
isFling, isCancel);
|
isFling, isCancel);
|
||||||
// Set the state, but don't notify until the animation completes
|
// Set the state, but don't notify until the animation completes
|
||||||
mGestureState.setEndTarget(endTarget, false /* isAtomic */);
|
mGestureState.setEndTarget(endTarget, false /* isAtomic */);
|
||||||
|
mAnimationFactory.setEndTarget(endTarget);
|
||||||
|
|
||||||
float endShift = endTarget.isLauncher ? 1 : 0;
|
float endShift = endTarget.isLauncher ? 1 : 0;
|
||||||
final float startShift;
|
final float startShift;
|
||||||
|
@ -1466,7 +1467,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||||
mActivity.clearRunOnceOnStartCallback();
|
mActivity.clearRunOnceOnStartCallback();
|
||||||
resetLauncherListeners();
|
resetLauncherListeners();
|
||||||
}
|
}
|
||||||
if (mGestureState.getEndTarget() != null && !mGestureState.isRunningAnimationToLauncher()) {
|
if (mGestureState.isRecentsAnimationRunning() && mGestureState.getEndTarget() != null
|
||||||
|
&& !mGestureState.getEndTarget().isLauncher) {
|
||||||
|
// Continued quick switch.
|
||||||
cancelCurrentAnimation();
|
cancelCurrentAnimation();
|
||||||
} else {
|
} else {
|
||||||
mStateCallback.setStateOnUiThread(STATE_FINISH_WITH_NO_END);
|
mStateCallback.setStateOnUiThread(STATE_FINISH_WITH_NO_END);
|
||||||
|
|
|
@ -77,12 +77,14 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||||
|
|
||||||
public final boolean rotationSupportedByActivity;
|
public final boolean rotationSupportedByActivity;
|
||||||
|
|
||||||
private final STATE_TYPE mOverviewState, mBackgroundState;
|
private final STATE_TYPE mBackgroundState;
|
||||||
|
|
||||||
|
private STATE_TYPE mTargetState;
|
||||||
|
|
||||||
protected BaseActivityInterface(boolean rotationSupportedByActivity,
|
protected BaseActivityInterface(boolean rotationSupportedByActivity,
|
||||||
STATE_TYPE overviewState, STATE_TYPE backgroundState) {
|
STATE_TYPE overviewState, STATE_TYPE backgroundState) {
|
||||||
this.rotationSupportedByActivity = rotationSupportedByActivity;
|
this.rotationSupportedByActivity = rotationSupportedByActivity;
|
||||||
mOverviewState = overviewState;
|
mTargetState = overviewState;
|
||||||
mBackgroundState = backgroundState;
|
mBackgroundState = backgroundState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,6 +414,9 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||||
default boolean hasRecentsEverAttachedToAppWindow() {
|
default boolean hasRecentsEverAttachedToAppWindow() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Called when the gesture ends and we know what state it is going towards */
|
||||||
|
default void setEndTarget(GestureState.GestureEndTarget endTarget) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class DefaultAnimationFactory implements AnimationFactory {
|
class DefaultAnimationFactory implements AnimationFactory {
|
||||||
|
@ -449,7 +454,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||||
|
|
||||||
// Since we are changing the start position of the UI, reapply the state, at the end
|
// Since we are changing the start position of the UI, reapply the state, at the end
|
||||||
controller.setEndAction(() -> mActivity.getStateManager().goToState(
|
controller.setEndAction(() -> mActivity.getStateManager().goToState(
|
||||||
controller.getInterpolatedProgress() > 0.5 ? mOverviewState : mBackgroundState,
|
controller.getInterpolatedProgress() > 0.5 ? mTargetState : mBackgroundState,
|
||||||
false));
|
false));
|
||||||
|
|
||||||
RecentsView recentsView = mActivity.getOverviewPanel();
|
RecentsView recentsView = mActivity.getOverviewPanel();
|
||||||
|
@ -512,6 +517,11 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||||
return mHasEverAttachedToWindow;
|
return mHasEverAttachedToWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEndTarget(GestureState.GestureEndTarget endTarget) {
|
||||||
|
mTargetState = stateFromGestureEndTarget(endTarget);
|
||||||
|
}
|
||||||
|
|
||||||
protected void createBackgroundToOverviewAnim(ACTIVITY_TYPE activity, PendingAnimation pa) {
|
protected void createBackgroundToOverviewAnim(ACTIVITY_TYPE activity, PendingAnimation pa) {
|
||||||
// Scale down recents from being full screen to being in overview.
|
// Scale down recents from being full screen to being in overview.
|
||||||
RecentsView recentsView = activity.getOverviewPanel();
|
RecentsView recentsView = activity.getOverviewPanel();
|
||||||
|
|
|
@ -346,8 +346,8 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||||
* @return whether the recents animation is started but not yet ended
|
* @return whether the recents animation is started but not yet ended
|
||||||
*/
|
*/
|
||||||
public boolean isRecentsAnimationRunning() {
|
public boolean isRecentsAnimationRunning() {
|
||||||
return mStateCallback.hasStates(STATE_RECENTS_ANIMATION_INITIALIZED) &&
|
return mStateCallback.hasStates(STATE_RECENTS_ANIMATION_STARTED)
|
||||||
!mStateCallback.hasStates(STATE_RECENTS_ANIMATION_ENDED);
|
&& !mStateCallback.hasStates(STATE_RECENTS_ANIMATION_ENDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -107,6 +107,13 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||||
// But force-finish it anyways
|
// But force-finish it anyways
|
||||||
finishRunningRecentsAnimation(false /* toHome */);
|
finishRunningRecentsAnimation(false /* toHome */);
|
||||||
|
|
||||||
|
if (mCallbacks != null) {
|
||||||
|
// If mCallbacks still != null, that means we are getting this startRecentsAnimation()
|
||||||
|
// before the previous one got onRecentsAnimationStart(). In that case, cleanup the
|
||||||
|
// previous animation so it doesn't mess up/listen to state changes in this animation.
|
||||||
|
cleanUpRecentsAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
final BaseActivityInterface activityInterface = gestureState.getActivityInterface();
|
final BaseActivityInterface activityInterface = gestureState.getActivityInterface();
|
||||||
mLastGestureState = gestureState;
|
mLastGestureState = gestureState;
|
||||||
mCallbacks = new RecentsAnimationCallbacks(SystemUiProxy.INSTANCE.get(mCtx),
|
mCallbacks = new RecentsAnimationCallbacks(SystemUiProxy.INSTANCE.get(mCtx),
|
||||||
|
|
Loading…
Reference in New Issue