Send SMS over 1x when on eHRPD/LTE and active voice call
Xia Ying [Tue, 26 Aug 2014 20:08:48 +0000 (15:08 -0500)]
When UE is attached to eHRPD network  LTE network which not
allow data and voice concurrent, and IMS is registered:
- If there is an active 1x RTT voice call, send SMS over 1x
- If there no active 1xRTT voice call, send SMS over IMS

Bug: 17331507

Change-Id: I2647c1ccdbf5286445aa34925be0027b21f84a03

src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java

index 0e1a30f..cf5ad10 100755 (executable)
@@ -41,6 +41,8 @@ import com.android.internal.telephony.SmsHeader;
 import com.android.internal.telephony.SmsUsageMonitor;
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.telephony.cdma.sms.UserData;
+import com.android.internal.telephony.PhoneConstants;
+import android.telephony.TelephonyManager;
 
 import java.util.HashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -260,11 +262,19 @@ public class CdmaSMSDispatcher extends SMSDispatcher {
         Message reply = obtainMessage(EVENT_SEND_SMS_COMPLETE, tracker);
         byte[] pdu = (byte[]) tracker.mData.get("pdu");
 
+        int currentDataNetwork = mPhone.getServiceState().getDataNetworkType();
+        boolean imsSmsDisabled = (currentDataNetwork == TelephonyManager.NETWORK_TYPE_EHRPD
+                    || (currentDataNetwork == TelephonyManager.NETWORK_TYPE_LTE
+                    && !mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()))
+                    && mPhone.getServiceState().getVoiceNetworkType()
+                    == TelephonyManager.NETWORK_TYPE_1xRTT
+                    && mPhone.getState() != PhoneConstants.State.IDLE;
+
         // sms over cdma is used:
         //   if sms over IMS is not supported AND
         //   this is not a retry case after sms over IMS failed
         //     indicated by mImsRetry > 0
-        if (0 == tracker.mImsRetry && !isIms()) {
+        if (0 == tracker.mImsRetry && !isIms() || imsSmsDisabled) {
             mCi.sendCdmaSms(pdu, reply);
         } else {
             mCi.sendImsCdmaSms(pdu, tracker.mImsRetry, tracker.mMessageRef, reply);