Fix UserManagerTest waitForUserRemoval timeout.
This CL introduces a new UserRemovalWaiter helper class to wait for
user removal. Previously user removal was only waited until
ACTION_USER_REMOVED broadcast was received for the user, which was
delayed for several minutes in some cases and was causing timeouts
on the tests and making them flaky. Now in addition to the broadcast,
we are checking whether the user is present in the alive users
collection.
This CL also switches back to the original current user on the
tearDown stage of the UserManagerTest.
Bug: 264534887
Test: atest com.android.server.pm.UserManagerTest
Change-Id: I7df7e324ca41acbd1e60aa28c37da172f6cf9d43
2 files changed