diff options
| author | 2025-03-14 09:50:49 -0700 | |
|---|---|---|
| committer | 2025-03-14 09:54:05 -0700 | |
| commit | d383e6541bed30be5c7ecf2c839f77326f00caa1 (patch) | |
| tree | cb35b0c2ca194d605ab0c8894f6d3becf21d0981 | |
| parent | 405929567b67839ec13c2caf644b6472c9f714d9 (diff) | |
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
2 files changed, 14 insertions, 0 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt index 6c6ba933c03a..936b971c889b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt @@ -248,6 +248,19 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { } @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 { // GIVEN the swiped row is detached diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt index 6e8b2226b4f6..7d489a97f853 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt @@ -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 |