Skip to content

General: Fix dashboard crash from duplicate devices#554

Merged
d4rken merged 1 commit into
mainfrom
fix/overview-lazylist-key-crash
Apr 25, 2026
Merged

General: Fix dashboard crash from duplicate devices#554
d4rken merged 1 commit into
mainfrom
fix/overview-lazylist-key-crash

Conversation

@d4rken

@d4rken d4rken commented Apr 25, 2026

Copy link
Copy Markdown
Member

What changed

Fixes an occasional crash on the dashboard reported in Google Play Console for v5.1.0. Triggered when multiple Bluetooth devices match the same profile — most common with non-IRK profiles where the legacy signal-quality fallback assigns ambient pods to a user profile.

Technical Context

  • Root cause: OverviewScreen keyed the profiled-device LazyColumn on profileId alone (introduced in 77ea3121). DeviceMonitor deliberately keeps multiple PodDevice entries per non-IRK profile (DeviceMonitor.kt:104–106), so the uniqueness assumption was wrong and Compose threw IllegalArgumentException from LayoutNodeSubcompositionsState.subcompose.
  • The signature is dominated by users navigating in/out of Overview because Navigation3's NavDisplay wraps each screen in AnimatedContent; the extra remeasure passes during screen transitions widen the duplicate-key window.
  • Fix is UI-side only: keys stay profiled:<pid> for the common single-device case (preserving item state across recompositions and animations) and only disambiguate as profiled:<pid>:<identifier> when the current list actually contains a collision. Same defensive treatment applied to unmatched devices, where the previous ?: hashCode() fallback could collide structurally for data-class-equal PodDevice snapshots.
  • DeviceMonitor merge logic is unchanged — keeping multiple non-IRK matches visible is documented as intentional.
  • Out of scope (rare edge cases hidden by the crash): duplicate cards share expansion state (userExpansionOverrides is keyed by profileId) and may visually swap order between scans.

@d4rken d4rken added the bug Something isn't working label Apr 25, 2026
@d4rken d4rken merged commit bcb4bdf into main Apr 25, 2026
10 checks passed
@d4rken d4rken deleted the fix/overview-lazylist-key-crash branch April 25, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant