The bluetooth permissions are currently only used to get information about Bluetooth devices, and aren't actually needed to connect/route audio to the bluetooth device.
The callback AudioManager.registerAudioDeviceCallback since API 23, avoid the need for the BLUETOOTH_CONNECT permission. This is particularly important on API 31 and up, where the BLUETOOTH_CONNECT is a runtime permission (with a rather confusing permission message).
Breakdown
Create a scanner interface to be able of extract logic of devices discovery
Create a legacy implementation to be able of scan audio devices compatible with android version up to M
Create a new modern implementation to be able of scan audio devices compatible with android version from M onwards
Create a comparator to a sortedset to main the correct order of the devices
Adapt the current AudioSwitch class to split and better use of this different logics
The former AudioSwitch is now the AbstractAudioSwitch that contains the common logic
The specifics belongs to AudioSwitch and LegacyAudioSwitch classes
Description
The bluetooth permissions are currently only used to get information about Bluetooth devices, and aren't actually needed to connect/route audio to the bluetooth device.
The callback AudioManager.registerAudioDeviceCallback since API 23, avoid the need for the BLUETOOTH_CONNECT permission. This is particularly important on API 31 and up, where the BLUETOOTH_CONNECT is a runtime permission (with a rather confusing permission message).
Breakdown
Validation
Additional Notes
https://github.com/twilio/audioswitch/issues/134 https://github.com/twilio/audioswitch/issues/118 https://github.com/twilio/audioswitch/issues/115 https://github.com/twilio/audioswitch/issues/92
Submission Checklist
gradle.properties
CHANGELOG.md
reflects any feature, bug fixes, or known issues made in the source code