play dial sounds on wrong track to make them play in silent mode. fixes #3697

This commit is contained in:
Daniel Gultsch 2020-05-03 23:15:21 +02:00
parent 2018ae8ba0
commit c159bbfc81
2 changed files with 10 additions and 10 deletions

View file

@ -269,7 +269,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
synchronized (rtpSessionProposals) { synchronized (rtpSessionProposals) {
if (rtpSessionProposals.remove(proposal) != null) { if (rtpSessionProposals.remove(proposal) != null) {
writeLogMissedOutgoing(account, proposal.with, proposal.sessionId, serverMsgId, timestamp); writeLogMissedOutgoing(account, proposal.with, proposal.sessionId, serverMsgId, timestamp);
toneManager.transition(true, RtpEndUserState.DECLINED_OR_BUSY); toneManager.transition(RtpEndUserState.DECLINED_OR_BUSY);
mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, proposal.with, proposal.sessionId, RtpEndUserState.DECLINED_OR_BUSY); mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, proposal.with, proposal.sessionId, RtpEndUserState.DECLINED_OR_BUSY);
} else { } else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + from + " to deliver reject"); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + from + " to deliver reject");
@ -436,7 +436,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
} }
} }
if (matchingProposal != null) { if (matchingProposal != null) {
toneManager.transition(true, RtpEndUserState.ENDED); toneManager.transition(RtpEndUserState.ENDED);
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": retracting rtp session proposal with " + with); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": retracting rtp session proposal with " + with);
this.rtpSessionProposals.remove(matchingProposal); this.rtpSessionProposals.remove(matchingProposal);
final MessagePacket messagePacket = mXmppConnectionService.getMessageGenerator().sessionRetract(matchingProposal); final MessagePacket messagePacket = mXmppConnectionService.getMessageGenerator().sessionRetract(matchingProposal);
@ -454,7 +454,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
final DeviceDiscoveryState preexistingState = entry.getValue(); final DeviceDiscoveryState preexistingState = entry.getValue();
if (preexistingState != null && preexistingState != DeviceDiscoveryState.FAILED) { if (preexistingState != null && preexistingState != DeviceDiscoveryState.FAILED) {
final RtpEndUserState endUserState = preexistingState.toEndUserState(); final RtpEndUserState endUserState = preexistingState.toEndUserState();
toneManager.transition(true, endUserState); toneManager.transition(endUserState);
mXmppConnectionService.notifyJingleRtpConnectionUpdate( mXmppConnectionService.notifyJingleRtpConnectionUpdate(
account, account,
with, with,
@ -546,7 +546,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
} }
this.rtpSessionProposals.put(sessionProposal, target); this.rtpSessionProposals.put(sessionProposal, target);
final RtpEndUserState endUserState = target.toEndUserState(); final RtpEndUserState endUserState = target.toEndUserState();
toneManager.transition(true, endUserState); toneManager.transition(endUserState);
mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, sessionProposal.with, sessionProposal.sessionId, endUserState); mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, sessionProposal.with, sessionProposal.sessionId, endUserState);
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": flagging session " + sessionId + " as " + target); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": flagging session " + sessionId + " as " + target);
} }

View file

@ -13,22 +13,22 @@ import eu.siacs.conversations.Config;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
public class ToneManager { class ToneManager {
private final ToneGenerator toneGenerator; private final ToneGenerator toneGenerator;
private ToneState state = null; private ToneState state = null;
private ScheduledFuture<?> currentTone; private ScheduledFuture<?> currentTone;
public ToneManager() { ToneManager() {
this.toneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL, 35); this.toneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, 35);
} }
public void transition(final boolean isInitiator, final RtpEndUserState state) { void transition(final RtpEndUserState state) {
transition(of(isInitiator, state, Collections.emptySet())); transition(of(true, state, Collections.emptySet()));
} }
public void transition(final boolean isInitiator, final RtpEndUserState state, final Set<Media> media) { void transition(final boolean isInitiator, final RtpEndUserState state, final Set<Media> media) {
transition(of(isInitiator, state, media)); transition(of(isInitiator, state, media));
} }