Fix no guest visible while on multi user switcher

Bug: 260404638
Test: UserInteractorTest.kt test modified to ensure guest can be switched to while on secondary user
Change-Id: I26ff794b024173c9833c64668e464068555a8a84
This commit is contained in:
Brad Hinegardner
2022-11-29 15:25:14 -05:00
parent 3d1c9948a9
commit 62c898a705
2 changed files with 6 additions and 6 deletions

View File

@@ -114,9 +114,9 @@ constructor(
private val callbackMutex = Mutex()
private val callbacks = mutableSetOf<UserCallback>()
private val userInfos =
combine(repository.userSwitcherSettings, repository.userInfos) { settings, userInfos ->
userInfos.filter { !it.isGuest || canCreateGuestUser(settings) }.filter { it.isFull }
private val userInfos: Flow<List<UserInfo>> =
repository.userInfos.map { userInfos ->
userInfos.filter { it.isFull }
}
/** List of current on-device users to select from. */

View File

@@ -761,7 +761,7 @@ class UserInteractorTest : SysuiTestCase() {
}
@Test
fun `users - secondary user - no guest user`() =
fun `users - secondary user - guest user can be switched to`() =
runBlocking(IMMEDIATE) {
val userInfos = createUserInfos(count = 3, includeGuest = true)
userRepository.setUserInfos(userInfos)
@@ -770,8 +770,8 @@ class UserInteractorTest : SysuiTestCase() {
var res: List<UserModel>? = null
val job = underTest.users.onEach { res = it }.launchIn(this)
assertThat(res?.size == 2).isTrue()
assertThat(res?.find { it.isGuest }).isNull()
assertThat(res?.size == 3).isTrue()
assertThat(res?.find { it.isGuest }).isNotNull()
job.cancel()
}