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

Commit 8c7067cc authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Add more logs in WindowManagerService#waitForAnimationsToComplete

For easier to know why syncInputTransactions failed to wait which
window container and which type of animation.

Bug: 188244674
Test: atest CtsWindowManagerDeviceTests
Change-Id: I2c0370d6abe0f726891cedd39b6f8fa9fd366e94
parent 63a14538
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -520,7 +520,7 @@ class SurfaceAnimator {
    /**
     * Converts {@link AnimationType} to String.
     */
    private static String animationTypeToString(@AnimationType int type) {
    static String animationTypeToString(@AnimationType int type) {
        switch (type) {
            case ANIMATION_TYPE_NONE: return "none";
            case ANIMATION_TYPE_APP_TRANSITION: return "app_transition";
+15 −5
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON
import static com.android.server.wm.DisplayContent.IME_TARGET_CONTROL;
import static com.android.server.wm.DisplayContent.IME_TARGET_INPUT;
import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL;
import static com.android.server.wm.WindowContainer.AnimationFlags.CHILDREN;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
@@ -8090,8 +8091,13 @@ 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;
            while ((mAnimator.isAnimationScheduled()
                    || mRoot.isAnimating(TRANSITION | CHILDREN)) && timeoutRemaining > 0) {
            WindowContainer animatingContainer = null;
            while (mAnimator.isAnimationScheduled() || timeoutRemaining > 0) {
                animatingContainer = mRoot.getAnimatingContainer(TRANSITION | CHILDREN,
                        ANIMATION_TYPE_ALL);
                if (animatingContainer == null) {
                    break;
                }
                long startTime = System.currentTimeMillis();
                try {
                    mGlobalLock.wait(timeoutRemaining);
@@ -8101,9 +8107,13 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            mAnimator.mNotifyWhenNoAnimation = false;

            if (mAnimator.isAnimationScheduled()
                    || mRoot.isAnimating(TRANSITION | CHILDREN)) {
                Slog.w(TAG, "Timed out waiting for animations to complete.");
            if (mAnimator.isAnimationScheduled() || animatingContainer != null) {
                Slog.w(TAG, "Timed out waiting for animations to complete,"
                        + " animatingContainer=" + animatingContainer
                        + " animationType=" + SurfaceAnimator.animationTypeToString(
                        animatingContainer != null
                                ? animatingContainer.mSurfaceAnimator.getAnimationType()
                                : SurfaceAnimator.ANIMATION_TYPE_NONE));
            }
        }
    }