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

Commit 296549e9 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 aosp-main-future

parents 497b4a37 75be0bd1
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));
@@ -423,6 +424,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);