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

Commit a56e8da7 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Don't hold the WM lock when canceling recents animation"

parents 668b5ca9 65fc89ac
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -134,6 +134,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks {


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


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


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

        }
        // Clean up and return to the previous app
        // 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 */);
        mCallbacks.onAnimationFinished(false /* moveHomeToTop */);
    }
    }


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


    public void cancelRecentsAnimation() {
    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) {
        if (mRecentsAnimationController != null) {
            // This call will call through to cleanupAnimation() below after the animation is
            // This call will call through to cleanupAnimation() below after the animation is
            // canceled
            // canceled
            mRecentsAnimationController.cancelAnimation();
            mRecentsAnimationController.cancelAnimation();
        }
        }
    }
    }
    }


    public void cleanupRecentsAnimation() {
    public void cleanupRecentsAnimation() {
        synchronized (mWindowMap) {
        synchronized (mWindowMap) {