Consolidate two different onTransitionCancelled implementations
There was previously two different onTransitionCancelled(), one in
BaseActivityInterface and one in AnimationFactory. They are pretty
similar and the differences seem subtle and not necessary. In this
bug, the AnimationFactory version was going to mStartState instead
of StateManager#getRestState() (which is the same, unless mStartState
disables restore). Instead, always use the mActivityInterface
implemenation, which seems more robust.
Test: Open app A, open app B, quick switch from B to A, swipe home
during that transition, then touch nav region during home transtion;
ensure we don't goToState(BACKGROUND_APP) in the subsequent
onTransitionCanceled().
Fixes: 184583037
Change-Id: I315a5087b12413d88c3ccc1e3245a55a76a73e62
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index b7c6743..0a497bf 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -317,9 +317,9 @@
mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
this::invalidateHandlerWithLauncher);
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_RESUME_LAST_TASK,
- this::notifyTransitionCancelled);
+ this::resetStateForAnimationCancel);
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_FINISH_WITH_NO_END,
- this::notifyTransitionCancelled);
+ this::resetStateForAnimationCancel);
if (!LIVE_TILE.get()) {
mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT
@@ -1370,10 +1370,6 @@
mActivity.getRootView().setOnApplyWindowInsetsListener(null);
}
- private void notifyTransitionCancelled() {
- mAnimationFactory.onTransitionCancelled();
- }
-
private void resetStateForAnimationCancel() {
boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted;
mActivityInterface.onTransitionCancelled(wasVisible);
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 3afffc1..b9c2450 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -366,8 +366,6 @@
void createActivityInterface(long transitionLength);
- default void onTransitionCancelled() { }
-
/**
* @param attached Whether to show RecentsView alongside the app window. If false, recents
* will be hidden by some property we can animate, e.g. alpha.
@@ -434,11 +432,6 @@
}
@Override
- public void onTransitionCancelled() {
- mActivity.getStateManager().goToState(mStartState, false /* animate */);
- }
-
- @Override
public void setRecentsAttachedToAppWindow(boolean attached, boolean animate) {
if (mIsAttachedToWindow == attached && animate) {
return;