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
diff --git a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
index 5ae4815..1a2aac6 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -27,6 +27,7 @@
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 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 @@
void startOutgoing() {
setDialing();
mHandler.postDelayed(() -> {
- setActive();
- activateCall(TestConnection.this);
+ 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.");