Merge "Fix no guest visible while on multi user switcher" into tm-qpr-dev am: 95799ff292
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20581318 Change-Id: I23cfaca65fa0534e11f055d66d8affa95d66ce67 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -114,9 +114,9 @@ constructor(
|
|||||||
|
|
||||||
private val callbackMutex = Mutex()
|
private val callbackMutex = Mutex()
|
||||||
private val callbacks = mutableSetOf<UserCallback>()
|
private val callbacks = mutableSetOf<UserCallback>()
|
||||||
private val userInfos =
|
private val userInfos: Flow<List<UserInfo>> =
|
||||||
combine(repository.userSwitcherSettings, repository.userInfos) { settings, userInfos ->
|
repository.userInfos.map { userInfos ->
|
||||||
userInfos.filter { !it.isGuest || canCreateGuestUser(settings) }.filter { it.isFull }
|
userInfos.filter { it.isFull }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** List of current on-device users to select from. */
|
/** List of current on-device users to select from. */
|
||||||
|
|||||||
@@ -761,7 +761,7 @@ class UserInteractorTest : SysuiTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `users - secondary user - no guest user`() =
|
fun `users - secondary user - guest user can be switched to`() =
|
||||||
runBlocking(IMMEDIATE) {
|
runBlocking(IMMEDIATE) {
|
||||||
val userInfos = createUserInfos(count = 3, includeGuest = true)
|
val userInfos = createUserInfos(count = 3, includeGuest = true)
|
||||||
userRepository.setUserInfos(userInfos)
|
userRepository.setUserInfos(userInfos)
|
||||||
@@ -770,8 +770,8 @@ class UserInteractorTest : SysuiTestCase() {
|
|||||||
|
|
||||||
var res: List<UserModel>? = null
|
var res: List<UserModel>? = null
|
||||||
val job = underTest.users.onEach { res = it }.launchIn(this)
|
val job = underTest.users.onEach { res = it }.launchIn(this)
|
||||||
assertThat(res?.size == 2).isTrue()
|
assertThat(res?.size == 3).isTrue()
|
||||||
assertThat(res?.find { it.isGuest }).isNull()
|
assertThat(res?.find { it.isGuest }).isNotNull()
|
||||||
job.cancel()
|
job.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user