Fixed flaky HintManagerServiceTest#testReportActualWorkDuration
The flake is related to the running sequence. If Object#notify() is called before Object#wait(), the latter will block forever. Using CountDownLatch to solve the problem. CountDownLatch#await() will wait until its count reaches 0. CountDownLatch with an initial count of 1, so the code after CountDownLatch#await() will only run after CountDownLatch#countDown() has been called. Bug: 277881247 Test: atest HintManagerServiceTest Test: verify by adding sleep between countdown() and await() Change-Id: I1a2b0fbec5f48f504107e3c031bf6e9f3ff571f5
Loading
Please register or sign in to comment