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

Commit ad7faeac authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Clear out all message on WM handler on WindowManagerServiceRule tearDown

Hoping this will help reduce some test flakiness.

Bug: 120502773
Test: self
Change-Id: Ic5b75f5cc2e703363e3d689a8591f2fe7d93437e
parent b9870f9b
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -173,22 +173,22 @@ public class WindowManagerServiceRule implements TestRule {
        };
    }

    public WindowManagerService getWindowManagerService() {
    WindowManagerService getWindowManagerService() {
        return mService;
    }

    public TestWindowManagerPolicy getWindowManagerPolicy() {
        return mPolicy;
    }

    public void waitUntilWindowManagerHandlersIdle() {
    void waitUntilWindowManagerHandlersIdle() {
        final WindowManagerService wm = getWindowManagerService();
        if (wm != null) {
        if (wm == null) {
            return;
        }
        wm.mH.removeCallbacksAndMessages(null);
        wm.mAnimationHandler.removeCallbacksAndMessages(null);
        SurfaceAnimationThread.getHandler().removeCallbacksAndMessages(null);
        wm.mH.runWithScissors(() -> { }, 0);
        wm.mAnimationHandler.runWithScissors(() -> { }, 0);
        SurfaceAnimationThread.getHandler().runWithScissors(() -> { }, 0);
    }
    }

    private void destroyAllSurfaceTransactions() {
        for (final WeakReference<Transaction> reference : mSurfaceTransactions) {