Merge "Add CS fallback for SMS over IMS in IMS test app"
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsCallingActivity.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsCallingActivity.java
index 48944e4..58e08cc 100644
--- a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsCallingActivity.java
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsCallingActivity.java
@@ -87,7 +87,6 @@
boolean isVoiceAvail = mCapVoiceAvailBox.isChecked();
boolean isVideoAvail = mCapVideoAvailBox.isChecked();
boolean isUtAvail = mCapUtAvailBox.isChecked();
- // Not used yet
boolean isSmsAvail = mCapSmsAvailBox.isChecked();
MmTelFeature.MmTelCapabilities capabilities = new MmTelFeature.MmTelCapabilities();
@@ -100,6 +99,9 @@
if (isUtAvail) {
capabilities.addCapabilities(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_UT);
}
+ if (isSmsAvail) {
+ capabilities.addCapabilities(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_SMS);
+ }
TestMmTelFeatureImpl.getInstance().sendCapabilitiesUpdate(capabilities);
}
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsSmsImpl.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsSmsImpl.java
new file mode 100644
index 0000000..9d95a2e
--- /dev/null
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsSmsImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 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.SmsManager;
+import android.telephony.SmsMessage;
+import android.telephony.ims.stub.ImsSmsImplBase;
+
+public class TestImsSmsImpl extends ImsSmsImplBase {
+
+ @Override
+ public void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry,
+ byte[] pdu) {
+ // At this point, we will always fallback to CS if the phone tries to send an SMS with the
+ // test app. Will expand in the future to include UI options for more testing.
+ onSendSmsResult(token, messageRef, SEND_STATUS_ERROR_FALLBACK,
+ SmsManager.RESULT_ERROR_NO_SERVICE);
+ }
+
+ @Override
+ public void acknowledgeSms(int token, int messageRef, int result) {
+ super.acknowledgeSms(token, messageRef, result);
+ }
+
+ @Override
+ public void acknowledgeSmsReport(int token, int messageRef, int result) {
+ super.acknowledgeSmsReport(token, messageRef, result);
+ }
+
+ @Override
+ public String getSmsFormat() {
+ return SmsMessage.FORMAT_3GPP;
+ }
+}
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestMmTelFeatureImpl.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestMmTelFeatureImpl.java
index 2a0463d..02e7a7b 100644
--- a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestMmTelFeatureImpl.java
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestMmTelFeatureImpl.java
@@ -19,6 +19,7 @@
import android.telephony.ims.feature.CapabilityChangeRequest;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.telephony.ims.stub.ImsSmsImplBase;
import android.util.ArraySet;
import android.util.SparseArray;
import android.widget.Toast;
@@ -28,6 +29,7 @@
public class TestMmTelFeatureImpl extends MmTelFeature {
public static TestMmTelFeatureImpl sTestMmTelFeatureImpl;
+ public static TestImsSmsImpl sTestImsSmsImpl;
private boolean mIsReady = false;
// Enabled Capabilities - not status
private SparseArray<MmTelCapabilities> mEnabledCapabilities = new SparseArray<>();
@@ -53,6 +55,13 @@
return sTestMmTelFeatureImpl;
}
+ public static TestImsSmsImpl getSmsInstance() {
+ if (sTestImsSmsImpl == null) {
+ sTestImsSmsImpl = new TestImsSmsImpl();
+ }
+ return sTestImsSmsImpl;
+ }
+
public void addUpdateCallback(MmTelUpdateCallback callback) {
mCallbacks.add(callback);
}
@@ -79,6 +88,11 @@
}
@Override
+ public ImsSmsImplBase getSmsImplementation() {
+ return getSmsInstance();
+ }
+
+ @Override
public void onFeatureRemoved() {
super.onFeatureRemoved();
}