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

Commit c35411cc authored by Chandru S's avatar Chandru S
Browse files

Explicitly use main dispatcher for the window root view blurs

The plan is to submit this CL and then move the flag to staging again, get new jank metrics and see how much it improves jank compared to the previous flag flip.

Bug: 392240569
Flag: com.android.systemui.bouncer_ui_revamp
Test: NA, everything builds, blur works.
Change-Id: Ie6de9b15b7291dbc5b07e4fb417e1529ad0fcb36
parent 6c1a7411
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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()
+8 −2
Original line number Diff line number Diff line
@@ -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) {
+3 −1
Original line number Diff line number Diff line
@@ -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(
+1 −0
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ class NotificationShadeWindowViewControllerTest(flags: FlagsParameterization) :
                mock(BouncerViewBinder::class.java),
                { mock(ConfigurationForwarder::class.java) },
                brightnessMirrorShowingInteractor,
                kosmos.testDispatcher,
            )
        underTest.setupExpandedStatusBar()
        underTest.setDragDownHelper(dragDownHelper)