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