Merge "Play tone when RTT upgrade received"

This commit is contained in:
Hall Liu 2021-03-06 01:30:49 +00:00 committed by Gerrit Code Review
commit 34d5a951b5
4 changed files with 27 additions and 0 deletions

View File

@ -1925,6 +1925,13 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
if (didRttChange) {
if ((mConnectionProperties & Connection.PROPERTY_IS_RTT) ==
Connection.PROPERTY_IS_RTT) {
// If we already had RTT streams up, that means that either the call started
// with RTT or the user previously requested to start RTT. Either way, don't
// play the alert tone.
if (!areRttStreamsInitialized()) {
mCallsManager.playRttUpgradeToneForCall(this);
}
createRttStreams();
// Call startRtt to pass the RTT pipes down to the connection service.
// They already turned on the RTT property so no request should be sent.

View File

@ -264,6 +264,14 @@ public class CallAudioManager extends CallsManagerListenerBase {
}
}
public void playRttUpgradeTone(Call call) {
if (call != mForegroundCall) {
// We only play tones for foreground calls.
return;
}
mPlayerFactory.createPlayer(InCallTonePlayer.TONE_RTT_REQUEST).startTone();
}
/**
* Play or stop a call hold tone for a call. Triggered via
* {@link Connection#sendConnectionEvent(String)} when the

View File

@ -2744,6 +2744,16 @@ public class CallsManager extends Call.ListenerBase
updateCanAddCall();
}
@Override
public void onRemoteRttRequest(Call call, int requestId) {
Log.i(this, "onRemoteRttRequest: call %s", call.getId());
playRttUpgradeToneForCall(call);
}
public void playRttUpgradeToneForCall(Call call) {
mCallAudioManager.playRttUpgradeTone(call);
}
// Construct the list of possible PhoneAccounts that the outgoing call can use based on the
// active calls in CallsManager. If any of the active calls are on a SIM based PhoneAccount,
// then include only that SIM based PhoneAccount and any non-SIM PhoneAccounts, such as SIP.

View File

@ -162,6 +162,7 @@ public class InCallTonePlayer extends Thread {
public static final int TONE_UNOBTAINABLE_NUMBER = 12;
public static final int TONE_VOICE_PRIVACY = 13;
public static final int TONE_VIDEO_UPGRADE = 14;
public static final int TONE_RTT_REQUEST = 15;
private static final int TONE_RESOURCE_ID_UNDEFINED = -1;
@ -329,6 +330,7 @@ public class InCallTonePlayer extends Thread {
// TODO: fill in.
throw new IllegalStateException("Voice privacy tone NYI.");
case TONE_VIDEO_UPGRADE:
case TONE_RTT_REQUEST:
// Similar to the call waiting tone, but does not repeat.
toneType = ToneGenerator.TONE_SUP_CALL_WAITING;
toneVolume = RELATIVE_VOLUME_HIPRI;