diff options
| author | 2024-02-23 01:45:30 +0000 | |
|---|---|---|
| committer | 2024-02-23 01:45:30 +0000 | |
| commit | 965eb5928994aef6f1eb53c5657e39555de2425c (patch) | |
| tree | 40b7ca9eadd7ec5efe5e36490786b39665b99977 | |
| parent | e8aa09dc8bf3dec26fd02680699372620a9d391e (diff) | |
| parent | 7226caf47c3af8c82d4883aad7cfb2c3114fc5f2 (diff) | |
Merge "Ensure that NotificationStackAppearanceViewBinder updates happen synchronously on the main thread" into main
3 files changed, 9 insertions, 4 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt index ed2cbb85ba1a..c7d43fcdf5e6 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt @@ -55,7 +55,7 @@ constructor( notificationStackAppearanceViewModel: NotificationStackAppearanceViewModel, ambientState: AmbientState, notificationStackSizeCalculator: NotificationStackSizeCalculator, - @Main private val mainDispatcher: CoroutineDispatcher, + @Main private val mainImmediateDispatcher: CoroutineDispatcher, ) { init { @@ -80,7 +80,7 @@ constructor( sceneContainerFlags, controller, notificationStackSizeCalculator, - mainDispatcher, + mainImmediateDispatcher = mainImmediateDispatcher, ) if (sceneContainerFlags.flexiNotifsEnabled()) { @@ -90,6 +90,7 @@ constructor( notificationStackAppearanceViewModel, ambientState, controller, + mainImmediateDispatcher = mainImmediateDispatcher, ) } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt index d0f57c7f9ded..02c889dd771d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt @@ -111,7 +111,7 @@ constructor( sceneContainerFlags, controller, notificationStackSizeCalculator, - mainDispatcher, + mainImmediateDispatcher = mainDispatcher, ) ) @@ -123,6 +123,7 @@ constructor( notificationStackAppearanceViewModel, ambientState, controller, + mainImmediateDispatcher = mainDispatcher, ) ) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationStackAppearanceViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationStackAppearanceViewBinder.kt index a1577854e732..76495cb23947 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationStackAppearanceViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewbinder/NotificationStackAppearanceViewBinder.kt @@ -20,12 +20,14 @@ import android.content.Context import android.util.TypedValue import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle +import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.statusbar.notification.stack.AmbientState import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationStackAppearanceViewModel import kotlin.math.roundToInt +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.launch @@ -40,8 +42,9 @@ object NotificationStackAppearanceViewBinder { viewModel: NotificationStackAppearanceViewModel, ambientState: AmbientState, controller: NotificationStackScrollLayoutController, + @Main mainImmediateDispatcher: CoroutineDispatcher, ): DisposableHandle { - return view.repeatWhenAttached { + return view.repeatWhenAttached(mainImmediateDispatcher) { repeatOnLifecycle(Lifecycle.State.CREATED) { launch { viewModel.stackBounds.collect { bounds -> |