Skip to content

Fix Android LE Audio device type decoding - #187

Open
akshatgoel07 wants to merge 2 commits into
ryanheise:masterfrom
akshatgoel07:fix/android-le-audio-device-types
Open

Fix Android LE Audio device type decoding#187
akshatgoel07 wants to merge 2 commits into
ryanheise:masterfrom
akshatgoel07:fix/android-le-audio-device-types

Conversation

@akshatgoel07

Copy link
Copy Markdown

Summary

  • preserve Android audio device type integers 26 through 35, including hidden value 28
  • decode device types through explicit raw values instead of Dart enum positions
  • preserve raw values when calling getStreamVolumeDb
  • map the new Android types conservatively into existing cross-platform device types
  • add regression coverage for decoding, invalid values, and outbound serialization

Verification that the types are missing

Verified against both released audio_session 0.2.4 and upstream master before this change:

Android sources

Root cause

The platform integer was treated as a Dart enum index. Explicit raw values prevent hidden or future Android constants from shifting later meanings.

Validation

  • flutter test: 2 tests pass. The tests pass complete MethodChannel device maps through the real decoder for values 26 through 35, -1, 36, and null.
  • The outbound getStreamVolumeDb test verifies Android value 29 is sent even though the Dart enum index differs.
  • flutter analyze: no issues.
  • Formatter check: no changes.

Physical LE Audio hardware was not available for verification. The attached Android 14 device reports mLeAudio: null and an active classic A2DP device, so it cannot reproduce the LE path. The regression tests verify the Dart channel boundary using the exact raw Android integers.

Scope

This changes no Kotlin code, Android permission, or manifest entry. Active-route detection and Darwin port support remain separate concerns.

Fixes #185

@akshatgoel07
akshatgoel07 marked this pull request as ready for review August 5, 2026 11:37
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.

Android LE Audio device types decode as unknown

1 participant