Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt +11 −3 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ import java.util.TimeZone * existing lockscreen clock. */ class DefaultClockController( ctx: Context, private val ctx: Context, private val layoutInflater: LayoutInflater, private val resources: Resources, private val settings: ClockSettings?, Loading Loading @@ -121,7 +121,11 @@ class DefaultClockController( protected var targetRegion: Rect? = null override val config = ClockFaceConfig() override val layout = DefaultClockFaceLayout(view) override val layout = DefaultClockFaceLayout(view).apply { views[0].id = resources.getIdentifier("lockscreen_clock_view", "id", ctx.packageName) } override var animations: DefaultClockAnimations = DefaultClockAnimations(view, 0f, 0f) internal set Loading Loading @@ -188,7 +192,11 @@ class DefaultClockController( seedColor: Int?, messageBuffer: MessageBuffer?, ) : DefaultClockFaceController(view, seedColor, messageBuffer) { override val layout = DefaultClockFaceLayout(view) override val layout = DefaultClockFaceLayout(view).apply { views[0].id = resources.getIdentifier("lockscreen_clock_view_large", "id", ctx.packageName) } override val config = ClockFaceConfig(hasCustomPositionUpdatedAnimation = hasStepClockAnimation) Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockProviderPlugin.kt +6 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,8 @@ interface ClockFaceLayout { /** Custom constraints to apply to Lockscreen ConstraintLayout. */ fun applyConstraints(constraints: ConstraintSet): ConstraintSet fun applyPreviewConstraints(constraints: ConstraintSet): ConstraintSet } /** A ClockFaceLayout that applies the default lockscreen layout to a single view */ Loading @@ -131,6 +133,10 @@ class DefaultClockFaceLayout(val view: View) : ClockFaceLayout { } return constraints } override fun applyPreviewConstraints(constraints: ConstraintSet): ConstraintSet { return constraints } } /** Events that should call when various rendering parameters change */ Loading packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardClockRepository.kt +11 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ interface KeyguardClockRepository { val currentClock: StateFlow<ClockController?> val previewClock: StateFlow<ClockController> val clockEventController: ClockEventController fun setClockSize(@ClockSize size: Int) } Loading Loading @@ -120,6 +122,15 @@ constructor( initialValue = clockRegistry.createCurrentClock() ) override val previewClock: StateFlow<ClockController> = currentClockId .map { clockRegistry.createCurrentClock() } .stateIn( scope = applicationScope, started = SharingStarted.WhileSubscribed(), initialValue = clockRegistry.createCurrentClock() ) @VisibleForTesting suspend fun getClockSize(): SettingsClockSize { return withContext(backgroundDispatcher) { Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ constructor( val currentClock: StateFlow<ClockController?> = keyguardClockRepository.currentClock val previewClock: StateFlow<ClockController> = keyguardClockRepository.previewClock var clock: ClockController? by keyguardClockRepository.clockEventController::clock val clockSize: StateFlow<Int> = keyguardClockRepository.clockSize Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt +3 −13 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.keyguard.ui.binder import android.transition.TransitionManager import android.transition.TransitionSet import android.util.Log import android.view.View.INVISIBLE import androidx.annotation.VisibleForTesting import androidx.constraintlayout.helper.widget.Layer Loading @@ -36,7 +35,6 @@ import com.android.systemui.keyguard.ui.view.layout.sections.ClockSection import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel 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.DEFAULT_CLOCK_ID import kotlinx.coroutines.launch Loading Loading @@ -78,10 +76,6 @@ object KeyguardClockViewBinder { launch { if (!migrateClocksToBlueprint()) return@launch viewModel.clockShouldBeCentered.collect { clockShouldBeCentered -> Log.d( "ClockViewBinder", "Sherry clockShouldBeCentered $clockShouldBeCentered" ) viewModel.clock?.let { // Weather clock also has hasCustomPositionUpdatedAnimation as true // TODO(b/323020908): remove ID check Loading Loading @@ -169,16 +163,12 @@ object KeyguardClockViewBinder { rootView: ConstraintLayout, ) { clockController?.let { clock -> clock.smallClock.layout.views[0].id = R.id.lockscreen_clock_view if (clock.largeClock.layout.views.size == 1) { clock.largeClock.layout.views[0].id = R.id.lockscreen_clock_view_large } // small clock should either be a single view or container with id // `lockscreen_clock_view` clock.smallClock.layout.views.forEach { rootView.addView(it).apply { it.visibility = INVISIBLE } } clock.largeClock.layout.views.forEach { rootView.addView(it) } clock.largeClock.layout.views.forEach { rootView.addView(it).apply { it.visibility = INVISIBLE } } } } fun applyConstraints( Loading Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt +11 −3 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ import java.util.TimeZone * existing lockscreen clock. */ class DefaultClockController( ctx: Context, private val ctx: Context, private val layoutInflater: LayoutInflater, private val resources: Resources, private val settings: ClockSettings?, Loading Loading @@ -121,7 +121,11 @@ class DefaultClockController( protected var targetRegion: Rect? = null override val config = ClockFaceConfig() override val layout = DefaultClockFaceLayout(view) override val layout = DefaultClockFaceLayout(view).apply { views[0].id = resources.getIdentifier("lockscreen_clock_view", "id", ctx.packageName) } override var animations: DefaultClockAnimations = DefaultClockAnimations(view, 0f, 0f) internal set Loading Loading @@ -188,7 +192,11 @@ class DefaultClockController( seedColor: Int?, messageBuffer: MessageBuffer?, ) : DefaultClockFaceController(view, seedColor, messageBuffer) { override val layout = DefaultClockFaceLayout(view) override val layout = DefaultClockFaceLayout(view).apply { views[0].id = resources.getIdentifier("lockscreen_clock_view_large", "id", ctx.packageName) } override val config = ClockFaceConfig(hasCustomPositionUpdatedAnimation = hasStepClockAnimation) Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockProviderPlugin.kt +6 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,8 @@ interface ClockFaceLayout { /** Custom constraints to apply to Lockscreen ConstraintLayout. */ fun applyConstraints(constraints: ConstraintSet): ConstraintSet fun applyPreviewConstraints(constraints: ConstraintSet): ConstraintSet } /** A ClockFaceLayout that applies the default lockscreen layout to a single view */ Loading @@ -131,6 +133,10 @@ class DefaultClockFaceLayout(val view: View) : ClockFaceLayout { } return constraints } override fun applyPreviewConstraints(constraints: ConstraintSet): ConstraintSet { return constraints } } /** Events that should call when various rendering parameters change */ Loading
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardClockRepository.kt +11 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ interface KeyguardClockRepository { val currentClock: StateFlow<ClockController?> val previewClock: StateFlow<ClockController> val clockEventController: ClockEventController fun setClockSize(@ClockSize size: Int) } Loading Loading @@ -120,6 +122,15 @@ constructor( initialValue = clockRegistry.createCurrentClock() ) override val previewClock: StateFlow<ClockController> = currentClockId .map { clockRegistry.createCurrentClock() } .stateIn( scope = applicationScope, started = SharingStarted.WhileSubscribed(), initialValue = clockRegistry.createCurrentClock() ) @VisibleForTesting suspend fun getClockSize(): SettingsClockSize { return withContext(backgroundDispatcher) { Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ constructor( val currentClock: StateFlow<ClockController?> = keyguardClockRepository.currentClock val previewClock: StateFlow<ClockController> = keyguardClockRepository.previewClock var clock: ClockController? by keyguardClockRepository.clockEventController::clock val clockSize: StateFlow<Int> = keyguardClockRepository.clockSize Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt +3 −13 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.keyguard.ui.binder import android.transition.TransitionManager import android.transition.TransitionSet import android.util.Log import android.view.View.INVISIBLE import androidx.annotation.VisibleForTesting import androidx.constraintlayout.helper.widget.Layer Loading @@ -36,7 +35,6 @@ import com.android.systemui.keyguard.ui.view.layout.sections.ClockSection import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel 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.DEFAULT_CLOCK_ID import kotlinx.coroutines.launch Loading Loading @@ -78,10 +76,6 @@ object KeyguardClockViewBinder { launch { if (!migrateClocksToBlueprint()) return@launch viewModel.clockShouldBeCentered.collect { clockShouldBeCentered -> Log.d( "ClockViewBinder", "Sherry clockShouldBeCentered $clockShouldBeCentered" ) viewModel.clock?.let { // Weather clock also has hasCustomPositionUpdatedAnimation as true // TODO(b/323020908): remove ID check Loading Loading @@ -169,16 +163,12 @@ object KeyguardClockViewBinder { rootView: ConstraintLayout, ) { clockController?.let { clock -> clock.smallClock.layout.views[0].id = R.id.lockscreen_clock_view if (clock.largeClock.layout.views.size == 1) { clock.largeClock.layout.views[0].id = R.id.lockscreen_clock_view_large } // small clock should either be a single view or container with id // `lockscreen_clock_view` clock.smallClock.layout.views.forEach { rootView.addView(it).apply { it.visibility = INVISIBLE } } clock.largeClock.layout.views.forEach { rootView.addView(it) } clock.largeClock.layout.views.forEach { rootView.addView(it).apply { it.visibility = INVISIBLE } } } } fun applyConstraints( Loading