Loading packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt +3 −3 Original line number Diff line number Diff line Loading @@ -88,9 +88,9 @@ class FooterActionsViewModel( /** Called when the expansion of the Quick Settings changed. */ fun onQuickSettingsExpansionChanged(expansion: Float, isInSplitShade: Boolean) { if (isInSplitShade) { // In split shade, we want to fade in the background only at the very end (see // b/240563302). val delay = 0.99f // In split shade, we want to fade in the background when the QS background starts to // show. val delay = 0.15f _alpha.value = expansion _backgroundAlpha.value = max(0f, expansion - delay) / (1f - delay) } else { Loading packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt +5 −5 Original line number Diff line number Diff line Loading @@ -393,23 +393,23 @@ class FooterActionsViewModelTest : SysuiTestCase() { } @Test fun backgroundAlpha_inSplitShade_followsExpansion_with_0_99_delay() { fun backgroundAlpha_inSplitShade_followsExpansion_with_0_15_delay() { val underTest = utils.footerActionsViewModel() val floatTolerance = 0.01f underTest.onQuickSettingsExpansionChanged(0f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isEqualTo(0f) underTest.onQuickSettingsExpansionChanged(0.5f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.1f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isEqualTo(0f) underTest.onQuickSettingsExpansionChanged(0.9f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.14f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isEqualTo(0f) underTest.onQuickSettingsExpansionChanged(0.991f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.235f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.1f) underTest.onQuickSettingsExpansionChanged(0.995f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.575f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.5f) underTest.onQuickSettingsExpansionChanged(1f, isInSplitShade = true) Loading Loading
packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt +3 −3 Original line number Diff line number Diff line Loading @@ -88,9 +88,9 @@ class FooterActionsViewModel( /** Called when the expansion of the Quick Settings changed. */ fun onQuickSettingsExpansionChanged(expansion: Float, isInSplitShade: Boolean) { if (isInSplitShade) { // In split shade, we want to fade in the background only at the very end (see // b/240563302). val delay = 0.99f // In split shade, we want to fade in the background when the QS background starts to // show. val delay = 0.15f _alpha.value = expansion _backgroundAlpha.value = max(0f, expansion - delay) / (1f - delay) } else { Loading
packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt +5 −5 Original line number Diff line number Diff line Loading @@ -393,23 +393,23 @@ class FooterActionsViewModelTest : SysuiTestCase() { } @Test fun backgroundAlpha_inSplitShade_followsExpansion_with_0_99_delay() { fun backgroundAlpha_inSplitShade_followsExpansion_with_0_15_delay() { val underTest = utils.footerActionsViewModel() val floatTolerance = 0.01f underTest.onQuickSettingsExpansionChanged(0f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isEqualTo(0f) underTest.onQuickSettingsExpansionChanged(0.5f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.1f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isEqualTo(0f) underTest.onQuickSettingsExpansionChanged(0.9f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.14f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isEqualTo(0f) underTest.onQuickSettingsExpansionChanged(0.991f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.235f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.1f) underTest.onQuickSettingsExpansionChanged(0.995f, isInSplitShade = true) underTest.onQuickSettingsExpansionChanged(0.575f, isInSplitShade = true) assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.5f) underTest.onQuickSettingsExpansionChanged(1f, isInSplitShade = true) Loading