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

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

Merge "Fixes two BackAnimationController crash from window focus change." into main

parents 4d29ed23 ccd1c01b
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -176,6 +176,10 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
    private StatusBarCustomizer mCustomizer;
    private boolean mTrackingLatency;

    // Keep previous navigation type before remove mBackNavigationInfo.
    @BackNavigationInfo.BackTargetType
    private int mPreviousNavigationType;

    public BackAnimationController(
            @NonNull ShellInit shellInit,
            @NonNull ShellController shellController,
@@ -871,6 +875,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
        mShellBackAnimationRegistry.resetDefaultCrossActivity();
        cancelLatencyTracking();
        if (mBackNavigationInfo != null) {
            mPreviousNavigationType = mBackNavigationInfo.getType();
            mBackNavigationInfo.onBackNavigationFinished(triggerBack);
            mBackNavigationInfo = null;
        }
@@ -983,7 +988,9 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                        mShellExecutor.execute(
                                () -> {
                                    if (!mShellBackAnimationRegistry.cancel(
                                            mBackNavigationInfo.getType())) {
                                            mBackNavigationInfo != null
                                                    ? mBackNavigationInfo.getType()
                                                    : mPreviousNavigationType)) {
                                        return;
                                    }
                                    if (!mBackGestureStarted) {
+3 −1
Original line number Diff line number Diff line
@@ -1596,7 +1596,9 @@ class BackNavigationController {
            // skip commitVisibility call in setVisibility cause the activity won't visible here.
            // Call it again to make sure the activity could be visible while handling the pending
            // animation.
            activity.commitVisibility(true, true);
            // Do not performLayout during prepare animation, because it could cause focus window
            // change. Let that happen after the BackNavigationInfo has returned to shell.
            activity.commitVisibility(true, false /* performLayout */);
            activity.mTransitionController.mSnapshotController
                    .mActivitySnapshotController.addOnBackPressedActivity(activity);
        }