Fix boot time includes shutdown time issue that mention in

b/236799228#comment39

Bug: 236799228
Test: atest AVFHostTestCases
Change-Id: I40d0c07a60e9e0bff262c4bd71405bf124bac073
This commit is contained in:
guile 2022-09-02 10:33:34 +08:00
parent e042804536
commit ae6731af71
1 changed files with 5 additions and 4 deletions

View File

@ -121,8 +121,9 @@ public final class AVFHostTestCase extends MicrodroidHostTestCaseBase {
// Boot time with compilation OS test.
reInstallApex(REINSTALL_APEX_TIMEOUT_SEC);
compileStagedApex(COMPILE_STAGED_APEX_TIMEOUT_SEC);
getDevice().nonBlockingReboot();
long start = System.nanoTime();
rebootAndWaitBootCompleted();
waitForBootCompleted();
long elapsedWithCompOS = System.nanoTime() - start;
double elapsedSec = elapsedWithCompOS / NANOS_IN_SEC;
bootWithCompOsTime[round] = elapsedSec;
@ -130,8 +131,9 @@ public final class AVFHostTestCase extends MicrodroidHostTestCaseBase {
// Boot time without compilation OS test.
reInstallApex(REINSTALL_APEX_TIMEOUT_SEC);
getDevice().nonBlockingReboot();
start = System.nanoTime();
rebootAndWaitBootCompleted();
waitForBootCompleted();
long elapsedWithoutCompOS = System.nanoTime() - start;
elapsedSec = elapsedWithoutCompOS / NANOS_IN_SEC;
bootWithoutCompOsTime[round] = elapsedSec;
@ -216,8 +218,7 @@ public final class AVFHostTestCase extends MicrodroidHostTestCaseBase {
getDevice().enableAdbRoot();
}
private void rebootAndWaitBootCompleted() throws Exception {
getDevice().nonBlockingReboot();
private void waitForBootCompleted() throws Exception {
getDevice().waitForDeviceOnline(BOOT_COMPLETE_TIMEOUT_MS);
getDevice().waitForBootComplete(BOOT_COMPLETE_TIMEOUT_MS);
getDevice().enableAdbRoot();