Make switch user test measurements consistent with each other.

In UserLifecycleTests switchUser and switchUser_running test methods
wait for UserSwitchObserver.onUserSwitchComplete callback,
whereas switchUser_stopped waits for ACTION_USER_UNLOCKED broadcast
after triggering the user switch.

Which makes the results incomparable and also shows switchUser_stopped
is running faster than switchUser_running, but it makes more sense
the other way around.

This CL makes sure the tests wait for and measure the same thing
to make the results comparable.

Bug: 242843357
Test: atest MultiUserPerfTests:android.multiuser.UserLifecycleTests#switchUser_stopped --no-bazel-mode
Change-Id: I250ceef1ae9ce0adec40972b7962932066121c4f
This commit is contained in:
Yasin Kilicdere
2022-08-17 13:48:42 +01:00
parent cb2ec7b31d
commit 77ccead374

View File

@@ -273,9 +273,7 @@ public class UserLifecycleTests {
mRunner.resumeTiming();
Log.i(TAG, "Starting timer");
runThenWaitForBroadcasts(testUser, () -> {
mAm.switchUser(testUser);
}, Intent.ACTION_USER_UNLOCKED);
switchUser(testUser);
mRunner.pauseTiming();
Log.i(TAG, "Stopping timer");