Explicitly add "flush-broadcast-loopers" option.

Recently, flushing the broadcast loopers behavior, when
"wait-for-broadcast-barrier" command is invoked, is made
optional which resulted in some regressions in multi-user
tests as they same to be relying on flushing the broadcast
loopers behavior. So, explicitly add this option when
invoking the command.

Bug: 282848750
Test: atest android.multiuser.UserLifecycleTests
Change-Id: I6ba4e0858a63653b731c7a24b600ce9af758d39c
This commit is contained in:
Sudheer Shanka
2023-05-18 13:40:57 -07:00
parent 31781318f0
commit 6eb0f68b0b
2 changed files with 4 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ public class BenchmarkRunner {
private void prepareForNextRun() {
SystemClock.sleep(COOL_OFF_PERIOD_MS);
ShellHelper.runShellCommand("am wait-for-broadcast-idle");
ShellHelper.runShellCommand("am wait-for-broadcast-idle --flush-broadcast-loopers");
mStartTimeNs = System.nanoTime();
mPausedDurationNs = 0;
}
@@ -102,7 +102,7 @@ public class BenchmarkRunner {
* to avoid unnecessary waiting.
*/
public void resumeTiming() {
ShellHelper.runShellCommand("am wait-for-broadcast-idle");
ShellHelper.runShellCommand("am wait-for-broadcast-idle --flush-broadcast-loopers");
resumeTimer();
}

View File

@@ -1541,7 +1541,8 @@ public class UserLifecycleTests {
private void waitForBroadcastIdle() {
try {
ShellHelper.runShellCommandWithTimeout("am wait-for-broadcast-idle", TIMEOUT_IN_SECOND);
ShellHelper.runShellCommandWithTimeout(
"am wait-for-broadcast-idle --flush-broadcast-loopers", TIMEOUT_IN_SECOND);
} catch (TimeoutException e) {
Log.e(TAG, "Ending waitForBroadcastIdle because it is taking too long", e);
}