Merge "Play tone when RTT upgrade received" am: 34d5a951b5
Original change: https://android-review.googlesource.com/c/platform/packages/services/Telecomm/+/1620670
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Id2585b5978cc42e189aa328a08162ad8bcc78488
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index a933c79..15f9cd1 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -1925,6 +1925,13 @@
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.
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java
index a6509b4..6a7261e 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -264,6 +264,14 @@
}
}
+ 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
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index d532dbf..baced16 100755
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -2744,6 +2744,16 @@
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.
diff --git a/src/com/android/server/telecom/InCallTonePlayer.java b/src/com/android/server/telecom/InCallTonePlayer.java
index 4f0cf8d..814c730 100644
--- a/src/com/android/server/telecom/InCallTonePlayer.java
+++ b/src/com/android/server/telecom/InCallTonePlayer.java
@@ -162,6 +162,7 @@
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 @@
// 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;