Loading packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardClockRepository.kt +6 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context import android.os.UserHandle import android.provider.Settings import com.android.keyguard.ClockEventController import com.android.systemui.animation.GSFAxes import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background Loading Loading @@ -65,6 +66,8 @@ interface KeyguardClockRepository { /** clock id, selected from clock carousel in wallpaper picker */ val currentClockId: Flow<ClockId> val currentClockFontAxesWidth: Float? val currentClock: StateFlow<ClockController?> val clockEventController: ClockEventController Loading Loading @@ -128,6 +131,9 @@ constructor( } .mapNotNull { it } override val currentClockFontAxesWidth: Float? get() = clockRegistry.settings?.axes?.get(GSFAxes.WIDTH.tag) override val currentClock: StateFlow<ClockController?> = currentClockId .map { Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ constructor( val currentClockId: Flow<ClockId> = keyguardClockRepository.currentClockId val currentClockFontAxesWidth: Float? get() = keyguardClockRepository.currentClockFontAxesWidth val currentClock: StateFlow<ClockController?> = keyguardClockRepository.currentClock val clockEventController: ClockEventController = keyguardClockRepository.clockEventController Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt +15 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.app.tracing.coroutines.launchTraced as launch import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.shared.model.ClockSize import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Config import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Type import com.android.systemui.keyguard.ui.view.layout.sections.ClockSection import com.android.systemui.keyguard.ui.viewmodel.AodBurnInViewModel Loading Loading @@ -159,6 +160,20 @@ object KeyguardClockViewBinder { ?.onFontSettingChanged(fontSizePx = fontSizePx.toFloat()) } } if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) { launch("$TAG#clockViewModel.shouldDateWeatherBeBelowSmallClock") { viewModel.shouldDateWeatherBeBelowSmallClock.collect { blueprintInteractor.refreshBlueprint( Config( Type.SmartspaceVisibility, checkPriority = false, terminatePrevious = false, ) ) } } } } } Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModel.kt +23 −3 Original line number Diff line number Diff line Loading @@ -205,12 +205,25 @@ constructor( hasCustomWeatherDataDisplay, shadeModeInteractor.isShadeLayoutWide, configurationInteractor.configurationValues, ) { hasCustomWeatherDataDisplay, isShadeLayoutWide, configurationValues -> keyguardClockInteractor.currentClock, ) { hasCustomWeatherDataDisplay, isShadeLayoutWide, configurationValues, _ -> var fallBelow = false if (hasCustomWeatherDataDisplay) { return@combine true } keyguardClockInteractor.currentClockFontAxesWidth?.let { fontWidth -> if (fontWidth >= FONT_WIDTH_MAX_CUTOFF) { smallClockLogBuffer.log( TAG, LogLevel.INFO, { int1 = FONT_WIDTH_MAX_CUTOFF }, { "fallBelowClock:true, FontAxesWidth:$int1" }, ) return@combine true } } val screenWidthDp = configurationValues.screenWidthDp // if the shade is wide, we should account for the possibility of date/weather Loading @@ -233,7 +246,10 @@ constructor( bool1 = fallBelow bool2 = isShadeLayoutWide }, { "fallBelowClock:$bool1, isShadeWide:$bool2, Width:$int1, Font:$double1" }, { "fallBelowClock:$bool1, isShadeWide:$bool2, " + "Width:$int1, FontScale:$double1" }, ) fallBelow } Loading @@ -257,7 +273,7 @@ constructor( // font size to display size // These values come from changing the font size and display size on a non-foldable. // Visually looked at which configs cause the date/weather to push off of the screen val BREAKING_PAIRS = private val BREAKING_PAIRS = listOf( 0.85f to 320, // tiny font size but large display size 1f to 346, Loading @@ -265,5 +281,9 @@ constructor( 1.5f to 376, 1.8f to 411, // large font size but tiny display size ) // Font axes width max cutoff // A font with a wider font axes than this is at risk of being pushed off screen private const val FONT_WIDTH_MAX_CUTOFF = 110 } } packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardClockRepository.kt +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ class FakeKeyguardClockRepository() : KeyguardClockRepository { private val _currentClockId = MutableStateFlow(DEFAULT_CLOCK_ID) override val currentClockId: Flow<ClockId> = _currentClockId private var _currentClockFontAxesWidth: Float? = 0f override val currentClockFontAxesWidth: Float? get() = _currentClockFontAxesWidth private val _currentClock: MutableStateFlow<ClockController?> = MutableStateFlow(null) override val currentClock = _currentClock Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardClockRepository.kt +6 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context import android.os.UserHandle import android.provider.Settings import com.android.keyguard.ClockEventController import com.android.systemui.animation.GSFAxes import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background Loading Loading @@ -65,6 +66,8 @@ interface KeyguardClockRepository { /** clock id, selected from clock carousel in wallpaper picker */ val currentClockId: Flow<ClockId> val currentClockFontAxesWidth: Float? val currentClock: StateFlow<ClockController?> val clockEventController: ClockEventController Loading Loading @@ -128,6 +131,9 @@ constructor( } .mapNotNull { it } override val currentClockFontAxesWidth: Float? get() = clockRegistry.settings?.axes?.get(GSFAxes.WIDTH.tag) override val currentClock: StateFlow<ClockController?> = currentClockId .map { Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ constructor( val currentClockId: Flow<ClockId> = keyguardClockRepository.currentClockId val currentClockFontAxesWidth: Float? get() = keyguardClockRepository.currentClockFontAxesWidth val currentClock: StateFlow<ClockController?> = keyguardClockRepository.currentClock val clockEventController: ClockEventController = keyguardClockRepository.clockEventController Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt +15 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.app.tracing.coroutines.launchTraced as launch import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.shared.model.ClockSize import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Config import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Type import com.android.systemui.keyguard.ui.view.layout.sections.ClockSection import com.android.systemui.keyguard.ui.viewmodel.AodBurnInViewModel Loading Loading @@ -159,6 +160,20 @@ object KeyguardClockViewBinder { ?.onFontSettingChanged(fontSizePx = fontSizePx.toFloat()) } } if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) { launch("$TAG#clockViewModel.shouldDateWeatherBeBelowSmallClock") { viewModel.shouldDateWeatherBeBelowSmallClock.collect { blueprintInteractor.refreshBlueprint( Config( Type.SmartspaceVisibility, checkPriority = false, terminatePrevious = false, ) ) } } } } } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardClockViewModel.kt +23 −3 Original line number Diff line number Diff line Loading @@ -205,12 +205,25 @@ constructor( hasCustomWeatherDataDisplay, shadeModeInteractor.isShadeLayoutWide, configurationInteractor.configurationValues, ) { hasCustomWeatherDataDisplay, isShadeLayoutWide, configurationValues -> keyguardClockInteractor.currentClock, ) { hasCustomWeatherDataDisplay, isShadeLayoutWide, configurationValues, _ -> var fallBelow = false if (hasCustomWeatherDataDisplay) { return@combine true } keyguardClockInteractor.currentClockFontAxesWidth?.let { fontWidth -> if (fontWidth >= FONT_WIDTH_MAX_CUTOFF) { smallClockLogBuffer.log( TAG, LogLevel.INFO, { int1 = FONT_WIDTH_MAX_CUTOFF }, { "fallBelowClock:true, FontAxesWidth:$int1" }, ) return@combine true } } val screenWidthDp = configurationValues.screenWidthDp // if the shade is wide, we should account for the possibility of date/weather Loading @@ -233,7 +246,10 @@ constructor( bool1 = fallBelow bool2 = isShadeLayoutWide }, { "fallBelowClock:$bool1, isShadeWide:$bool2, Width:$int1, Font:$double1" }, { "fallBelowClock:$bool1, isShadeWide:$bool2, " + "Width:$int1, FontScale:$double1" }, ) fallBelow } Loading @@ -257,7 +273,7 @@ constructor( // font size to display size // These values come from changing the font size and display size on a non-foldable. // Visually looked at which configs cause the date/weather to push off of the screen val BREAKING_PAIRS = private val BREAKING_PAIRS = listOf( 0.85f to 320, // tiny font size but large display size 1f to 346, Loading @@ -265,5 +281,9 @@ constructor( 1.5f to 376, 1.8f to 411, // large font size but tiny display size ) // Font axes width max cutoff // A font with a wider font axes than this is at risk of being pushed off screen private const val FONT_WIDTH_MAX_CUTOFF = 110 } }
packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardClockRepository.kt +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ class FakeKeyguardClockRepository() : KeyguardClockRepository { private val _currentClockId = MutableStateFlow(DEFAULT_CLOCK_ID) override val currentClockId: Flow<ClockId> = _currentClockId private var _currentClockFontAxesWidth: Float? = 0f override val currentClockFontAxesWidth: Float? get() = _currentClockFontAxesWidth private val _currentClock: MutableStateFlow<ClockController?> = MutableStateFlow(null) override val currentClock = _currentClock Loading