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

Commit 65fc89ac authored by Winson Chung's avatar Winson Chung
Browse files

Don't hold the WM lock when canceling recents animation

Bug: 73968394
Test: Manual, just removing the lock into the controller, swipe up still
      works

Change-Id: Ifad09c83ca89ee48b37878a33e41b8a8dfc73e66
parent a29de13c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks {

            // Fetch all the surface controls and pass them to the client to get the animation
            // started
            mWindowManager.cancelRecentsAnimation();
            mWindowManager.initializeRecentsAnimation(recentsAnimationRunner, this,
                    display.mDisplayId);

+12 −10
Original line number Diff line number Diff line
@@ -256,6 +256,7 @@ public class RecentsAnimationController {

    void cancelAnimation() {
        if (DEBUG) Log.d(TAG, "cancelAnimation()");
        synchronized (mService.getWindowManagerLock()) {
            if (mCanceled) {
                // We've already canceled the animation
                return;
@@ -266,8 +267,9 @@ public class RecentsAnimationController {
            } catch (RemoteException e) {
                Slog.e(TAG, "Failed to cancel recents animation", e);
            }

        }
        // Clean up and return to the previous app
        // Don't hold the WM lock here as it calls back to AM/RecentsAnimation
        mCallbacks.onAnimationFinished(false /* moveHomeToTop */);
    }

+6 −7
Original line number Diff line number Diff line
@@ -2701,7 +2701,6 @@ public class WindowManagerService extends IWindowManager.Stub
            IRecentsAnimationRunner recentsAnimationRunner,
            RecentsAnimationController.RecentsAnimationCallbacks callbacks, int displayId) {
        synchronized (mWindowMap) {
            cancelRecentsAnimation();
            mRecentsAnimationController = new RecentsAnimationController(this,
                    recentsAnimationRunner, callbacks, displayId);
            mRecentsAnimationController.initialize();
@@ -2726,14 +2725,14 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    public void cancelRecentsAnimation() {
        synchronized (mWindowMap) {
        // Note: Do not hold the WM lock, this will lock appropriately in the call which also
        // calls through to AM/RecentsAnimation.onAnimationFinished()
        if (mRecentsAnimationController != null) {
            // This call will call through to cleanupAnimation() below after the animation is
            // canceled
            mRecentsAnimationController.cancelAnimation();
        }
    }
    }

    public void cleanupRecentsAnimation() {
        synchronized (mWindowMap) {