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

Commit 85933f76 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Cleanup pending Handler messages after test finished"

parents 3e06fd00 a5f7c2c9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -198,8 +198,8 @@ class WindowTestsBase {
                mDisplayContent.mInputMethodTarget = null;
            }

            // Wait until everything is really cleaned up.
            waitUntilHandlersIdle();
            // Cleaned up everything in Handler.
            WmServiceUtils.cleanupWindowManagerHandlers();
        } catch (Exception e) {
            Log.e(TAG, "Failed to tear down test", e);
            throw e;
+10 −0
Original line number Diff line number Diff line
@@ -171,6 +171,16 @@ class WmServiceUtils {
        return sService;
    }

    static void cleanupWindowManagerHandlers() {
        final WindowManagerService wm = getWindowManagerService();
        if (wm == null) {
            return;
        }
        wm.mH.removeCallbacksAndMessages(null);
        wm.mAnimationHandler.removeCallbacksAndMessages(null);
        SurfaceAnimationThread.getHandler().removeCallbacksAndMessages(null);
    }

    static void waitUntilWindowManagerHandlersIdle() {
        final WindowManagerService wm = getWindowManagerService();
        if (wm == null) {