General: Fix dashboard crash from duplicate devices#554
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
OverviewScreenkeyed the profiled-deviceLazyColumnonprofileIdalone (introduced in77ea3121).DeviceMonitordeliberately keeps multiplePodDeviceentries per non-IRK profile (DeviceMonitor.kt:104–106), so the uniqueness assumption was wrong and Compose threwIllegalArgumentExceptionfromLayoutNodeSubcompositionsState.subcompose.NavDisplaywraps each screen inAnimatedContent; the extra remeasure passes during screen transitions widen the duplicate-key window.profiled:<pid>for the common single-device case (preserving item state across recompositions and animations) and only disambiguate asprofiled:<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-equalPodDevicesnapshots.DeviceMonitormerge logic is unchanged — keeping multiple non-IRK matches visible is documented as intentional.userExpansionOverridesis keyed byprofileId) and may visually swap order between scans.