Fix flakiness of testTransferLaunchCookie
The count down latch is triggered too early that the value
to be verified may not have been set.
Fixes: 194183975
Test: atest ActivityOptionsTest#testTransferLaunchCookie
Change-Id: I3b78db921a178e2df970a85496ae5238b5bd6fb3
(cherry picked from commit c10eb7b18d)
This commit is contained in:
@@ -110,18 +110,20 @@ public class ActivityOptionsTest {
|
||||
@Override
|
||||
public void onTaskAppeared(RunningTaskInfo taskInfo, SurfaceControl leash) {
|
||||
try (SurfaceControl.Transaction t = new SurfaceControl.Transaction()) {
|
||||
t.setVisibility(leash, true /* visible */).apply();
|
||||
t.show(leash).apply();
|
||||
}
|
||||
int cookieIndex = -1;
|
||||
if (trampoline.equals(taskInfo.baseActivity)) {
|
||||
cookieIndex = 0;
|
||||
} else if (main.equals(taskInfo.baseActivity)) {
|
||||
cookieIndex = 1;
|
||||
mainLatch.countDown();
|
||||
}
|
||||
if (cookieIndex >= 0) {
|
||||
appearedCookies[cookieIndex] = taskInfo.launchCookies.isEmpty()
|
||||
? null : taskInfo.launchCookies.get(0);
|
||||
if (cookieIndex == 1) {
|
||||
mainLatch.countDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user