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

Commit 46aacef9 authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Wait enough time for WMS#waitForAnimationsToComplete

As CL[1] added more log for tracking animating container in
waitForAnimationsToComplete, which accidentally ignored waiting
enough time when WindowAnimator#isAnimationScheduled has set but not
yet having animating container, in case syncInputTransactions going too
earily and tests might flaky when verifying input events should be
touched but WindowAnimator is still animate, we should wait enough
time when the animation scheduling to WindowAnimator.

[1]: I2c0370d6abe0f726891cedd39b6f8fa9fd366e94

Bug: 188904558
Test: atest -bidt WindowUntrustedTouchTest --iteration 50

Change-Id: I3b009e23e7a43d0f450e7f4aef4d13c0f4e04547
parent 0cdfb5fd
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -8091,11 +8091,10 @@ public class WindowManagerService extends IWindowManager.Stub
            // This could prevent if there is no container animation, we still have to apply the
            // pending transaction and exit waiting.
            mAnimator.mNotifyWhenNoAnimation = true;
            WindowContainer animatingContainer = null;
            while (mAnimator.isAnimationScheduled() || timeoutRemaining > 0) {
                animatingContainer = mRoot.getAnimatingContainer(TRANSITION | CHILDREN,
                        ANIMATION_TYPE_ALL);
                if (animatingContainer == null) {
            while (timeoutRemaining > 0) {
                boolean isAnimating = mAnimator.isAnimationScheduled()
                        || mRoot.isAnimating(TRANSITION | CHILDREN, ANIMATION_TYPE_ALL);
                if (!isAnimating) {
                    break;
                }
                long startTime = System.currentTimeMillis();
@@ -8107,6 +8106,9 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            mAnimator.mNotifyWhenNoAnimation = false;

            WindowContainer animatingContainer;
            animatingContainer = mRoot.getAnimatingContainer(TRANSITION | CHILDREN,
                    ANIMATION_TYPE_ALL);
            if (mAnimator.isAnimationScheduled() || animatingContainer != null) {
                Slog.w(TAG, "Timed out waiting for animations to complete,"
                        + " animatingContainer=" + animatingContainer