diff options
| author | 2022-10-31 21:16:26 +0000 | |
|---|---|---|
| committer | 2022-10-31 21:16:26 +0000 | |
| commit | a0d7be3a018f11aacc8f4a7e7398fa041aeb3089 (patch) | |
| tree | 640d13b12fffb5d39569ba4a7d61ea59b0899df8 | |
| parent | 1890e8adc1a529251d7e8a08a2cef5ceae360301 (diff) | |
| parent | 8d6a7a10e6b64c6b84fdf560f2840d1c43a49870 (diff) | |
Merge "Blind fix for user switcher instant crash." into tm-qpr-dev
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/user/data/repository/UserRepository.kt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/user/data/repository/UserRepository.kt b/packages/SystemUI/src/com/android/systemui/user/data/repository/UserRepository.kt index b16dc5403a57..6a2326036ec0 100644 --- a/packages/SystemUI/src/com/android/systemui/user/data/repository/UserRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/user/data/repository/UserRepository.kt @@ -62,6 +62,7 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext /** @@ -136,7 +137,7 @@ constructor( private val isNewImpl: Boolean 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> = _userSwitcherSettings.asStateFlow().filterNotNull() @@ -235,7 +236,7 @@ constructor( } override fun isSimpleUserSwitcher(): Boolean { - return checkNotNull(_userSwitcherSettings.value?.isSimpleUserSwitcher) + return _userSwitcherSettings.value.isSimpleUserSwitcher } private fun observeSelectedUser() { |