Add CNAP name to TestConnectionService

Allows the ability to test CNAP functionality in the
Dialer without actually receiving a real call.

Bug: 10121624

Change-Id: Id02d2e873c61ef05db9d3e2bda5bdf4296db4070
diff --git a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
index 1da8906..b7682b4 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -307,7 +307,7 @@
                 originalHandle + "]");
 
         final TestConnection connection = new TestConnection(false /* isIncoming */);
-        connection.setAddress(handle, TelecomManager.PRESENTATION_ALLOWED);
+        setAddress(connection, handle);
 
         // If the number starts with 555, then we handle it ourselves. If not, then we
         // use a remote connection service.
@@ -358,7 +358,7 @@
                     VideoProfile.VideoState.BIDIRECTIONAL :
                     VideoProfile.VideoState.AUDIO_ONLY;
             connection.setVideoState(videoState);
-            connection.setAddress(address, TelecomManager.PRESENTATION_ALLOWED);
+            setAddress(connection, address);
 
             addVideoProvider(connection);
 
@@ -457,6 +457,13 @@
         }
     }
 
+    private void setAddress(Connection connection, Uri address) {
+        connection.setAddress(address, TelecomManager.PRESENTATION_ALLOWED);
+        if ("5551234".equals(address.getSchemeSpecificPart())) {
+            connection.setCallerDisplayName("Hello World", TelecomManager.PRESENTATION_ALLOWED);
+        }
+    }
+
     private MediaPlayer createMediaPlayer() {
         // Prepare the media player to play a tone when there is a call.
         MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.beep_boop);