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

Commit 13453c13 authored by Yunke Zhou's avatar Yunke Zhou Committed by Android (Google) Code Review
Browse files

Merge "[Flexiglass] Show the current user in user switcher" into main

parents 3c3e7b5d 8673cf09
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1088,8 +1088,13 @@ class UserSwitcherInteractorTest : SysuiTestCase() {
            userRepository.setUserInfos(userInfos)
            userRepository.setSelectedUserInfo(userInfos[1])
            userRepository.setSettings(UserSwitcherSettingsModel(isUserSwitcherEnabled = false))

            val selectedUser = collectLastValue(underTest.selectedUser)
            assertThat(selectedUser()).isNotNull()
            assertUser(selectedUser(), id = 1, isSelected = true)

            val users = collectLastValue(underTest.users)
            assertThat(users()?.size == 1).isTrue()
            assertUser(users()?.firstOrNull(), id = 1, isSelected = true)
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -711,8 +711,8 @@ constructor(
        isUserSwitcherEnabled: Boolean,
    ): UserModel? {
        return when {
            // When the user switcher is not enabled in settings, we only show the primary user.
            !isUserSwitcherEnabled && !userInfo.isPrimary -> null
            // When the user switcher is not enabled in settings, we only show the current user.
            !isUserSwitcherEnabled && userInfo.id != selectedUserId -> null
            // We avoid showing disabled users.
            !userInfo.isEnabled -> null
            // We meet the conditions to return the UserModel.