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

Commit 10dfeb22 authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

[PB] Do not reset launch behind if the prepare_back transition exists.

If the prepare open transition is already created(no matter is
collecting or playing), core shouldn't reset the launch behind state directly, let the close_prepare_back transition to collect the change.

Flag: com.android.window.flags.migrate_predictive_back_transition
Bug: 340386663
Test: tap a button near the edge of device to create a window and
trigger PB transition, then tap outside to close the window.
Repeat multiple times to verify the visibility state always being
collect with transition.

Change-Id: I6a3b19964d6f6f63e0778aad5260baaf7b8f9e66
parent c2fc6685
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -761,7 +761,7 @@ class BackNavigationController {
            if (isMonitorForRemote()) {
                mObserver.sendResult(null /* result */);
            }
            if (isMonitorAnimationOrTransition()) {
            if (isMonitorAnimationOrTransition() && canCancelAnimations()) {
                clearBackAnimations(true /* cancel */);
            }
            cancelPendingAnimation();
@@ -2053,11 +2053,22 @@ class BackNavigationController {
        }
    }

    /** If the open transition is playing, wait for transition to clear the animation */
    private boolean canCancelAnimations() {
        if (!Flags.migratePredictiveBackTransition()) {
            return true;
        }
        return mAnimationHandler.mOpenAnimAdaptor == null
                || mAnimationHandler.mOpenAnimAdaptor.mPreparedOpenTransition == null;
    }

    void startAnimation() {
        if (!mBackAnimationInProgress) {
            // gesture is already finished, do not start animation
            if (mPendingAnimation != null) {
                if (canCancelAnimations()) {
                    clearBackAnimations(true /* cancel */);
                }
                mPendingAnimation = null;
            }
            return;