Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aeadff89 authored by Eric Biggers's avatar Eric Biggers Committed by Android (Google) Code Review
Browse files

Merge "Removing non SYSTEM user before running systemUserOnlyTest" into udc-dev-plus-aosp

parents 4520c6d3 82efbd0e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -323,6 +323,7 @@ public final class UserManagerServiceTest {
    @Test
    public void testGetBootUser_Headless_ThrowsIfOnlySystemUserExists() throws Exception {
        setSystemUserHeadless(true);
        removeNonSystemUsers();

        assertThrows(UserManager.CheckedUserOperationException.class,
                () -> mUmi.getBootUser(/* waitUntilSet= */ false));
@@ -346,6 +347,14 @@ public final class UserManagerServiceTest {
        return resultString.toString();
    }

    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);