Disable call audio toggle while the switch is processing.

This commit is contained in:
Alex Hart
2026-01-22 16:11:59 -04:00
committed by GitHub
parent c0d9efc930
commit 96273bb724
12 changed files with 53 additions and 8 deletions

View File

@@ -265,6 +265,10 @@ class ActiveCallManager(
callManager.onAudioDeviceChanged(activeDevice, devices)
}
override fun onAudioDeviceChangeFailed() {
callManager.onAudioDeviceChangeFailed()
}
override fun onBluetoothPermissionDenied() {
callManager.onBluetoothPermissionDenied()
}

View File

@@ -40,6 +40,7 @@ public abstract class DeviceAwareActionProcessor extends WebRtcActionProcessor {
.changeLocalDeviceState()
.setActiveDevice(activeDevice)
.setAvailableDevices(availableDevices)
.setAudioDeviceChangePending(false)
.build();
}
@@ -50,7 +51,10 @@ public abstract class DeviceAwareActionProcessor extends WebRtcActionProcessor {
RemotePeer activePeer = currentState.getCallInfoState().getActivePeer();
webRtcInteractor.setUserAudioDevice(activePeer != null ? activePeer.getId() : null, userDevice);
return currentState;
return currentState.builder()
.changeLocalDeviceState()
.setAudioDeviceChangePending(true)
.build();
}
@Override

View File

@@ -360,6 +360,10 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
process((s, p) -> p.handleAudioDeviceChanged(s, activeDevice, availableDevices));
}
public void onAudioDeviceChangeFailed() {
process((s, p) -> p.handleAudioDeviceChangeFailed(s));
}
public void onBluetoothPermissionDenied() {
process((s, p) -> p.handleBluetoothPermissionDenied(s));
}

View File

@@ -497,6 +497,14 @@ public abstract class WebRtcActionProcessor {
return currentState;
}
public @NonNull WebRtcServiceState handleAudioDeviceChangeFailed(@NonNull WebRtcServiceState currentState) {
Log.i(tag, "handleAudioDeviceChangeFailed(): clearing pending state");
return currentState.builder()
.changeLocalDeviceState()
.setAudioDeviceChangePending(false)
.build();
}
public @NonNull WebRtcServiceState handleBluetoothPermissionDenied(@NonNull WebRtcServiceState currentState) {
return currentState.builder()
.changeLocalDeviceState()

View File

@@ -18,6 +18,7 @@ data class LocalDeviceState(
var activeDevice: SignalAudioManager.AudioDevice = SignalAudioManager.AudioDevice.NONE,
var availableDevices: Set<SignalAudioManager.AudioDevice> = emptySet(),
var bluetoothPermissionDenied: Boolean = false,
var isAudioDeviceChangePending: Boolean = false,
var networkConnectionType: PeerConnection.AdapterType = PeerConnection.AdapterType.UNKNOWN,
var handRaisedTimestamp: Long = CallParticipant.HAND_LOWERED,
var remoteMutedBy: CallParticipant? = null

View File

@@ -140,6 +140,11 @@ public class WebRtcServiceStateBuilder {
return this;
}
public @NonNull LocalDeviceStateBuilder setAudioDeviceChangePending(boolean isAudioDeviceChangePending) {
toBuild.setAudioDeviceChangePending(isAudioDeviceChangePending);
return this;
}
public @NonNull LocalDeviceStateBuilder setNetworkConnectionType(@NonNull PeerConnection.AdapterType type) {
toBuild.setNetworkConnectionType(type);
return this;