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

Commit bb71e7b0 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Add support for busy number simulation in Telecom test app.

Its difficult to get a number to be busy nowadays as everything always
rings through to voicemail.
This change adds support for dialing a number ending in BUSY through the
Telecom test app to have the outgoing call end with a BUSY disconnect
cause.

Test: Manually dialed 555-BUSY in test app to verify functionality.
Bug: 78340691
Change-Id: I9f6730b9baf2f6a54c795105ab5589134f74efbb
parent 84135b5b
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.IntentFilter;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.ToneGenerator;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -62,6 +63,11 @@ public class TestConnectionService extends ConnectionService {

    public static final String EXTRA_HANDLE = "extra_handle";

    /**
     * If an outgoing call ends with 2879 (BUSY), the test CS will indicate the call is busy.
     */
    public static final String BUSY_SUFFIX = "2879";

    private static final String LOG_TAG = TestConnectionService.class.getSimpleName();

    private static TestConnectionService INSTANCE;
@@ -209,8 +215,15 @@ public class TestConnectionService extends ConnectionService {
        void startOutgoing() {
            setDialing();
            mHandler.postDelayed(() -> {
                if (getAddress().getSchemeSpecificPart().endsWith(BUSY_SUFFIX)) {
                    setDisconnected(new DisconnectCause(DisconnectCause.REMOTE, "Line busy",
                            "Line busy", "Line busy", ToneGenerator.TONE_SUP_BUSY));
                    destroyCall(this);
                    destroy();
                } else {
                    setActive();
                    activateCall(TestConnection.this);
                }
            }, 4000);
            if (mOriginalRequest.isRequestingRtt()) {
                Log.i(LOG_TAG, "Is RTT call. Starting chatbot service.");