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

Commit f52c8f4b authored by Riley Campillo's avatar Riley Campillo Committed by Android (Google) Code Review
Browse files

Merge "Get user switcher actions on the background flow." into main

parents 892e8a5f 6019e9d8
Loading
Loading
Loading
Loading
+74 −67
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
@@ -170,12 +171,14 @@ constructor(
                    keyguardInteractor.isKeyguardShowing,
                ) { _, userInfos, settings, isDeviceLocked ->
                    buildList {
                    val canAccessUserSwitcher = !isDeviceLocked || settings.isAddUsersFromLockscreen
                        val canAccessUserSwitcher =
                            !isDeviceLocked || settings.isAddUsersFromLockscreen
                        if (canAccessUserSwitcher) {
                            // The device is locked and our setting to allow actions that add users
                            // from the lock-screen is not enabled. We can finish building the list
                            // here.
                        val isFullScreen = featureFlags.isEnabled(Flags.FULL_SCREEN_USER_SWITCHER)
                            val isFullScreen =
                                featureFlags.isEnabled(Flags.FULL_SCREEN_USER_SWITCHER)

                            val actionList: List<UserActionModel> =
                                if (isFullScreen) {
@@ -233,12 +236,16 @@ constructor(
                            }
                        }
                        if (
                        UserActionsUtil.canManageUsers(repository, settings.isUserSwitcherEnabled)
                            UserActionsUtil.canManageUsers(
                                repository,
                                settings.isUserSwitcherEnabled
                            )
                        ) {
                            add(UserActionModel.NAVIGATE_TO_USER_MANAGEMENT)
                        }
                    }
                }
                .flowOn(backgroundDispatcher)

    val userRecords: StateFlow<ArrayList<UserRecord>> =
        combine(