Merge "Blind fix for user switcher instant crash." into tm-qpr-dev am: a0d7be3a01

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20328972

Change-Id: Ia9ff867f65878b5ffa25eedd00e92154071ac835
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ale Nijamkin
2022-10-31 21:39:51 +00:00
committed by Automerger Merge Worker

View File

@@ -62,6 +62,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
/** /**
@@ -136,7 +137,7 @@ constructor(
private val isNewImpl: Boolean private val isNewImpl: Boolean
get() = !featureFlags.isEnabled(Flags.USER_INTERACTOR_AND_REPO_USE_CONTROLLER) get() = !featureFlags.isEnabled(Flags.USER_INTERACTOR_AND_REPO_USE_CONTROLLER)
private val _userSwitcherSettings = MutableStateFlow<UserSwitcherSettingsModel?>(null) private val _userSwitcherSettings = MutableStateFlow(runBlocking { getSettings() })
override val userSwitcherSettings: Flow<UserSwitcherSettingsModel> = override val userSwitcherSettings: Flow<UserSwitcherSettingsModel> =
_userSwitcherSettings.asStateFlow().filterNotNull() _userSwitcherSettings.asStateFlow().filterNotNull()
@@ -235,7 +236,7 @@ constructor(
} }
override fun isSimpleUserSwitcher(): Boolean { override fun isSimpleUserSwitcher(): Boolean {
return checkNotNull(_userSwitcherSettings.value?.isSimpleUserSwitcher) return _userSwitcherSettings.value.isSimpleUserSwitcher
} }
private fun observeSelectedUser() { private fun observeSelectedUser() {