audioswitch
audioswitch copied to clipboard
Cannot use bluetooth headsets when targetSdkVersion < 31 and Build.VERSION >= 31
Describe the bug In adding support for API level 31, commit 07dfe6fd3052ec90346b5700ad08bcc5f5c92e7d introduced logic in BluetoothHeadsetManager.kt to determine a strategy for checking against the new bluetooth permissions.
However, I believe this logic is incorrect - it is checking Build.VERSION, but internally (at least in BluetoothHeadset.java) android checks for targetSdkVersion.
From what I can tell, the BLUETOOTH and BLUETOOTH_CONNECT permissions are mutually exclusive (requesting one denies the other), so it's impossible to pass both of these checks when targetSdkVersion < 31 (fails in BluetoothHeadset.java) and Build.VERSION >= 31 (fails in BluetoothHeadsetManager.kt)
AudioSwitch Version
- Version: 1.1.5