mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Disable call audio toggle while the switch is processing.
This commit is contained in:
@@ -241,6 +241,7 @@ class FullSignalAudioManagerApi31(context: Context, eventListener: EventListener
|
||||
eventListener?.onAudioDeviceChanged(AudioDeviceMapping.fromPlatformType(candidate.type), availableCommunicationDevices.map { AudioDeviceMapping.fromPlatformType(it.type) }.toSet())
|
||||
} else {
|
||||
Log.w(TAG, "Failed to set ${candidate.id} of type ${getDeviceTypeName(candidate.type)} as communication device.")
|
||||
eventListener?.onAudioDeviceChangeFailed()
|
||||
}
|
||||
} else {
|
||||
val searchOrder: List<AudioDevice> = listOf(AudioDevice.BLUETOOTH, AudioDevice.WIRED_HEADSET, defaultAudioDevice, AudioDevice.EARPIECE, AudioDevice.SPEAKER_PHONE, AudioDevice.NONE).distinct()
|
||||
@@ -264,6 +265,7 @@ class FullSignalAudioManagerApi31(context: Context, eventListener: EventListener
|
||||
eventListener?.onAudioDeviceChanged(AudioDeviceMapping.fromPlatformType(candidate.type), availableCommunicationDevices.map { AudioDeviceMapping.fromPlatformType(it.type) }.toSet())
|
||||
} else {
|
||||
Log.w(TAG, "Failed to set ${candidate.id} as communication device.")
|
||||
eventListener?.onAudioDeviceChangeFailed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ sealed class SignalAudioManager(protected val context: Context, protected val ev
|
||||
interface EventListener {
|
||||
@JvmSuppressWildcards
|
||||
fun onAudioDeviceChanged(activeDevice: AudioDevice, devices: Set<AudioDevice>)
|
||||
fun onAudioDeviceChangeFailed()
|
||||
fun onBluetoothPermissionDenied()
|
||||
}
|
||||
}
|
||||
@@ -354,8 +355,11 @@ class FullSignalAudioManager(context: Context, eventListener: EventListener?) :
|
||||
if (newAudioDevice != selectedAudioDevice || audioDeviceSetUpdated) {
|
||||
setAudioDevice(newAudioDevice)
|
||||
Log.i(TAG, "New device status: available: $audioDevices, selected: $newAudioDevice")
|
||||
eventListener?.onAudioDeviceChanged(selectedAudioDevice, audioDevices)
|
||||
}
|
||||
|
||||
// Always notify listener to clear any pending audio device change state,
|
||||
// even if the device didn't actually change
|
||||
eventListener?.onAudioDeviceChanged(selectedAudioDevice, audioDevices)
|
||||
}
|
||||
|
||||
override fun setDefaultAudioDevice(recipientId: RecipientId?, newDefaultDevice: AudioDevice, clearUserEarpieceSelection: Boolean) {
|
||||
|
||||
Reference in New Issue
Block a user