Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt +29 −0 Original line number Diff line number Diff line Loading @@ -530,11 +530,40 @@ class QSFragmentComposeViewModelTest : AbstractQSFragmentComposeViewModelTest() testScope.testWithinLifecycle { underTest.isQsExpanded = true underTest.setQsExpansionValue(0f) // The shade is not being collapsed underTest.panelExpansionFraction = 1f underTest.squishinessFraction = 1f assertThat(underTest.expansionState.progress).isGreaterThan(0f) } } @Test @EnableFlags(FLAG_QS_COMPOSE_FRAGMENT_EARLY_EXPANSION) fun minExpansion_expanded_collapsingShade_panelExpansion_noEarlyExpansion() = with(kosmos) { testScope.testWithinLifecycle { underTest.isQsExpanded = true underTest.setQsExpansionValue(0f) underTest.panelExpansionFraction = 0.9f assertThat(underTest.expansionState.progress).isEqualTo(0f) } } @Test @EnableFlags(FLAG_QS_COMPOSE_FRAGMENT_EARLY_EXPANSION) fun minExpansion_expanded_collapsingShade_squishiness_noEarlyExpansion() = with(kosmos) { testScope.testWithinLifecycle { underTest.isQsExpanded = true underTest.setQsExpansionValue(0f) underTest.squishinessFraction = 0.9f assertThat(underTest.expansionState.progress).isEqualTo(0f) } } private fun TestScope.setMediaState(state: MediaState) { with(kosmos) { val activeMedia = state == ACTIVE_MEDIA Loading packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt +16 −1 Original line number Diff line number Diff line Loading @@ -227,7 +227,22 @@ constructor( } else { QSExpansionState( if (Flags.noExpansionOnOverscroll() && isStackScrollerOverscrolling) 0f else qsExpansion.coerceIn(if (isQsExpanded) EARLY_EXPANSION else 0f, 1f) else qsExpansion.coerceIn( // Only apply early expansion if we are not collapsing QQS, measured by // panelExpansionFraction and squishinessFraction minimumValue = if ( isQsExpanded && panelExpansionFraction >= 1f && squishinessFraction >= 1f ) { EARLY_EXPANSION } else { 0f }, maximumValue = 1f, ) ) } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt +29 −0 Original line number Diff line number Diff line Loading @@ -530,11 +530,40 @@ class QSFragmentComposeViewModelTest : AbstractQSFragmentComposeViewModelTest() testScope.testWithinLifecycle { underTest.isQsExpanded = true underTest.setQsExpansionValue(0f) // The shade is not being collapsed underTest.panelExpansionFraction = 1f underTest.squishinessFraction = 1f assertThat(underTest.expansionState.progress).isGreaterThan(0f) } } @Test @EnableFlags(FLAG_QS_COMPOSE_FRAGMENT_EARLY_EXPANSION) fun minExpansion_expanded_collapsingShade_panelExpansion_noEarlyExpansion() = with(kosmos) { testScope.testWithinLifecycle { underTest.isQsExpanded = true underTest.setQsExpansionValue(0f) underTest.panelExpansionFraction = 0.9f assertThat(underTest.expansionState.progress).isEqualTo(0f) } } @Test @EnableFlags(FLAG_QS_COMPOSE_FRAGMENT_EARLY_EXPANSION) fun minExpansion_expanded_collapsingShade_squishiness_noEarlyExpansion() = with(kosmos) { testScope.testWithinLifecycle { underTest.isQsExpanded = true underTest.setQsExpansionValue(0f) underTest.squishinessFraction = 0.9f assertThat(underTest.expansionState.progress).isEqualTo(0f) } } private fun TestScope.setMediaState(state: MediaState) { with(kosmos) { val activeMedia = state == ACTIVE_MEDIA Loading
packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt +16 −1 Original line number Diff line number Diff line Loading @@ -227,7 +227,22 @@ constructor( } else { QSExpansionState( if (Flags.noExpansionOnOverscroll() && isStackScrollerOverscrolling) 0f else qsExpansion.coerceIn(if (isQsExpanded) EARLY_EXPANSION else 0f, 1f) else qsExpansion.coerceIn( // Only apply early expansion if we are not collapsing QQS, measured by // panelExpansionFraction and squishinessFraction minimumValue = if ( isQsExpanded && panelExpansionFraction >= 1f && squishinessFraction >= 1f ) { EARLY_EXPANSION } else { 0f }, maximumValue = 1f, ) ) } } Loading