Merge "Clean up AnimationThread default handler"

This commit is contained in:
TreeHugger Robot
2019-11-21 23:39:42 +00:00
committed by Android (Google) Code Review
3 changed files with 9 additions and 1 deletions

View File

@@ -40,6 +40,10 @@ class SystemServiceTestsBase {
mLockRule.waitForLocked(mSystemServicesTestRule::waitUntilWindowManagerHandlersIdle);
}
void cleanupWindowManagerHandlers() {
mLockRule.waitForLocked(mSystemServicesTestRule::cleanupWindowManagerHandlers);
}
boolean waitHandlerIdle(Handler handler) {
return waitHandlerIdle(handler, 0 /* timeout */);
}

View File

@@ -355,6 +355,8 @@ public class SystemServicesTestRule implements TestRule {
}
wm.mH.removeCallbacksAndMessages(null);
wm.mAnimationHandler.removeCallbacksAndMessages(null);
// This is a different handler object than the wm.mAnimationHandler above.
AnimationThread.getHandler().removeCallbacksAndMessages(null);
SurfaceAnimationThread.getHandler().removeCallbacksAndMessages(null);
}
@@ -367,6 +369,8 @@ public class SystemServicesTestRule implements TestRule {
wm.mH.removeMessages(WindowManagerService.H.FORCE_GC);
waitHandlerIdle(wm.mH);
waitHandlerIdle(wm.mAnimationHandler);
// This is a different handler object than the wm.mAnimationHandler above.
waitHandlerIdle(AnimationThread.getHandler());
waitHandlerIdle(SurfaceAnimationThread.getHandler());
}

View File

@@ -175,7 +175,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
}
// Cleaned up everything in Handler.
mSystemServicesTestRule.cleanupWindowManagerHandlers();
cleanupWindowManagerHandlers();
} catch (Exception e) {
Log.e(TAG, "Failed to tear down test", e);
throw e;