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

Commit 1cd3dae3 authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Clean up some dead code.

The close transition only be create in startPostCommitAnimation, so it
won't happen before startSystemAnimation. Also once the timeout happen,
shell will ask core to cancel the animation, so there won't have
"transition before animation" case.

Bug: 347168362
Flag: com.android.window.flags.migrate_predictive_back_transition
Test: atest BackAnimationControllerTest
Change-Id: Ice26762bd0c7eb8a7cdf5d6b010abdd9c1030d95
parent 9f8f7252
Loading
Loading
Loading
Loading
+12 −35
Original line number Diff line number Diff line
@@ -982,7 +982,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
        mShellBackAnimationRegistry.resetDefaultCrossActivity();
        cancelLatencyTracking();
        mReceivedNullNavigationInfo = false;
        mBackTransitionHandler.mLastTrigger = triggerBack;
        if (mBackNavigationInfo != null) {
            mPreviousNavigationType = mBackNavigationInfo.getType();
            mBackNavigationInfo.onBackNavigationFinished(triggerBack);
@@ -1103,7 +1102,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                                    endLatencyTracking();
                                    if (!validateAnimationTargets(apps)) {
                                        Log.e(TAG, "Invalid animation targets!");
                                        mBackTransitionHandler.consumeQueuedTransitionIfNeeded();
                                        return;
                                    }
                                    mBackAnimationFinishedCallback = finishedCallback;
@@ -1113,7 +1111,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                                        return;
                                    }
                                    kickStartAnimation();
                                    mBackTransitionHandler.consumeQueuedTransitionIfNeeded();
                                });
                    }

@@ -1121,7 +1118,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                    public void onAnimationCancelled() {
                        mShellExecutor.execute(
                                () -> {
                                    mBackTransitionHandler.consumeQueuedTransitionIfNeeded();
                                    if (!mShellBackAnimationRegistry.cancel(
                                            mBackNavigationInfo != null
                                                    ? mBackNavigationInfo.getType()
@@ -1160,8 +1156,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
        boolean mCloseTransitionRequested;
        SurfaceControl.Transaction mFinishOpenTransaction;
        Transitions.TransitionFinishCallback mFinishOpenTransitionCallback;
        QueuedTransition mQueuedTransition = null;
        boolean mLastTrigger;
        // The Transition to make behindActivity become visible
        IBinder mPrepareOpenTransition;
        // The Transition to make behindActivity become invisible, if prepare open exist and
@@ -1178,13 +1172,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            }
        }

        void consumeQueuedTransitionIfNeeded() {
            if (mQueuedTransition != null) {
                mQueuedTransition.consume();
                mQueuedTransition = null;
            }
        }

        private void applyFinishOpenTransition() {
            mOpenTransitionInfo = null;
            mPrepareOpenTransition = null;
@@ -1215,7 +1202,9 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                @NonNull SurfaceControl.Transaction st,
                @NonNull SurfaceControl.Transaction ft,
                @NonNull Transitions.TransitionFinishCallback finishCallback) {
            if (info.getType() == WindowManager.TRANSIT_PREPARE_BACK_NAVIGATION) {
            final boolean isPrepareTransition =
                    info.getType() == WindowManager.TRANSIT_PREPARE_BACK_NAVIGATION;
            if (isPrepareTransition) {
                kickStartAnimation();
            }
            // Both mShellExecutor and Transitions#mMainExecutor are ShellMainThread, so we don't
@@ -1240,23 +1229,16 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            }

            if (mApps == null || mApps.length == 0) {
                if (mBackNavigationInfo != null && mShellBackAnimationRegistry
                        .isWaitingAnimation(mBackNavigationInfo.getType())) {
                    // Waiting for animation? Queue update to wait for animation start.
                    consumeQueuedTransitionIfNeeded();
                    mQueuedTransition = new QueuedTransition(info, st, ft, finishCallback);
                    return true;
                } else if (mLastTrigger) {
                    // animation was done, consume directly
                if (mCloseTransitionRequested) {
                    // animation never start, consume directly
                    applyAndFinish(st, ft, finishCallback);
                    return true;
                } else {
                    // animation was cancelled but transition haven't happen, we must handle it
                    if (mClosePrepareTransition == null && mCurrentTracker.isFinished()) {
                } else if (mClosePrepareTransition == null && isPrepareTransition) {
                    // Gesture animation was cancelled before prepare transition ready, create the
                    // the close prepare transition
                    createClosePrepareTransition();
                }
            }
            }

            if (handlePrepareTransition(info, st, ft, finishCallback)) {
                return true;
@@ -1413,9 +1395,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                if (mPrepareOpenTransition != null) {
                    applyFinishOpenTransition();
                }
                if (mQueuedTransition != null) {
                    consumeQueuedTransitionIfNeeded();
                }
                return;
            }
            // Handle the commit transition if this handler is running the open transition.
@@ -1423,11 +1402,9 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            t.apply();
            if (mCloseTransitionRequested) {
                if (mApps == null || mApps.length == 0) {
                    if (mQueuedTransition == null) {
                    // animation was done
                    applyFinishOpenTransition();
                    mCloseTransitionRequested = false;
                    } // let queued transition finish.
                } else {
                    // we are animating, wait until animation finish
                    mOnAnimationFinishCallback = () -> {