Merge "Process all messages of TestLooper after each test" into rvc-dev
diff --git a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java
index 7ac5443..a36f2c7 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 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();
     }