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

Commit daa70502 authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Android (Google) Code Review
Browse files

Merge "Fix unrecoverable bad state in BackAnimationController" into main

parents 6ef60da6 b72794f8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
    @ShellMainThread private final Handler mHandler;

    /** True when a back gesture is ongoing */
    private boolean mBackGestureStarted = false;
    @VisibleForTesting public boolean mBackGestureStarted = false;

    /** Tracks if an uninterruptible animation is in progress */
    private boolean mPostCommitAnimationInProgress = false;
@@ -511,6 +511,11 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            ProtoLog.d(WM_SHELL_BACK_PREVIEW,
                    "Ignoring MotionEvent because two gestures are already being queued.");
            return;
        } else if (mBackGestureStarted && mCurrentTracker.isInInitialState()
                && mQueuedTracker.isInInitialState()) {
            ProtoLog.e(WM_SHELL_BACK_PREVIEW,
                    "Both touch trackers in initial state and mBackGestureStarted=true");
            mBackGestureStarted = false;
        }

        if (keyAction == MotionEvent.ACTION_DOWN) {
+8 −0
Original line number Diff line number Diff line
@@ -776,6 +776,14 @@ public class BackAnimationControllerTest extends ShellTestCase {
        verify(mergeCallback, never()).onTransitionFinished(any());
    }

    @Test
    public void testBackAnimationControllersRecoversFromBadState() throws RemoteException {
        // put controller into bad state (initial state but mBackGestureStarted=true)
        mController.mBackGestureStarted = true;
        verifySystemBackBehavior(BackNavigationInfo.TYPE_CROSS_ACTIVITY,
                mDefaultCrossActivityBackAnimation.getRunner());
    }

    private RemoteAnimationTarget[] createAppAnimationTargets(int openTaskId, int closeTaskId) {
        final RemoteAnimationTarget openT = createSingleAnimationTarget(openTaskId,
                RemoteAnimationTarget.MODE_OPENING);