Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f1828f8 authored by Hall Liu's avatar Hall Liu
Browse files

Play tone when RTT upgrade received

When the device receives an RTT upgrade request from the remote user, or
when the IMS stack auto-upgrades an RTT call mid-call, play a tone to
alert the user.

Fixes: 171587427
Test: manual

Change-Id: Ib21b17d0209dde20d048b72e8d0a626e7c4c8e33
Merged-In: Ib21b17d0209dde20d048b72e8d0a626e7c4c8e33
parent 0e44b583
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1903,6 +1903,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.
+8 −0
Original line number Diff line number Diff line
@@ -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
+10 −0
Original line number Diff line number Diff line
@@ -2736,6 +2736,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.
+2 −0
Original line number Diff line number Diff line
@@ -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;