Problem
On Android, AudioDeviceInfo.getType() is forwarded unchanged by the Kotlin plugin, but Dart decodes it with decodeEnum(AndroidAudioDeviceType.values, rawType, ...). AndroidAudioDeviceType stops at value 25, so Android device types 26 and above silently become AndroidAudioDeviceType.unknown.
The device itself remains present; only its type is lost.
Missing values
The current Android type space includes:
- 26:
TYPE_BLE_HEADSET
- 27:
TYPE_BLE_SPEAKER
- 28:
TYPE_ECHO_REFERENCE (@hide, but still occupies the integer)
- 29:
TYPE_HDMI_EARC
- 30:
TYPE_BLE_BROADCAST
- 31:
TYPE_DOCK_ANALOG
- 32:
TYPE_MULTICHANNEL_GROUP
The live Android API reference also documents API 37 preview values 33-35: TYPE_BLE_HEARING_AID, TYPE_BLE_CENTRAL, and TYPE_BLE_CENTRAL_BROADCAST.
Omitting hidden value 28 from a positional enum would shift every later value and produce plausible but incorrect device types.
Proposed fix
- Give
AndroidAudioDeviceType explicit raw integer values.
- Decode through a value map instead of enum position.
- Update
getStreamVolumeDb to send the explicit raw value instead of .index.
- Add regression coverage for existing values, missing values, invalid/future values, and outbound serialization.
- Map the new Android values conservatively into the existing cross-platform
AudioDeviceType values.
Scope
This requires no Kotlin change, new Android permission, or manifest change. Active-route detection (getDevices() reports connected devices) and Darwin port support are separate concerns.
References:
Problem
On Android,
AudioDeviceInfo.getType()is forwarded unchanged by the Kotlin plugin, but Dart decodes it withdecodeEnum(AndroidAudioDeviceType.values, rawType, ...).AndroidAudioDeviceTypestops at value 25, so Android device types 26 and above silently becomeAndroidAudioDeviceType.unknown.The device itself remains present; only its type is lost.
Missing values
The current Android type space includes:
TYPE_BLE_HEADSETTYPE_BLE_SPEAKERTYPE_ECHO_REFERENCE(@hide, but still occupies the integer)TYPE_HDMI_EARCTYPE_BLE_BROADCASTTYPE_DOCK_ANALOGTYPE_MULTICHANNEL_GROUPThe live Android API reference also documents API 37 preview values 33-35:
TYPE_BLE_HEARING_AID,TYPE_BLE_CENTRAL, andTYPE_BLE_CENTRAL_BROADCAST.Omitting hidden value 28 from a positional enum would shift every later value and produce plausible but incorrect device types.
Proposed fix
AndroidAudioDeviceTypeexplicit raw integer values.getStreamVolumeDbto send the explicit raw value instead of.index.AudioDeviceTypevalues.Scope
This requires no Kotlin change, new Android permission, or manifest change. Active-route detection (
getDevices()reports connected devices) and Darwin port support are separate concerns.References: