Skip to content

android: keep device type labels across CONNECTED_DEVICES refresh - #930

Open
cemaliplt wants to merge 1 commit into
librepods-org:mainfrom
cemaliplt:cem/android-fix1
Open

cemaliplt wants to merge 1 commit into
librepods-org:mainfrom
cemaliplt:cem/android-fix1

Conversation

@cemaliplt

Copy link
Copy Markdown

What was wrong

AACPManager.kt:1251 looked up the previous device type in the local devices list, which is empty. existingDevice was always null, so the type set by SMART_ROUTING_RESP (iPad, Mac, Linux...) was dropped on every CONNECTED_DEVICES update, which replaces connectedDevices.

Fix

Look it up in connectedDevices.find { it.mac == mac }. That still holds the old list while parsing, because the new list is assigned only after parseConnectedDevicesResponse returns.

Verified

./gradlew :app:compileFossDebugKotlin and :app:compilePlayDebugKotlin both pass on this branch (BUILD SUCCESSFUL, no new warnings). The change was also checked by reading the code.

Not verified

Not run on a device or with AirPods; no unit test (the project has no Android test setup for this class).

🤖 Generated with Claude Code

What was wrong: AACPManager.kt:1251 looked up the previous type in the local 'devices' list, which is empty for each unique MAC, so existingDevice was always null and the type set by SMART_ROUTING_RESP (iPad, Mac, Linux...) was dropped on every CONNECTED_DEVICES update (line 519 replaces connectedDevices).

Fix: look up the previous list, connectedDevices.find { it.mac == mac }. connectedDevices still holds the old list while parsing because line 519 assigns the result only after parseConnectedDevicesResponse returns.

How checked: code reading only (origin/main 89356c0). Not built, no Android SDK available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant