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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user