Fix bluetooth ringing for outgoing calls.

fork-5.53.8
Cody Henthorne 2021-04-05 15:44:58 -04:00 zatwierdzone przez GitHub
rodzic 33cb02b9e4
commit dbc5f5bfcc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
8 zmienionych plików z 46 dodań i 5 usunięć

Wyświetl plik

@ -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);

Wyświetl plik

@ -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

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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();
}

Wyświetl plik

@ -83,6 +83,9 @@ public class OutgoingCallActionProcessor extends DeviceAwareActionProcessor {
return builder.changeCallInfoState()
.activePeer(remotePeer)
.callState(WebRtcViewModel.State.CALL_OUTGOING)
.commit()
.changeLocalDeviceState()
.wantsBluetooth(true)
.build();
}

Wyświetl plik

@ -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();

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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;