From 3a5319605f4812c3799840c825c7d3ab5aea8149 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Apr 2026 02:02:53 +0000 Subject: [PATCH] fix(call): suppress legacy Bluetooth SCO deprecation warnings The legacy Bluetooth SCO APIs (EXTRA_SCO_AUDIO_STATE, SCO_AUDIO_STATE_*, isBluetoothScoOn, ACTION_SCO_AUDIO_STATE_UPDATED) were deprecated in API 31+ in favor of AudioManager.setCommunicationDevice(), which this class already uses on S+. Gate the legacy SCO broadcast receiver to pre-S builds and suppress the deprecation warnings on the function, matching the pattern already used on startBluetoothSco/stopBluetoothSco. --- .../vitorpamplona/amethyst/service/call/CallAudioManager.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/call/CallAudioManager.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/call/CallAudioManager.kt index afde99043..2fc33b00d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/call/CallAudioManager.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/call/CallAudioManager.kt @@ -143,7 +143,9 @@ class CallAudioManager( } else { routeToEarpiece() } - registerBluetoothScoReceiver() + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { + registerBluetoothScoReceiver() + } } else { _isBluetoothAvailable.value = false routeToEarpiece() @@ -301,6 +303,7 @@ class CallAudioManager( } } + @Suppress("DEPRECATION") private fun registerBluetoothScoReceiver() { if (scoReceiver != null) return scoReceiver =