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

Commit 2722e5ce authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove hasCommittedReparentToAnimationLeash

For BackNavigationController:
It was added in commit 642b0d8c to avoid conflicting with manual
created leash, but commit 312da011 has changed it to regular
WC#startAnimation which will manage the leash by SurfaceAnimator.

Also the mPendingAnimationBuilder will run on onTransitionFinish,
but hasCommittedReparentToAnimationLeash doesn't mean that there
is a transition. That becomes an unpaired condition, so it should
not check that to set pending.

For AbsAppSnapshotController:
It was added for very old split screen when dismissing one side
(commit 7f1fa997). Since shell transition, there is no longer a
leash in core, so the condition for transition never satisfied.
And even the snapshot can still be taken successfully for the
original dismiss-split case.

Bug: 163976519
Flag: EXEMPT unused logic
Test: CtsWindowManagerDeviceActivity

Change-Id: Ic61e5736d7ad85064ce5f43edcd4c272d406c612
parent b770541d
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -382,12 +382,6 @@ abstract class AbsAppSnapshotController<TYPE extends WindowContainer,
            }
            return null;
        }
        if (activity.hasCommittedReparentToAnimationLeash()) {
            if (DEBUG_SCREENSHOT) {
                Slog.w(TAG_WM, "Failed to take screenshot. App is animating " + activity);
            }
            return null;
        }
        final WindowState mainWindow = activity.findMainWindow();
        if (mainWindow == null) {
            Slog.w(TAG_WM, "Failed to take screenshot. No main window for " + source);
+1 −2
Original line number Diff line number Diff line
@@ -357,8 +357,7 @@ class BackNavigationController {
                                removedWindowContainer);
                mBackAnimationInProgress = builder != null;
                if (mBackAnimationInProgress) {
                    if (removedWindowContainer.hasCommittedReparentToAnimationLeash()
                            || removedWindowContainer.mTransitionController.inTransition()
                    if (removedWindowContainer.mTransitionController.inTransition()
                            || mWindowManagerService.mSyncEngine.hasPendingSyncSets()) {
                        ProtoLog.w(WM_DEBUG_BACK_PREVIEW,
                                "Pending back animation due to another animation is running");
+0 −17
Original line number Diff line number Diff line
@@ -237,12 +237,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    /** Total number of elements in this subtree, including our own hierarchy element. */
    private int mTreeWeight = 1;

    /**
     * Indicates whether we are animating and have committed the transaction to reparent our
     * surface to the animation leash
     */
    private boolean mCommittedReparentToAnimationLeash;

    private int mSyncTransactionCommitCallbackDepth = 0;

    /** Interface for {@link #isAnimating} to check which cases for the container is animating. */
@@ -2871,22 +2865,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    }

    void prepareSurfaces() {
        // If a leash has been set when the transaction was committed, then the leash reparent has
        // been committed.
        mCommittedReparentToAnimationLeash = mSurfaceAnimator.hasLeash();
        for (int i = 0; i < mChildren.size(); i++) {
            mChildren.get(i).prepareSurfaces();
        }
    }

    /**
     * @return true if the reparent to animation leash transaction has been committed, false
     * otherwise.
     */
    boolean hasCommittedReparentToAnimationLeash() {
        return mCommittedReparentToAnimationLeash;
    }

    /**
     * Trigger a call to prepareSurfaces from the animation thread, such that pending transactions
     * will be applied.