From c159bbfc81b4d4c0a8afa3977356a04613ebd868 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 3 May 2020 23:15:21 +0200 Subject: [PATCH] play dial sounds on wrong track to make them play in silent mode. fixes #3697 --- .../xmpp/jingle/JingleConnectionManager.java | 8 ++++---- .../siacs/conversations/xmpp/jingle/ToneManager.java | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 146cf3b43..1139e992c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -269,7 +269,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { synchronized (rtpSessionProposals) { if (rtpSessionProposals.remove(proposal) != null) { 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); } else { 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) { - toneManager.transition(true, RtpEndUserState.ENDED); + toneManager.transition(RtpEndUserState.ENDED); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": retracting rtp session proposal with " + with); this.rtpSessionProposals.remove(matchingProposal); final MessagePacket messagePacket = mXmppConnectionService.getMessageGenerator().sessionRetract(matchingProposal); @@ -454,7 +454,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { final DeviceDiscoveryState preexistingState = entry.getValue(); if (preexistingState != null && preexistingState != DeviceDiscoveryState.FAILED) { final RtpEndUserState endUserState = preexistingState.toEndUserState(); - toneManager.transition(true, endUserState); + toneManager.transition(endUserState); mXmppConnectionService.notifyJingleRtpConnectionUpdate( account, with, @@ -546,7 +546,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { } this.rtpSessionProposals.put(sessionProposal, target); final RtpEndUserState endUserState = target.toEndUserState(); - toneManager.transition(true, endUserState); + toneManager.transition(endUserState); mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, sessionProposal.with, sessionProposal.sessionId, endUserState); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": flagging session " + sessionId + " as " + target); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java index 3274452e9..38fc60388 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java @@ -13,22 +13,22 @@ import eu.siacs.conversations.Config; import static java.util.Arrays.asList; -public class ToneManager { +class ToneManager { private final ToneGenerator toneGenerator; private ToneState state = null; private ScheduledFuture currentTone; - public ToneManager() { - this.toneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL, 35); + ToneManager() { + this.toneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, 35); } - public void transition(final boolean isInitiator, final RtpEndUserState state) { - transition(of(isInitiator, state, Collections.emptySet())); + void transition(final RtpEndUserState state) { + transition(of(true, state, Collections.emptySet())); } - public void transition(final boolean isInitiator, final RtpEndUserState state, final Set media) { + void transition(final boolean isInitiator, final RtpEndUserState state, final Set media) { transition(of(isInitiator, state, media)); }