Remove use of legacy hangup in sending flow.

This commit is contained in:
Cody Henthorne
2023-09-13 12:07:54 -04:00
committed by Alex Hart
parent ff5b024074
commit 11e0dd18d3
6 changed files with 12 additions and 29 deletions

View File

@@ -39,7 +39,7 @@ object CallMessageProcessor {
callMessage.iceUpdateList.isNotEmpty() -> handleCallIceUpdateMessage(envelope, metadata, callMessage.iceUpdateList, senderRecipient.id)
callMessage.hasHangup() || callMessage.hasLegacyHangup() -> {
val hangup = if (callMessage.hasHangup()) callMessage.hangup else callMessage.legacyHangup
handleCallHangupMessage(envelope, metadata, hangup, senderRecipient.id, callMessage.hasLegacyHangup())
handleCallHangupMessage(envelope, metadata, hangup, senderRecipient.id)
}
callMessage.hasBusy() -> handleCallBusyMessage(envelope, metadata, callMessage.busy, senderRecipient.id)
callMessage.hasOpaque() -> handleCallOpaqueMessage(envelope, metadata, callMessage.opaque, senderRecipient.requireAci(), serverDeliveredTimestamp)
@@ -115,8 +115,7 @@ object CallMessageProcessor {
envelope: Envelope,
metadata: EnvelopeMetadata,
hangup: SignalServiceProtos.CallMessage.Hangup,
senderRecipientId: RecipientId,
isLegacyHangup: Boolean
senderRecipientId: RecipientId
) {
log(envelope.timestamp, "handleCallHangupMessage")
@@ -124,7 +123,7 @@ object CallMessageProcessor {
ApplicationDependencies.getSignalCallManager()
.receivedCallHangup(
CallMetadata(remotePeer, metadata.sourceDeviceId),
HangupMetadata(HangupMessage.Type.fromProto(hangup.type), isLegacyHangup, hangup.deviceId)
HangupMetadata(HangupMessage.Type.fromProto(hangup.type), hangup.deviceId)
)
}

View File

@@ -720,7 +720,7 @@ private void processStateless(@NonNull Function1<WebRtcEphemeralState, WebRtcEph
Log.i(TAG, "onSendHangup: id: " + remotePeer.getCallId().format(remoteDevice) + " type: " + hangupType.name());
WebRtcData.CallMetadata callMetadata = new WebRtcData.CallMetadata(remotePeer, remoteDevice);
WebRtcData.HangupMetadata hangupMetadata = new WebRtcData.HangupMetadata(WebRtcUtil.getHangupTypeFromCallHangupType(hangupType), false, deviceId);
WebRtcData.HangupMetadata hangupMetadata = new WebRtcData.HangupMetadata(WebRtcUtil.getHangupTypeFromCallHangupType(hangupType), deviceId);
process((s, p) -> p.handleSendHangup(s, callMetadata, hangupMetadata, broadcast));
}

View File

@@ -404,13 +404,13 @@ public abstract class WebRtcActionProcessor {
}
protected final @NonNull WebRtcServiceState handleSendHangup(@NonNull WebRtcServiceState currentState,
@NonNull CallMetadata callMetadata,
@NonNull HangupMetadata hangupMetadata,
boolean broadcast)
@NonNull CallMetadata callMetadata,
@NonNull HangupMetadata hangupMetadata,
boolean broadcast)
{
Log.i(tag, "handleSendHangup(): id: " + callMetadata.getCallId().format(callMetadata.getRemoteDevice()));
HangupMessage hangupMessage = new HangupMessage(callMetadata.getCallId().longValue(), hangupMetadata.getType(), hangupMetadata.getDeviceId(), hangupMetadata.isLegacy());
HangupMessage hangupMessage = new HangupMessage(callMetadata.getCallId().longValue(), hangupMetadata.getType(), hangupMetadata.getDeviceId());
Integer destinationDeviceId = broadcast ? null : callMetadata.getRemoteDevice();
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forHangup(hangupMessage, true, destinationDeviceId);

View File

@@ -148,16 +148,14 @@ public class WebRtcData {
*/
public static class HangupMetadata {
private final @NonNull HangupMessage.Type type;
private final boolean isLegacy;
private final int deviceId;
static @NonNull HangupMetadata fromType(@NonNull HangupMessage.Type type) {
return new HangupMetadata(type, true, 0);
return new HangupMetadata(type, 0);
}
public HangupMetadata(@NonNull HangupMessage.Type type, boolean isLegacy, int deviceId) {
public HangupMetadata(@NonNull HangupMessage.Type type, int deviceId) {
this.type = type;
this.isLegacy = isLegacy;
this.deviceId = deviceId;
}
@@ -176,10 +174,6 @@ public class WebRtcData {
}
}
boolean isLegacy() {
return isLegacy;
}
int getDeviceId() {
return deviceId;
}

View File

@@ -1320,11 +1320,7 @@ public class SignalServiceMessageSender {
builderForHangup.setDeviceId(callMessage.getHangupMessage().get().getDeviceId());
}
if (callMessage.getHangupMessage().get().isLegacy()) {
builder.setLegacyHangup(builderForHangup);
} else {
builder.setHangup(builderForHangup);
}
builder.setHangup(builderForHangup);
} else if (callMessage.getBusyMessage().isPresent()) {
builder.setBusy(CallMessage.Busy.newBuilder().setId(callMessage.getBusyMessage().get().getId()));
} else if (callMessage.getOpaqueMessage().isPresent()) {

View File

@@ -8,13 +8,11 @@ public class HangupMessage {
private final long id;
private final Type type;
private final int deviceId;
private final boolean isLegacy;
public HangupMessage(long id, Type type, int deviceId, boolean isLegacy) {
public HangupMessage(long id, Type type, int deviceId) {
this.id = id;
this.type = type;
this.deviceId = deviceId;
this.isLegacy = isLegacy;
}
public long getId() {
@@ -29,10 +27,6 @@ public class HangupMessage {
return deviceId;
}
public boolean isLegacy() {
return isLegacy;
}
public enum Type {
NORMAL("normal", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_NORMAL),
ACCEPTED("accepted", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_ACCEPTED),