Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0112a3d4 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

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
parent 9ee4e86c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
        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 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
            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 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
                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 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
        if (mGestureState.getEndTarget() != null && !mGestureState.isRunningAnimationToLauncher()) {
            cancelCurrentAnimation();
        } else {
            mStateCallback.setStateOnUiThread(STATE_FINISH_WITH_NO_END);
            reset();
        }
    }