diff options
| author | 2025-01-28 16:30:36 -0800 | |
|---|---|---|
| committer | 2025-01-28 16:30:36 -0800 | |
| commit | a9ff07df3c1d8ac3f52534f182a21d7621037d2f (patch) | |
| tree | 999bb0e78fb1992223ba222349b5a163b13811c6 | |
| parent | 0c937c25282e0a004ac45b60030d5fca1fac6754 (diff) | |
| parent | c35411ccabe0bac5d1bbe159a3140a659985ebd0 (diff) | |
Merge "Explicitly use main dispatcher for the window root view blurs" into main
4 files changed, 14 insertions, 3 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt index 555c717e1e65..93d1f593e81f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt @@ -78,6 +78,7 @@ import java.util.Optional import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -220,6 +221,7 @@ class NotificationShadeWindowViewTest : SysuiTestCase() { mock(), { configurationForwarder }, brightnessMirrorShowingInteractor, + UnconfinedTestDispatcher(), ) controller.setupExpandedStatusBar() diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java index 255494f014e3..10a9fd20ee5a 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java @@ -45,6 +45,7 @@ import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags; import com.android.systemui.bouncer.ui.binder.BouncerViewBinder; import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dock.DockManager; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlagsClassic; @@ -87,6 +88,8 @@ import com.android.systemui.util.time.SystemClock; import com.android.systemui.window.ui.WindowRootViewBinder; import com.android.systemui.window.ui.viewmodel.WindowRootViewModel; +import kotlinx.coroutines.CoroutineDispatcher; +import kotlinx.coroutines.ExperimentalCoroutinesApi; import kotlinx.coroutines.flow.Flow; import java.io.PrintWriter; @@ -119,6 +122,7 @@ public class NotificationShadeWindowViewController implements Dumpable { private final PrimaryBouncerInteractor mPrimaryBouncerInteractor; private final AlternateBouncerInteractor mAlternateBouncerInteractor; private final QuickSettingsController mQuickSettingsController; + private final CoroutineDispatcher mMainDispatcher; private final KeyguardTransitionInteractor mKeyguardTransitionInteractor; private final GlanceableHubContainerController mGlanceableHubContainerController; @@ -204,7 +208,8 @@ public class NotificationShadeWindowViewController implements Dumpable { AlternateBouncerInteractor alternateBouncerInteractor, BouncerViewBinder bouncerViewBinder, @ShadeDisplayAware Provider<ConfigurationForwarder> configurationForwarder, - BrightnessMirrorShowingInteractor brightnessMirrorShowingInteractor) { + BrightnessMirrorShowingInteractor brightnessMirrorShowingInteractor, + @Main CoroutineDispatcher mainDispatcher) { mLockscreenShadeTransitionController = transitionController; mFalsingCollector = falsingCollector; mStatusBarStateController = statusBarStateController; @@ -232,6 +237,7 @@ public class NotificationShadeWindowViewController implements Dumpable { mPrimaryBouncerInteractor = primaryBouncerInteractor; mAlternateBouncerInteractor = alternateBouncerInteractor; mQuickSettingsController = quickSettingsController; + mMainDispatcher = mainDispatcher; // This view is not part of the newly inflated expanded status bar. mBrightnessMirror = mView.findViewById(R.id.brightness_mirror_container); @@ -286,7 +292,7 @@ public class NotificationShadeWindowViewController implements Dumpable { if (SceneContainerFlag.isEnabled()) return; WindowRootViewBinder.INSTANCE.bind(mView, windowRootViewModelFactory, blurUtils, - choreographer); + choreographer, mMainDispatcher); } private void bindBouncer(BouncerViewBinder bouncerViewBinder) { diff --git a/packages/SystemUI/src/com/android/systemui/window/ui/WindowRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/window/ui/WindowRootViewBinder.kt index 7f4bfb094a7b..e09a74cd0ad3 100644 --- a/packages/SystemUI/src/com/android/systemui/window/ui/WindowRootViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/window/ui/WindowRootViewBinder.kt @@ -26,6 +26,7 @@ import com.android.systemui.lifecycle.viewModel import com.android.systemui.scene.ui.view.WindowRootView import com.android.systemui.statusbar.BlurUtils import com.android.systemui.window.ui.viewmodel.WindowRootViewModel +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.flow.filter import kotlinx.coroutines.launch @@ -42,11 +43,12 @@ object WindowRootViewBinder { viewModelFactory: WindowRootViewModel.Factory, blurUtils: BlurUtils?, choreographer: Choreographer?, + mainDispatcher: CoroutineDispatcher, ) { if (!Flags.bouncerUiRevamp() && !Flags.glanceableHubBlurredBackground()) return if (blurUtils == null || choreographer == null) return - view.repeatWhenAttached { + view.repeatWhenAttached(mainDispatcher) { Log.d(TAG, "Binding root view") var frameCallbackPendingExecution: FrameCallback? = null view.viewModel( diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt index 70450d29c74e..49d6909c1f93 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt @@ -254,6 +254,7 @@ class NotificationShadeWindowViewControllerTest(flags: FlagsParameterization) : mock(BouncerViewBinder::class.java), { mock(ConfigurationForwarder::class.java) }, brightnessMirrorShowingInteractor, + kosmos.testDispatcher, ) underTest.setupExpandedStatusBar() underTest.setDragDownHelper(dragDownHelper) |