Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d383e654 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez
Browse files

Resetting the state when targets are set and the interaction ends

When the magnetic targets are set, there is a slight chance that a
dragged notification is dismissed by a very fast fling. In such a case,
we need to make sure that the state resets when the magnetic interaction
ends.

Test: MagneticRowManagerImplTest
Flag: com.android.systemui.magnetic_notification_swipes
Bug: 390179908
Change-Id: If2b36db309169619ebf53b5e0668343f553c0ecf
parent 40592956
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -247,6 +247,19 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() {
            assertThat(underTest.currentState).isEqualTo(State.IDLE)
        }

    @Test
    fun onMagneticInteractionEnd_whileTargetsSet_goesToIdle() =
        kosmos.testScope.runTest {
            // GIVEN that targets are set
            setTargets()

            // WHEN the interaction ends on the row
            underTest.onMagneticInteractionEnd(swipedRow, velocity = null)

            // THEN the state resets
            assertThat(underTest.currentState).isEqualTo(State.IDLE)
        }

    @Test
    fun onMagneticInteractionEnd_whileDetached_goesToIdle() =
        kosmos.testScope.runTest {
+1 −0
Original line number Diff line number Diff line
@@ -270,6 +270,7 @@ constructor(
        translationOffset = 0f
        if (row.isSwipedTarget()) {
            when (currentState) {
                State.TARGETS_SET -> currentState = State.IDLE
                State.PULLING -> {
                    snapNeighborsBack(velocity)
                    currentState = State.IDLE