kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix bluetooth ringing for outgoing calls.
rodzic
33cb02b9e4
commit
dbc5f5bfcc
|
@ -54,6 +54,9 @@ public class CallSetupActionProcessorDelegate extends WebRtcActionProcessor {
|
|||
.changeCallInfoState()
|
||||
.callState(WebRtcViewModel.State.CALL_CONNECTED)
|
||||
.callConnectedTime(System.currentTimeMillis())
|
||||
.commit()
|
||||
.changeLocalDeviceState()
|
||||
.wantsBluetooth(true)
|
||||
.build();
|
||||
|
||||
webRtcInteractor.setCallInProgressNotification(TYPE_ESTABLISHED, activePeer);
|
||||
|
|
|
@ -42,6 +42,10 @@ public abstract class DeviceAwareActionProcessor extends WebRtcActionProcessor {
|
|||
protected @NonNull WebRtcServiceState handleBluetoothChange(@NonNull WebRtcServiceState currentState, boolean available) {
|
||||
Log.i(tag, "handleBluetoothChange(): " + available);
|
||||
|
||||
if (available && currentState.getLocalDeviceState().wantsBluetooth()) {
|
||||
webRtcInteractor.setWantsBluetoothConnection(true);
|
||||
}
|
||||
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.isBluetoothAvailable(available)
|
||||
|
@ -63,7 +67,10 @@ public abstract class DeviceAwareActionProcessor extends WebRtcActionProcessor {
|
|||
|
||||
webRtcInteractor.postStateUpdate(currentState);
|
||||
|
||||
return currentState;
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.wantsBluetooth(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,7 +85,10 @@ public abstract class DeviceAwareActionProcessor extends WebRtcActionProcessor {
|
|||
|
||||
webRtcInteractor.postStateUpdate(currentState);
|
||||
|
||||
return currentState;
|
||||
return currentState.builder()
|
||||
.changeLocalDeviceState()
|
||||
.wantsBluetooth(isBluetooth)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,6 +86,9 @@ public class GroupJoiningActionProcessor extends GroupActionProcessor {
|
|||
.groupCallState(WebRtcViewModel.GroupCallState.CONNECTED_AND_JOINED)
|
||||
.callConnectedTime(System.currentTimeMillis())
|
||||
.commit()
|
||||
.changeLocalDeviceState()
|
||||
.wantsBluetooth(true)
|
||||
.commit()
|
||||
.actionProcessor(new GroupConnectedActionProcessor(webRtcInteractor))
|
||||
.build();
|
||||
} else if (device.getJoinState() == GroupCall.JoinState.JOINING) {
|
||||
|
|
|
@ -164,6 +164,9 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
|||
.changeCallInfoState()
|
||||
.callState(WebRtcViewModel.State.CALL_OUTGOING)
|
||||
.groupCallState(WebRtcViewModel.GroupCallState.CONNECTED_AND_JOINING)
|
||||
.commit()
|
||||
.changeLocalDeviceState()
|
||||
.wantsBluetooth(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,9 @@ public class OutgoingCallActionProcessor extends DeviceAwareActionProcessor {
|
|||
return builder.changeCallInfoState()
|
||||
.activePeer(remotePeer)
|
||||
.callState(WebRtcViewModel.State.CALL_OUTGOING)
|
||||
.commit()
|
||||
.changeLocalDeviceState()
|
||||
.wantsBluetooth(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -547,6 +547,9 @@ public abstract class WebRtcActionProcessor {
|
|||
.changeCallInfoState()
|
||||
.activePeer(null)
|
||||
.commit()
|
||||
.changeLocalDeviceState()
|
||||
.wantsBluetooth(false)
|
||||
.commit()
|
||||
.actionProcessor(currentState.getCallInfoState().getCallState() == WebRtcViewModel.State.CALL_DISCONNECTED ? new DisconnectingCallActionProcessor(webRtcInteractor) : new IdleActionProcessor(webRtcInteractor))
|
||||
.terminate()
|
||||
.build();
|
||||
|
|
|
@ -12,20 +12,27 @@ public final class LocalDeviceState {
|
|||
CameraState cameraState;
|
||||
boolean microphoneEnabled;
|
||||
boolean bluetoothAvailable;
|
||||
boolean wantsBluetooth;
|
||||
Orientation orientation;
|
||||
|
||||
LocalDeviceState() {
|
||||
this(CameraState.UNKNOWN, true, false, Orientation.PORTRAIT_BOTTOM_EDGE);
|
||||
this(CameraState.UNKNOWN, true, false, false, Orientation.PORTRAIT_BOTTOM_EDGE);
|
||||
}
|
||||
|
||||
LocalDeviceState(@NonNull LocalDeviceState toCopy) {
|
||||
this(toCopy.cameraState, toCopy.microphoneEnabled, toCopy.bluetoothAvailable, toCopy.orientation);
|
||||
this(toCopy.cameraState, toCopy.microphoneEnabled, toCopy.bluetoothAvailable, toCopy.wantsBluetooth, toCopy.orientation);
|
||||
}
|
||||
|
||||
LocalDeviceState(@NonNull CameraState cameraState, boolean microphoneEnabled, boolean bluetoothAvailable, @NonNull Orientation orientation) {
|
||||
LocalDeviceState(@NonNull CameraState cameraState,
|
||||
boolean microphoneEnabled,
|
||||
boolean bluetoothAvailable,
|
||||
boolean wantsBluetooth,
|
||||
@NonNull Orientation orientation)
|
||||
{
|
||||
this.cameraState = cameraState;
|
||||
this.microphoneEnabled = microphoneEnabled;
|
||||
this.bluetoothAvailable = bluetoothAvailable;
|
||||
this.wantsBluetooth = wantsBluetooth;
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
|
@ -41,6 +48,10 @@ public final class LocalDeviceState {
|
|||
return bluetoothAvailable;
|
||||
}
|
||||
|
||||
public boolean wantsBluetooth() {
|
||||
return wantsBluetooth;
|
||||
}
|
||||
|
||||
public @NonNull Orientation getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,11 @@ public class WebRtcServiceStateBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public @NonNull LocalDeviceStateBuilder wantsBluetooth(boolean wantsBluetooth) {
|
||||
toBuild.wantsBluetooth = wantsBluetooth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public @NonNull LocalDeviceStateBuilder setOrientation(@NonNull Orientation orientation) {
|
||||
toBuild.orientation = orientation;
|
||||
return this;
|
||||
|
|
Ładowanie…
Reference in New Issue