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

Commit 00c7240a authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE crash from scheduleAnimation after cancelPendingAnimation." into main

parents ac45efa0 d3e54415
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -843,14 +843,14 @@ class BackNavigationController {
     * @param targets The final animation targets derived in transition.
     * @param finishedTransition The finished transition target.
    */
    boolean onTransitionFinish(ArrayList<Transition.ChangeInfo> targets,
    void onTransitionFinish(ArrayList<Transition.ChangeInfo> targets,
            @NonNull Transition finishedTransition) {
        if (finishedTransition == mWaitTransitionFinish) {
            clearBackAnimations();
        }

        if (!mBackAnimationInProgress || mPendingAnimationBuilder == null) {
            return false;
            return;
        }
        ProtoLog.d(WM_DEBUG_BACK_PREVIEW,
                "Handling the deferred animation after transition finished");
@@ -878,7 +878,7 @@ class BackNavigationController {
                    + " open: " + Arrays.toString(mPendingAnimationBuilder.mOpenTargets)
                    + " close: " + mPendingAnimationBuilder.mCloseTarget);
            cancelPendingAnimation();
            return false;
            return;
        }

        // Ensure the final animation targets which hidden by transition could be visible.
@@ -887,9 +887,14 @@ class BackNavigationController {
            wc.prepareSurfaces();
        }

        // The pending builder could be cleared due to prepareSurfaces
        // => updateNonSystemOverlayWindowsVisibilityIfNeeded
        // => setForceHideNonSystemOverlayWindowIfNeeded
        // => updateFocusedWindowLocked => onFocusWindowChanged.
        if (mPendingAnimationBuilder != null) {
            scheduleAnimation(mPendingAnimationBuilder);
            mPendingAnimationBuilder = null;
        return true;
        }
    }

    private void cancelPendingAnimation() {