Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +4 −6 Original line number Diff line number Diff line Loading @@ -104,10 +104,8 @@ constructor( media = { with(mediaCarouselElement) { KeyguardMediaCarousel( isShadeLayoutWide = viewModel.isShadeLayoutWide, onBottomChanged = { bottom -> viewModel.setMediaPlayerBottom(bottom = bottom) }, isFullWidthShade = viewModel.isFullWidthShade, onBottomChanged = viewModel::setMediaPlayerBottom, ) } }, Loading @@ -125,7 +123,7 @@ constructor( Shortcut( isStart = true, applyPadding = false, onTopChanged = { top -> viewModel.setShortcutTop(top) }, onTopChanged = viewModel::setShortcutTop, ) } }, Loading @@ -146,7 +144,7 @@ constructor( Shortcut( isStart = false, applyPadding = false, onTopChanged = { top -> viewModel.setShortcutTop(top) }, onTopChanged = viewModel::setShortcutTop, ) } }, Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/element/MediaCarouselElement.kt +4 −4 Original line number Diff line number Diff line Loading @@ -48,16 +48,16 @@ constructor( @Composable fun ContentScope.KeyguardMediaCarousel( isShadeLayoutWide: Boolean, isFullWidthShade: Boolean, modifier: Modifier = Modifier, onBottomChanged: ((Float) -> Unit)? = null, ) { val horizontalPadding = if (isShadeLayoutWide) { dimensionResource(id = R.dimen.notification_side_paddings) } else { if (isFullWidthShade) { dimensionResource(id = R.dimen.notification_side_paddings) + dimensionResource(id = R.dimen.notification_panel_margin_horizontal) } else { dimensionResource(id = R.dimen.notification_side_paddings) } if (mediaControlsInCompose()) { val viewModel = Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSectionTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class SmartspaceSectionTest : SysuiTestCase() { private val shouldDateWeatherBeBelowSmallClock = MutableStateFlow(true) private val shouldDateWeatherBeBelowLargeClock = MutableStateFlow(true) private val isWeatherVisibleFlow = MutableStateFlow(false) private val isShadeLayoutWide = MutableStateFlow(false) private val isFullWidthShade = MutableStateFlow(true) private val isLargeClockVisible = MutableStateFlow(true) @Before Loading Loading @@ -106,7 +106,7 @@ class SmartspaceSectionTest : SysuiTestCase() { whenever(keyguardClockViewModel.clockShouldBeCentered).thenReturn(clockShouldBeCentered) whenever(keyguardSmartspaceViewModel.isSmartspaceEnabled).thenReturn(true) whenever(keyguardSmartspaceViewModel.isWeatherVisible).thenReturn(isWeatherVisibleFlow) whenever(keyguardSmartspaceViewModel.isShadeLayoutWide).thenReturn(isShadeLayoutWide) whenever(keyguardSmartspaceViewModel.isFullWidthShade).thenReturn(isFullWidthShade) constraintSet = ConstraintSet() } Loading Loading @@ -154,7 +154,7 @@ class SmartspaceSectionTest : SysuiTestCase() { @Test @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT) fun testConstraintsWhenShadeLayoutIsWide() { isShadeLayoutWide.value = true isFullWidthShade.value = false underTest.addViews(constraintLayout) underTest.applyConstraints(constraintSet) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSmartspaceViewModelTest.kt +42 −65 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ import com.android.systemui.keyguard.data.repository.fakeKeyguardClockRepository import com.android.systemui.keyguard.data.repository.keyguardClockRepository import com.android.systemui.keyguard.data.repository.keyguardSmartspaceRepository import com.android.systemui.keyguard.shared.model.ClockSize import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.testKosmos Loading @@ -41,9 +42,9 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardSmartspaceViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope val underTest = kosmos.keyguardSmartspaceViewModel private val kosmos = testKosmos() private val underTest = kosmos.keyguardSmartspaceViewModel @Mock(answer = Answers.RETURNS_DEEP_STUBS) private lateinit var clockController: ClockController Loading @@ -55,152 +56,128 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { @Test fun testWhenWeatherEnabled_notCustomWeatherDataDisplay_isWeatherVisible_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isWeatherVisible).isEqualTo(true) } @Test fun testWhenWeatherEnabled_notCustomWeatherDataDisplay_isWeatherVisible_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isWeatherVisible).isEqualTo(true) } @Test fun testWhenWeatherEnabled_hasCustomWeatherDataDisplay_isWeatherVisible_shouldBeFalse() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isWeatherVisible).isEqualTo(false) } @Test fun testWhenWeatherEnabled_hasCustomWeatherDataDisplay_isWeatherVisible_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isWeatherVisible).isEqualTo(true) } @Test fun testWhenWeatherEnabled_notCustomWeatherDataDisplay_notIsWeatherVisible_shouldBeFalse() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(false) keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isWeatherVisible).isEqualTo(false) } @Test fun isDateVisible_notCustomWeatherDataDisplay_largeClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isDateVisible).isEqualTo(true) } @Test fun isDateVisible_hasCustomWeatherDataDisplay_largeClock_shouldBeFalse() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(true) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isDateVisible).isEqualTo(false) } @Test fun isDateVisible_hasCustomWeatherDataDisplay_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay) .thenReturn(true) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isDateVisible).isEqualTo(true) } @Test fun isDateVisible_notCustomWeatherDataDisplay_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isDateVisible).isEqualTo(true) } @Test fun isShadeLayoutWide_withConfigTrue_true() = with(kosmos) { testScope.runTest { val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) fun isFullWidthShade_withConfigTrue_false() = kosmos.runTest { val isFullWidthShade by collectLastValue(underTest.isFullWidthShade) shadeRepository.setShadeLayoutWide(true) assertThat(isShadeLayoutWide).isTrue() } assertThat(isFullWidthShade).isFalse() } @Test fun isShadeLayoutWide_withConfigFalse_false() = with(kosmos) { testScope.runTest { val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) fun isFullWidthShade_withConfigFalse_true() = kosmos.runTest { val isFullWidthShade by collectLastValue(underTest.isFullWidthShade) shadeRepository.setShadeLayoutWide(false) assertThat(isShadeLayoutWide).isFalse() } assertThat(isFullWidthShade).isTrue() } } packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorSceneContainerImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { } @Test fun qsFullscreen_dualShadeWide_falseWhenIdleQs() = fun qsFullscreen_dualShadeWide_trueWhenIdleQs() = kosmos.runTest { enableDualShade(wideLayout = true) val actual by collectLastValue(underTest.isQsFullscreen) Loading @@ -234,7 +234,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { ) // THEN QS is fullscreen assertThat(actual).isFalse() assertThat(actual).isTrue() } @Test Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +4 −6 Original line number Diff line number Diff line Loading @@ -104,10 +104,8 @@ constructor( media = { with(mediaCarouselElement) { KeyguardMediaCarousel( isShadeLayoutWide = viewModel.isShadeLayoutWide, onBottomChanged = { bottom -> viewModel.setMediaPlayerBottom(bottom = bottom) }, isFullWidthShade = viewModel.isFullWidthShade, onBottomChanged = viewModel::setMediaPlayerBottom, ) } }, Loading @@ -125,7 +123,7 @@ constructor( Shortcut( isStart = true, applyPadding = false, onTopChanged = { top -> viewModel.setShortcutTop(top) }, onTopChanged = viewModel::setShortcutTop, ) } }, Loading @@ -146,7 +144,7 @@ constructor( Shortcut( isStart = false, applyPadding = false, onTopChanged = { top -> viewModel.setShortcutTop(top) }, onTopChanged = viewModel::setShortcutTop, ) } }, Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/element/MediaCarouselElement.kt +4 −4 Original line number Diff line number Diff line Loading @@ -48,16 +48,16 @@ constructor( @Composable fun ContentScope.KeyguardMediaCarousel( isShadeLayoutWide: Boolean, isFullWidthShade: Boolean, modifier: Modifier = Modifier, onBottomChanged: ((Float) -> Unit)? = null, ) { val horizontalPadding = if (isShadeLayoutWide) { dimensionResource(id = R.dimen.notification_side_paddings) } else { if (isFullWidthShade) { dimensionResource(id = R.dimen.notification_side_paddings) + dimensionResource(id = R.dimen.notification_panel_margin_horizontal) } else { dimensionResource(id = R.dimen.notification_side_paddings) } if (mediaControlsInCompose()) { val viewModel = Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSectionTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class SmartspaceSectionTest : SysuiTestCase() { private val shouldDateWeatherBeBelowSmallClock = MutableStateFlow(true) private val shouldDateWeatherBeBelowLargeClock = MutableStateFlow(true) private val isWeatherVisibleFlow = MutableStateFlow(false) private val isShadeLayoutWide = MutableStateFlow(false) private val isFullWidthShade = MutableStateFlow(true) private val isLargeClockVisible = MutableStateFlow(true) @Before Loading Loading @@ -106,7 +106,7 @@ class SmartspaceSectionTest : SysuiTestCase() { whenever(keyguardClockViewModel.clockShouldBeCentered).thenReturn(clockShouldBeCentered) whenever(keyguardSmartspaceViewModel.isSmartspaceEnabled).thenReturn(true) whenever(keyguardSmartspaceViewModel.isWeatherVisible).thenReturn(isWeatherVisibleFlow) whenever(keyguardSmartspaceViewModel.isShadeLayoutWide).thenReturn(isShadeLayoutWide) whenever(keyguardSmartspaceViewModel.isFullWidthShade).thenReturn(isFullWidthShade) constraintSet = ConstraintSet() } Loading Loading @@ -154,7 +154,7 @@ class SmartspaceSectionTest : SysuiTestCase() { @Test @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT) fun testConstraintsWhenShadeLayoutIsWide() { isShadeLayoutWide.value = true isFullWidthShade.value = false underTest.addViews(constraintLayout) underTest.applyConstraints(constraintSet) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSmartspaceViewModelTest.kt +42 −65 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ import com.android.systemui.keyguard.data.repository.fakeKeyguardClockRepository import com.android.systemui.keyguard.data.repository.keyguardClockRepository import com.android.systemui.keyguard.data.repository.keyguardSmartspaceRepository import com.android.systemui.keyguard.shared.model.ClockSize import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.testKosmos Loading @@ -41,9 +42,9 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardSmartspaceViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope val underTest = kosmos.keyguardSmartspaceViewModel private val kosmos = testKosmos() private val underTest = kosmos.keyguardSmartspaceViewModel @Mock(answer = Answers.RETURNS_DEEP_STUBS) private lateinit var clockController: ClockController Loading @@ -55,152 +56,128 @@ class KeyguardSmartspaceViewModelTest : SysuiTestCase() { @Test fun testWhenWeatherEnabled_notCustomWeatherDataDisplay_isWeatherVisible_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isWeatherVisible).isEqualTo(true) } @Test fun testWhenWeatherEnabled_notCustomWeatherDataDisplay_isWeatherVisible_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isWeatherVisible).isEqualTo(true) } @Test fun testWhenWeatherEnabled_hasCustomWeatherDataDisplay_isWeatherVisible_shouldBeFalse() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isWeatherVisible).isEqualTo(false) } @Test fun testWhenWeatherEnabled_hasCustomWeatherDataDisplay_isWeatherVisible_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(true) keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isWeatherVisible).isEqualTo(true) } @Test fun testWhenWeatherEnabled_notCustomWeatherDataDisplay_notIsWeatherVisible_shouldBeFalse() = testScope.runTest { kosmos.runTest { val isWeatherVisible by collectLastValue(underTest.isWeatherVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardSmartspaceRepository.setIsWeatherEnabled(false) keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isWeatherVisible).isEqualTo(false) } @Test fun isDateVisible_notCustomWeatherDataDisplay_largeClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isDateVisible).isEqualTo(true) } @Test fun isDateVisible_hasCustomWeatherDataDisplay_largeClock_shouldBeFalse() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay) .thenReturn(true) whenever(clockController.largeClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.LARGE) } assertThat(isDateVisible).isEqualTo(false) } @Test fun isDateVisible_hasCustomWeatherDataDisplay_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay) .thenReturn(true) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay).thenReturn(true) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isDateVisible).isEqualTo(true) } @Test fun isDateVisible_notCustomWeatherDataDisplay_smallClock_shouldBeTrue() = testScope.runTest { kosmos.runTest { val isDateVisible by collectLastValue(underTest.isDateVisible) whenever(clockController.smallClock.config.hasCustomWeatherDataDisplay) .thenReturn(false) with(kosmos) { keyguardClockRepository.setClockSize(ClockSize.SMALL) } assertThat(isDateVisible).isEqualTo(true) } @Test fun isShadeLayoutWide_withConfigTrue_true() = with(kosmos) { testScope.runTest { val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) fun isFullWidthShade_withConfigTrue_false() = kosmos.runTest { val isFullWidthShade by collectLastValue(underTest.isFullWidthShade) shadeRepository.setShadeLayoutWide(true) assertThat(isShadeLayoutWide).isTrue() } assertThat(isFullWidthShade).isFalse() } @Test fun isShadeLayoutWide_withConfigFalse_false() = with(kosmos) { testScope.runTest { val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) fun isFullWidthShade_withConfigFalse_true() = kosmos.runTest { val isFullWidthShade by collectLastValue(underTest.isFullWidthShade) shadeRepository.setShadeLayoutWide(false) assertThat(isShadeLayoutWide).isFalse() } assertThat(isFullWidthShade).isTrue() } }
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorSceneContainerImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { } @Test fun qsFullscreen_dualShadeWide_falseWhenIdleQs() = fun qsFullscreen_dualShadeWide_trueWhenIdleQs() = kosmos.runTest { enableDualShade(wideLayout = true) val actual by collectLastValue(underTest.isQsFullscreen) Loading @@ -234,7 +234,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { ) // THEN QS is fullscreen assertThat(actual).isFalse() assertThat(actual).isTrue() } @Test Loading