Fixing animation cancelled not called if gesture was not initiated
Previously, in case of a tap in the gesture region, swipeHandler was not
explicitly cancelling the launcher state animation. It was getting reset
bucause launcher gets onStop immediately after that.
But in some cases, it may not get onStop (if the top activity finishes),
which leaves the Launcher UI in a broken state
Bug: 172842997
Change-Id: Iff7b1e5b8f67b2f4dd8096b88c4cd97115ec912a
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 041f679..5ba3f6a 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -123,7 +123,7 @@
RecentsAnimationCallbacks.RecentsAnimationListener {
private static final String TAG = "AbsSwipeUpHandler";
- private static final String[] STATE_NAMES = DEBUG_STATES ? new String[16] : null;
+ private static final String[] STATE_NAMES = DEBUG_STATES ? new String[17] : null;
protected final BaseActivityInterface<?, T> mActivityInterface;
protected final InputConsumerProxy mInputConsumerProxy;
@@ -185,6 +185,8 @@
getFlagForIndex(14, "STATE_START_NEW_TASK");
private static final int STATE_CURRENT_TASK_FINISHED =
getFlagForIndex(15, "STATE_CURRENT_TASK_FINISHED");
+ private static final int STATE_FINISH_WITH_NO_END =
+ getFlagForIndex(16, "STATE_FINISH_WITH_NO_END");
private static final int LAUNCHER_UI_STATES =
STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_LAUNCHER_STARTED;
@@ -306,6 +308,8 @@
this::invalidateHandlerWithLauncher);
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_RESUME_LAST_TASK,
this::notifyTransitionCancelled);
+ mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_FINISH_WITH_NO_END,
+ this::notifyTransitionCancelled);
if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) {
mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT
@@ -1257,6 +1261,7 @@
if (mGestureState.getEndTarget() != null && !mGestureState.isRunningAnimationToLauncher()) {
cancelCurrentAnimation();
} else {
+ mStateCallback.setStateOnUiThread(STATE_FINISH_WITH_NO_END);
reset();
}
}