mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Disable call audio toggle while the switch is processing.
This commit is contained in:
@@ -265,6 +265,10 @@ class ActiveCallManager(
|
||||
callManager.onAudioDeviceChanged(activeDevice, devices)
|
||||
}
|
||||
|
||||
override fun onAudioDeviceChangeFailed() {
|
||||
callManager.onAudioDeviceChangeFailed()
|
||||
}
|
||||
|
||||
override fun onBluetoothPermissionDenied() {
|
||||
callManager.onBluetoothPermissionDenied()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user