Add an implementation of SipTransportImplBase for testing

Add SipTransportImplBase implementation for testing in the
ImsTestApp.

Test: manual with ImsTestApp
Merged-In: I740d1f3c7ea61072fb4b119144cdfbf7f3f181b0
Change-Id: I740d1f3c7ea61072fb4b119144cdfbf7f3f181b0
diff --git a/testapps/ImsTestService/AndroidManifest.xml b/testapps/ImsTestService/AndroidManifest.xml
index 46d0721..6177e73 100644
--- a/testapps/ImsTestService/AndroidManifest.xml
+++ b/testapps/ImsTestService/AndroidManifest.xml
@@ -21,7 +21,7 @@
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
     <!--Beware, declaring the below permission will cause the device to not boot unless you add
         this app and permission to frameworks/base/data/etc/privapp-permissions-platform.xml-->
-    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
+    <!--uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/-->
     <application android:label="ImsTestService"
          android:directBootAware="true">
         <activity android:name=".ImsTestServiceApp"
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/SipTransportImpl.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/SipTransportImpl.java
new file mode 100644
index 0000000..1ae2594
--- /dev/null
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/SipTransportImpl.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.phone.testapps.imstestapp;
+
+import android.telephony.ims.stub.SipTransportImplBase;
+
+import java.util.concurrent.Executor;
+
+/**
+ * Test stub implementation of SipTransport.
+ */
+public class SipTransportImpl extends SipTransportImplBase {
+
+    private static SipTransportImpl sSipTransportInstance;
+
+    public static SipTransportImpl getInstance(Executor e) {
+        if (sSipTransportInstance == null) {
+            sSipTransportInstance = new SipTransportImpl(e);
+        }
+        return sSipTransportInstance;
+    };
+
+    public SipTransportImpl(Executor e) {
+        super(e);
+    }
+}
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java
index 71323d8..477c638 100644
--- a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java
@@ -39,6 +39,7 @@
     public TestMmTelFeatureImpl mTestMmTelFeature;
     public TestRcsFeatureImpl mTestRcsFeature;
     public TestImsConfigImpl mTestImsConfig;
+    public SipTransportImpl mSipTransportImpl;
 
     public static TestImsService getInstance() {
         return mInstance;
@@ -51,7 +52,8 @@
         mTestMmTelFeature = TestMmTelFeatureImpl.getInstance();
         mTestRcsFeature = new TestRcsFeatureImpl();
         mTestImsConfig = TestImsConfigImpl.getInstance();
-
+        mSipTransportImpl = SipTransportImpl.getInstance(
+                getApplicationContext().getMainExecutor());
         mInstance = this;
     }
 
@@ -60,10 +62,16 @@
         return new ImsFeatureConfiguration.Builder()
                 .addFeature(0, ImsFeature.FEATURE_EMERGENCY_MMTEL)
                 .addFeature(0, ImsFeature.FEATURE_MMTEL)
+                .addFeature(0, ImsFeature.FEATURE_RCS)
                 .build();
     }
 
     @Override
+    public long getImsServiceCapabilities() {
+        return CAPABILITY_SIP_DELEGATE_CREATION;
+    }
+
+    @Override
     public MmTelFeature createMmTelFeature(int slotId) {
         Log.i(LOG_TAG, "TestImsService: onCreateMmTelImsFeature");
         return mTestMmTelFeature;
@@ -84,4 +92,9 @@
     public ImsConfigImplBase getConfig(int slotId) {
         return mTestImsConfig;
     }
+
+    @Override
+    public SipTransportImpl getSipTransport(int slotId) {
+        return mSipTransportImpl;
+    }
 }