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

Commit 6620022a authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Fix Transit clock color in lock screen being overriden in wallpaper preview

Flag: ACONFIG com.android.systemui.migrate_clocks_to_blueprint STAGING
Bug: 332961021
Test: manual

Change-Id: Idc52934f2e7ab2d8fa428d6fd3a8d99e5aafca09
parent a036797e
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardPreviewClockViewModel
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.plugins.clocks.ClockController
import com.android.systemui.res.R
import com.android.systemui.shared.clocks.ClockRegistry
import com.android.systemui.util.Utils
import kotlin.reflect.KSuspendFunction1

@@ -76,12 +77,13 @@ object KeyguardPreviewClockViewBinder {
        context: Context,
        rootView: ConstraintLayout,
        viewModel: KeyguardPreviewClockViewModel,
        clockRegistry: ClockRegistry,
        updateClockAppearance: KSuspendFunction1<ClockController, Unit>,
    ) {
        rootView.repeatWhenAttached {
            repeatOnLifecycle(Lifecycle.State.STARTED) {
                launch("$TAG#viewModel.previewClock") {
                var lastClock: ClockController? = null
                launch("$TAG#viewModel.previewClock") {
                        viewModel.previewClock.collect { currentClock ->
                            lastClock?.let { clock ->
                                (clock.largeClock.layout.views + clock.smallClock.layout.views)
@@ -107,6 +109,10 @@ object KeyguardPreviewClockViewBinder {
                            applyPreviewConstraints(context, rootView, currentClock, viewModel)
                        }
                    }
                    .invokeOnCompletion {
                        // recover seed color especially for Transit clock
                        lastClock?.events?.onSeedColorChanged(clockRegistry.seedColor)
                    }
            }
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -410,7 +410,8 @@ constructor(
                    context,
                    keyguardRootView,
                    clockViewModel,
                    ::updateClockAppearance
                    clockRegistry,
                    ::updateClockAppearance,
                )
            } else {
                KeyguardPreviewClockViewBinder.bind(