Skip to content
Snippets Groups Projects
Commit c3b2cb5f authored by Nikhil Kumar's avatar Nikhil Kumar Committed by Eric Biggers
Browse files

Removing non SYSTEM user before running systemUserOnlyTest

Bug: 295446676
Test: atest UserManagerServiceTest -c
Change-Id: I6f536b7f5b85e4e884bd284b1848e43ac3c9029d
(cherry picked from commit b1bba3e9)
Merged-In: I6f536b7f5b85e4e884bd284b1848e43ac3c9029d
parent a0b29244
No related branches found
No related tags found
No related merge requests found
......@@ -320,11 +320,20 @@ public final class UserManagerServiceTest {
@Test
public void testGetBootUser_Headless_ThrowsIfOnlySystemUserExists() throws Exception {
setSystemUserHeadless(true);
removeNonSystemUsers();
assertThrows(UserManager.CheckedUserOperationException.class,
() -> mUmi.getBootUser(/* waitUntilSet= */ false));
}
private void removeNonSystemUsers() {
for (UserInfo user : mUms.getUsers(true)) {
if (!user.getUserHandle().isSystem()) {
mUms.removeUserInfo(user.id);
}
}
}
private void mockCurrentUser(@UserIdInt int userId) {
mockGetLocalService(ActivityManagerInternal.class, mActivityManagerInternal);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment