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

Commit ebcb9c1e authored by Louis Chang's avatar Louis Chang
Browse files

Attempts fixing test flakiness

There is a race condition between the test and the launched
activity, which could result in NullPointerException and
break the test.

Bug: 289865322
Test: atest ActivityThreadTest over 500 times on cf
Change-Id: I1e13c9c1dd796296263de0984675311866ba61f3
parent c9f03886
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -884,12 +884,13 @@ public class ActivityThreadTest {
            mConfig.setTo(config);
            ++mNumOfConfigChanges;

            if (mConfigLatch != null) {
            final CountDownLatch configLatch = mConfigLatch;
            if (configLatch != null) {
                if (mTestLatch != null) {
                    mTestLatch.countDown();
                }
                try {
                    mConfigLatch.await(TIMEOUT_SEC, TimeUnit.SECONDS);
                    configLatch.await(TIMEOUT_SEC, TimeUnit.SECONDS);
                } catch (InterruptedException e) {
                    throw new IllegalStateException(e);
                }