From 022e6635d6f68371710e78aba504f8443284abc2 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 24 Feb 2020 15:18:05 -0500 Subject: [PATCH] Process all messages of TestLooper after each test So that they won't process messages during the next test. Test: atest SystemUITests Fixes: 149740127 Change-Id: I082231b8f544f8b71f3404d247e10c3967c1c972 --- .../tests/src/com/android/systemui/SysuiTestCase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java index 7ac5443d67d04..a36f2c7542435 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +++ b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java @@ -86,7 +86,9 @@ public abstract class SysuiTestCase { public void SysuiTeardown() { InstrumentationRegistry.registerInstance(mRealInstrumentation, InstrumentationRegistry.getArguments()); - // Reset the assert's testable looper to null. + if (TestableLooper.get(this) != null) { + TestableLooper.get(this).processAllMessages(); + } disallowTestableLooperAsMainThread(); SystemUIFactory.cleanup(); }