Loading packages/SystemUI/aconfig/systemui.aconfig +12 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,18 @@ flag { } } flag { name: "no_expansion_on_overscroll" namespace: "systemui" description: "Enable the fix where QS Expansion is set to zero on overscroll. This should" "prevent unnecessary work and remove jank when overscrolling." bug: "414346597" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "flashlight_strength" namespace: "systemui" Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt +35 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.platform.test.annotations.EnableFlags import android.testing.TestableLooper.RunWithLooper import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.Flags.FLAG_QS_COMPOSE_FRAGMENT_EARLY_EXPANSION import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -77,6 +78,40 @@ class QSFragmentComposeViewModelTest : AbstractQSFragmentComposeViewModelTest() } } @Test @EnableFlags(Flags.FLAG_NO_EXPANSION_ON_OVERSCROLL) fun qsExpansionValueChanges_whenOverScrolling_zeroExpansionState() = with(kosmos) { testScope.testWithinLifecycle { underTest.isStackScrollerOverscrolling = true underTest.setQsExpansionValue(0f) assertThat(underTest.expansionState.progress).isEqualTo(0f) underTest.setQsExpansionValue(0.3f) assertThat(underTest.expansionState.progress).isEqualTo(0f) underTest.setQsExpansionValue(1f) assertThat(underTest.expansionState.progress).isEqualTo(0f) } } @Test @DisableFlags(Flags.FLAG_NO_EXPANSION_ON_OVERSCROLL) fun qsExpansionValueChanges_whenOverScrolling_nonZeroExpansionState_withFlagOff() = with(kosmos) { testScope.testWithinLifecycle { underTest.isStackScrollerOverscrolling = true underTest.setQsExpansionValue(0f) assertThat(underTest.expansionState.progress).isEqualTo(0f) underTest.setQsExpansionValue(0.3f) assertThat(underTest.expansionState.progress).isEqualTo(0.3f) underTest.setQsExpansionValue(1f) assertThat(underTest.expansionState.progress).isEqualTo(1f) } } @Test fun qsExpansionValueChanges_clamped() = with(kosmos) { Loading packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt +4 −1 Original line number Diff line number Diff line Loading @@ -225,7 +225,10 @@ constructor( if (forceQs) { QSExpansionState(1f) } else { QSExpansionState(qsExpansion.coerceIn(if (isQsExpanded) EARLY_EXPANSION else 0f, 1f)) QSExpansionState( if (Flags.noExpansionOnOverscroll() && isStackScrollerOverscrolling) 0f else qsExpansion.coerceIn(if (isQsExpanded) EARLY_EXPANSION else 0f, 1f) ) } } Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +12 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,18 @@ flag { } } flag { name: "no_expansion_on_overscroll" namespace: "systemui" description: "Enable the fix where QS Expansion is set to zero on overscroll. This should" "prevent unnecessary work and remove jank when overscrolling." bug: "414346597" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "flashlight_strength" namespace: "systemui" Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt +35 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.platform.test.annotations.EnableFlags import android.testing.TestableLooper.RunWithLooper import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.Flags.FLAG_QS_COMPOSE_FRAGMENT_EARLY_EXPANSION import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.coroutines.collectLastValue Loading Loading @@ -77,6 +78,40 @@ class QSFragmentComposeViewModelTest : AbstractQSFragmentComposeViewModelTest() } } @Test @EnableFlags(Flags.FLAG_NO_EXPANSION_ON_OVERSCROLL) fun qsExpansionValueChanges_whenOverScrolling_zeroExpansionState() = with(kosmos) { testScope.testWithinLifecycle { underTest.isStackScrollerOverscrolling = true underTest.setQsExpansionValue(0f) assertThat(underTest.expansionState.progress).isEqualTo(0f) underTest.setQsExpansionValue(0.3f) assertThat(underTest.expansionState.progress).isEqualTo(0f) underTest.setQsExpansionValue(1f) assertThat(underTest.expansionState.progress).isEqualTo(0f) } } @Test @DisableFlags(Flags.FLAG_NO_EXPANSION_ON_OVERSCROLL) fun qsExpansionValueChanges_whenOverScrolling_nonZeroExpansionState_withFlagOff() = with(kosmos) { testScope.testWithinLifecycle { underTest.isStackScrollerOverscrolling = true underTest.setQsExpansionValue(0f) assertThat(underTest.expansionState.progress).isEqualTo(0f) underTest.setQsExpansionValue(0.3f) assertThat(underTest.expansionState.progress).isEqualTo(0.3f) underTest.setQsExpansionValue(1f) assertThat(underTest.expansionState.progress).isEqualTo(1f) } } @Test fun qsExpansionValueChanges_clamped() = with(kosmos) { Loading
packages/SystemUI/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModel.kt +4 −1 Original line number Diff line number Diff line Loading @@ -225,7 +225,10 @@ constructor( if (forceQs) { QSExpansionState(1f) } else { QSExpansionState(qsExpansion.coerceIn(if (isQsExpanded) EARLY_EXPANSION else 0f, 1f)) QSExpansionState( if (Flags.noExpansionOnOverscroll() && isStackScrollerOverscrolling) 0f else qsExpansion.coerceIn(if (isQsExpanded) EARLY_EXPANSION else 0f, 1f) ) } } Loading