Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockProviderPlugin.kt +6 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,9 @@ data class ClockConfig( /** True if the clock will react to tone changes in the seed color. */ val isReactiveToTone: Boolean = true, /** True if the clock is large frame clock, which will use weather in compose. */ val useCustomClockScene: Boolean = false, ) /** Render configuration options for a clock face. Modifies the way SystemUI behaves. */ Loading @@ -283,6 +286,9 @@ data class ClockFaceConfig( * animation will be used (e.g. a simple translation). */ val hasCustomPositionUpdatedAnimation: Boolean = false, /** True if the clock is large frame clock, which will use weatherBlueprint in compose. */ val useCustomClockScene: Boolean = false, ) /** Structure for keeping clock-specific settings */ Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt +6 −10 Original line number Diff line number Diff line Loading @@ -36,7 +36,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.shared.clocks.DEFAULT_CLOCK_ID import kotlinx.coroutines.launch object KeyguardClockViewBinder { Loading Loading @@ -76,13 +75,13 @@ object KeyguardClockViewBinder { } launch { if (!MigrateClocksToBlueprint.isEnabled) return@launch viewModel.clockShouldBeCentered.collect { clockShouldBeCentered -> viewModel.clockShouldBeCentered.collect { viewModel.currentClock.value?.let { // Weather clock also has hasCustomPositionUpdatedAnimation as true // TODO(b/323020908): remove ID check // TODO(b/301502635): remove "!it.config.useCustomClockScene" when // migrate clocks to blueprint is fully rolled out if ( it.largeClock.config.hasCustomPositionUpdatedAnimation && it.config.id == DEFAULT_CLOCK_ID !it.config.useCustomClockScene ) { blueprintInteractor.refreshBlueprint(Type.DefaultClockStepping) } else { Loading @@ -93,12 +92,9 @@ object KeyguardClockViewBinder { } launch { if (!MigrateClocksToBlueprint.isEnabled) return@launch viewModel.isAodIconsVisible.collect { isAodIconsVisible -> viewModel.isAodIconsVisible.collect { viewModel.currentClock.value?.let { // Weather clock also has hasCustomPositionUpdatedAnimation as true if ( viewModel.useLargeClock && it.config.id == "DIGITAL_CLOCK_WEATHER" ) { if (viewModel.useLargeClock && it.config.useCustomClockScene) { blueprintInteractor.refreshBlueprint(Type.DefaultTransition) } } Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModel.kt +1 −2 Original line number Diff line number Diff line Loading @@ -118,8 +118,7 @@ constructor( currentClock ) { isLargeClockVisible, clockShouldBeCentered, shadeMode, currentClock -> val shouldUseSplitShade = shadeMode == ShadeMode.Split // TODO(b/326098079): make id a constant field in config if (currentClock?.config?.id == "DIGITAL_CLOCK_WEATHER") { if (currentClock?.config?.useCustomClockScene == true) { val weatherClockLayout = when { shouldUseSplitShade && clockShouldBeCentered -> Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerBaseTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -205,9 +205,9 @@ public class KeyguardClockSwitchControllerBaseTest extends SysuiTestCase { when(mClockRegistry.createCurrentClock()).thenReturn(mClockController); when(mClockEventController.getClock()).thenReturn(mClockController); when(mSmallClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false, false)); when(mLargeClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false, false)); mSliceView = new View(getContext()); when(mView.findViewById(R.id.keyguard_slice_view)).thenReturn(mSliceView); Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -272,9 +272,9 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro assertEquals(View.VISIBLE, mFakeDateView.getVisibility()); when(mSmallClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false, true)); when(mLargeClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false, true)); verify(mClockRegistry).registerClockChangeListener(listenerArgumentCaptor.capture()); listenerArgumentCaptor.getValue().onCurrentClockChanged(); Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockProviderPlugin.kt +6 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,9 @@ data class ClockConfig( /** True if the clock will react to tone changes in the seed color. */ val isReactiveToTone: Boolean = true, /** True if the clock is large frame clock, which will use weather in compose. */ val useCustomClockScene: Boolean = false, ) /** Render configuration options for a clock face. Modifies the way SystemUI behaves. */ Loading @@ -283,6 +286,9 @@ data class ClockFaceConfig( * animation will be used (e.g. a simple translation). */ val hasCustomPositionUpdatedAnimation: Boolean = false, /** True if the clock is large frame clock, which will use weatherBlueprint in compose. */ val useCustomClockScene: Boolean = false, ) /** Structure for keeping clock-specific settings */ Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt +6 −10 Original line number Diff line number Diff line Loading @@ -36,7 +36,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.shared.clocks.DEFAULT_CLOCK_ID import kotlinx.coroutines.launch object KeyguardClockViewBinder { Loading Loading @@ -76,13 +75,13 @@ object KeyguardClockViewBinder { } launch { if (!MigrateClocksToBlueprint.isEnabled) return@launch viewModel.clockShouldBeCentered.collect { clockShouldBeCentered -> viewModel.clockShouldBeCentered.collect { viewModel.currentClock.value?.let { // Weather clock also has hasCustomPositionUpdatedAnimation as true // TODO(b/323020908): remove ID check // TODO(b/301502635): remove "!it.config.useCustomClockScene" when // migrate clocks to blueprint is fully rolled out if ( it.largeClock.config.hasCustomPositionUpdatedAnimation && it.config.id == DEFAULT_CLOCK_ID !it.config.useCustomClockScene ) { blueprintInteractor.refreshBlueprint(Type.DefaultClockStepping) } else { Loading @@ -93,12 +92,9 @@ object KeyguardClockViewBinder { } launch { if (!MigrateClocksToBlueprint.isEnabled) return@launch viewModel.isAodIconsVisible.collect { isAodIconsVisible -> viewModel.isAodIconsVisible.collect { viewModel.currentClock.value?.let { // Weather clock also has hasCustomPositionUpdatedAnimation as true if ( viewModel.useLargeClock && it.config.id == "DIGITAL_CLOCK_WEATHER" ) { if (viewModel.useLargeClock && it.config.useCustomClockScene) { blueprintInteractor.refreshBlueprint(Type.DefaultTransition) } } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModel.kt +1 −2 Original line number Diff line number Diff line Loading @@ -118,8 +118,7 @@ constructor( currentClock ) { isLargeClockVisible, clockShouldBeCentered, shadeMode, currentClock -> val shouldUseSplitShade = shadeMode == ShadeMode.Split // TODO(b/326098079): make id a constant field in config if (currentClock?.config?.id == "DIGITAL_CLOCK_WEATHER") { if (currentClock?.config?.useCustomClockScene == true) { val weatherClockLayout = when { shouldUseSplitShade && clockShouldBeCentered -> Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerBaseTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -205,9 +205,9 @@ public class KeyguardClockSwitchControllerBaseTest extends SysuiTestCase { when(mClockRegistry.createCurrentClock()).thenReturn(mClockController); when(mClockEventController.getClock()).thenReturn(mClockController); when(mSmallClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false, false)); when(mLargeClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, false, false, false)); mSliceView = new View(getContext()); when(mView.findViewById(R.id.keyguard_slice_view)).thenReturn(mSliceView); Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -272,9 +272,9 @@ public class KeyguardClockSwitchControllerTest extends KeyguardClockSwitchContro assertEquals(View.VISIBLE, mFakeDateView.getVisibility()); when(mSmallClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false, true)); when(mLargeClockController.getConfig()) .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false)); .thenReturn(new ClockFaceConfig(ClockTickRate.PER_MINUTE, true, false, true)); verify(mClockRegistry).registerClockChangeListener(listenerArgumentCaptor.capture()); listenerArgumentCaptor.getValue().onCurrentClockChanged(); Loading