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

Commit 13c40fdb authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Add support for busy number simulation in Telecom test app. am: bb71e7b0 am: 46fa6ce3

am: e04efe94

Change-Id: Ia0b1be31344126cfe0ef7e9bfcfbda23011a1dbf
parents f9c0cd0b e04efe94
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.");