Buggy code:
public class CdmaSMSDispatcher extends SMSDispatcher { private static final String TAG = "CdmaSMSDispatcher" ; private static final boolean VDBG = false ; public CdmaSMSDispatcher ( PhoneBase phone , SmsUsageMonitor usageMonitor , ImsSMSDispatcher imsSMSDispatcher ) { } @ Override protected String getFormat ( ) { } void sendStatusReportMessage ( SmsMessage sms ) { } @ Override protected void handleStatusReport ( Object o ) { } void handleCdmaStatusReport ( SmsMessage sms ) { } @ Override protected void sendData ( String destAddr , String scAddr , int destPort , int origPort , byte [ ] data , PendingIntent sentIntent , PendingIntent deliveryIntent ) { } @ Override protected void sendText ( String destAddr , String scAddr , String text , PendingIntent sentIntent , PendingIntent deliveryIntent , Uri messageUri , String callingPkg , int priority , boolean isExpectMore , int validityPeriod ) { } @ Override protected void injectSmsPdu ( byte [ ] pdu , String format , PendingIntent receivedIntent ) { } @ Override protected TextEncodingDetails calculateLength ( CharSequence messageBody , boolean use7bitOnly ) { } @ Override protected SmsTracker getNewSubmitPduTracker ( String destinationAddress , String scAddress , String message , SmsHeader smsHeader , int encoding , PendingIntent sentIntent , PendingIntent deliveryIntent , boolean lastPart , int priority , boolean isExpectMore , int validityPeriod , AtomicInteger unsentPartCount , AtomicBoolean anyPartFailed , Uri messageUri , String fullMessageText ) { } @ Override protected void sendSubmitPdu ( SmsTracker tracker ) { } @ Override protected void sendSms ( SmsTracker tracker ) { } @ Override protected void sendSmsByPstn ( SmsTracker tracker ) { int ss = mPhone . getServiceState ( ) . getState ( ) ; if ( ( ! ( isIms ( ) ) ) && ( ss != ( ServiceState . STATE_IN_SERVICE ) ) ) { tracker . onFailed ( mContext , getNotInServiceError ( ss ) , 0 ) ; return ; } Message reply = obtainMessage ( EVENT_SEND_SMS_COMPLETE , tracker ) ; byte [ ] pdu = ( ( byte [ ] ) ( tracker . mData . get ( "pdu" ) ) ) ; int currentDataNetwork = mPhone . getServiceState ( ) . getDataNetworkType ( ) ; <START_BUG> boolean imsSmsDisabled = ( ( ( currentDataNetwork == ( TelephonyManager . NETWORK_TYPE_EHRPD ) ) || ( ( currentDataNetwork == ( TelephonyManager . NETWORK_TYPE_LTE ) ) && ( ! ( mPhone . getServiceStateTracker ( ) . isConcurrentVoiceAndDataAllowed ( ) ) ) ) ) && ( ( mPhone . getServiceState ( ) . getVoiceNetworkType ( ) ) == ( TelephonyManager . NETWORK_TYPE_1xRTT ) ) ) && ( ( mPhone . getState ( ) ) != ( State . IDLE ) ) ; <END_BUG> if ( ( ( 0 == ( tracker . mImsRetry ) ) && ( ! ( isIms ( ) ) ) ) || imsSmsDisabled ) { mCi . sendCdmaSms ( pdu , reply ) ; } else if ( ! ( mImsSMSDispatcher . isImsSmsEnabled ( ) ) ) { mCi . sendCdmaSms ( pdu , reply ) ; mImsSMSDispatcher . enableSendSmsOverIms ( true ) ; } else { mCi . sendImsCdmaSms ( pdu , tracker . mImsRetry , tracker . mMessageRef , reply ) ; ( tracker . mImsRetry ) ++ ; } } }

Fix:
boolean imsSmsDisabled = ( ( ( currentDataNetwork == ( TelephonyManager . NETWORK_TYPE_EHRPD ) ) || ( ( currentDataNetwork == ( TelephonyManager . NETWORK_TYPE_LTE ) ) && ( ! ( mPhone . getServiceStateTracker ( ) . isConcurrentVoiceAndDataAllowed ( ) ) ) ) ) && ( ( mPhone . getServiceState ( ) . getVoiceNetworkType ( ) ) == ( TelephonyManager . NETWORK_TYPE_1xRTT ) ) ) && ( ( ( ( CDMAPhone ) ( mPhone ) ) . mCT . mState ) != ( State . IDLE ) ) ;