You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix volume settings applied to speaker when Bluetooth is turned off
When Bluetooth is disabled (via settings, airplane mode, or device reboot),
Android doesn't fire ACTION_ACL_DISCONNECTED events for connected devices.
This caused the app to continue applying Bluetooth device volume settings
to the built-in speaker, potentially resulting in unexpected audio levels.
The fix monitors Bluetooth adapter state changes using flatMapLatest on the
isEnabled flow. When Bluetooth is turned OFF, pairedDevices now correctly
emits only the speaker device, ensuring proper volume settings are applied.
Also refactored BluetoothRepo for better readability:
- Extracted bluetoothDeviceEvents() function from inline callbackFlow
- Moved retryWhen outside flatMapLatest for better state re-evaluation
- Simplified speaker device addition to single location
- Made State.devices non-nullable for type safety
Fixes issue reported via email regarding volume management during BT state changes.
0 commit comments