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

Commit 6ba767a8 authored by Winson Chung's avatar Winson Chung
Browse files

Fix issue with animation handler deadlock

- Stop synchronously fetching the choreographer on the animation thread as
  the animation thread may be processing an update with the WM lock already
  held
- Revert to using AnimationThread

Bug: 120844232
Test: Manual
Change-Id: Ia9cc3d2e0e2bf8740f2725fe59d12a31a67b1b89
parent 7d472585
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -128,9 +128,10 @@ public class BoundsAnimationController {
        mAnimationHandler = animationHandler;
        mAnimationHandler = animationHandler;
        if (animationHandler != null) {
        if (animationHandler != null) {
            // If an animation handler is provided, then ensure that it runs on the sf vsync tick
            // If an animation handler is provided, then ensure that it runs on the sf vsync tick
            handler.runWithScissors(() -> mChoreographer = Choreographer.getSfInstance(),
            handler.post(() -> {
                    0 /* timeout */);
                mChoreographer = Choreographer.getSfInstance();
                animationHandler.setProvider(new SfVsyncFrameCallbackProvider(mChoreographer));
                animationHandler.setProvider(new SfVsyncFrameCallbackProvider(mChoreographer));
            });
        }
        }
    }
    }


+3 −2
Original line number Original line Diff line number Diff line
@@ -61,9 +61,9 @@ import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;

import static android.view.WindowManager.TRANSIT_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;
import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;

import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
@@ -169,6 +169,7 @@ import android.view.WindowManagerPolicyConstants.PointerEventListener;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ToBooleanFunction;
import com.android.internal.util.ToBooleanFunction;
import com.android.internal.util.function.TriConsumer;
import com.android.internal.util.function.TriConsumer;
import com.android.server.AnimationThread;
import com.android.server.policy.WindowManagerPolicy;
import com.android.server.policy.WindowManagerPolicy;
import com.android.server.wm.utils.DisplayRotationUtil;
import com.android.server.wm.utils.DisplayRotationUtil;
import com.android.server.wm.utils.RotationCache;
import com.android.server.wm.utils.RotationCache;
@@ -861,7 +862,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo


        AnimationHandler animationHandler = new AnimationHandler();
        AnimationHandler animationHandler = new AnimationHandler();
        mBoundsAnimationController = new BoundsAnimationController(service.mContext,
        mBoundsAnimationController = new BoundsAnimationController(service.mContext,
                mAppTransition, SurfaceAnimationThread.getHandler(), animationHandler);
                mAppTransition, AnimationThread.getHandler(), animationHandler);


        if (mWmService.mInputManager != null) {
        if (mWmService.mInputManager != null) {
            final InputChannel inputChannel = mWmService.mInputManager.monitorInput("Display "
            final InputChannel inputChannel = mWmService.mInputManager.monitorInput("Display "