summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Josh Tsuji <tsuji@google.com> 2024-05-15 18:27:10 -0400
committer Josh Tsuji <tsuji@google.com> 2024-05-16 04:22:19 +0000
commit5a8810691ac0cb0929efc465ba116b2c60b04437 (patch)
tree1b68c3f2ffc36673c6d85e04d793a0323212bacf
parentb310a0e0a112039aae0f89cac140a531080dd681 (diff)
Make FlingInfos unique.
Under test, velocities are often identical, which causes StateFlows not to emit duplicate values. Other sources of uniqueness such as SystemUptimeMillis also don't behave as expected under test, so this seems as good a way as any to address that. Test: atest KeyguardTests Flag: N/A Bug: 278086361 Change-Id: I0d67470d894928e47e6489d9101e788c1eab51d5
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/data/repository/FlingInfo.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/data/repository/FlingInfo.kt b/packages/SystemUI/src/com/android/systemui/shade/data/repository/FlingInfo.kt
index d7f96e6cfa6b..ea2f9ab817e4 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/data/repository/FlingInfo.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/data/repository/FlingInfo.kt
@@ -16,11 +16,16 @@
package com.android.systemui.shade.data.repository
+import java.util.UUID
+
/**
* Information about a fling on the shade: whether we're flinging expanded or collapsed, and the
* velocity of the touch gesture that started the fling (if applicable).
*/
-data class FlingInfo(
+data class FlingInfo @JvmOverloads constructor(
val expand: Boolean,
val velocity: Float = 0f,
+
+ /** Required to emit duplicate FlingInfo from StateFlow. */
+ val id: UUID = UUID.randomUUID()
)