Loading src/java/com/android/internal/telephony/ImsSmsDispatcher.java +10 −2 Original line number Diff line number Diff line Loading @@ -162,7 +162,9 @@ public class ImsSmsDispatcher extends SMSDispatcher { public void onSmsReceived(int token, String format, byte[] pdu) throws RemoteException { Rlog.d(TAG, "SMS received."); mSmsDispatchersController.injectSmsPdu(pdu, format, result -> { android.telephony.SmsMessage message = android.telephony.SmsMessage.createFromPdu(pdu, format); mSmsDispatchersController.injectSmsPdu(message, format, result -> { Rlog.d(TAG, "SMS handled result: " + result); int mappedResult; switch (result) { Loading @@ -180,7 +182,13 @@ public class ImsSmsDispatcher extends SMSDispatcher { break; } try { if (message != null && message.mWrappedSmsMessage != null) { getImsManager().acknowledgeSms(token, message.mWrappedSmsMessage.mMessageRef, mappedResult); } else { Rlog.w(TAG, "SMS Received with a PDU that could not be parsed."); getImsManager().acknowledgeSms(token, 0, mappedResult); } } catch (ImsException e) { Rlog.e(TAG, "Failed to acknowledgeSms(). Error: " + e.getMessage()); } Loading src/java/com/android/internal/telephony/SmsDispatchersController.java +8 −8 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.provider.Telephony.Sms; import android.provider.Telephony.Sms.Intents; import android.telephony.Rlog; import android.telephony.SmsManager; import android.telephony.SmsMessage; import android.util.Pair; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -186,13 +187,17 @@ public class SmsDispatchersController extends Handler { */ @VisibleForTesting public void injectSmsPdu(byte[] pdu, String format, SmsInjectionCallback callback) { injectSmsPdu(pdu, format, callback, false /* ignoreClass */); // TODO We need to decide whether we should allow injecting GSM(3gpp) // SMS pdus when the phone is camping on CDMA(3gpp2) network and vice versa. android.telephony.SmsMessage msg = android.telephony.SmsMessage.createFromPdu(pdu, format); injectSmsPdu(msg, format, callback, false /* ignoreClass */); } /** * Inject an SMS PDU into the android platform. * * @param pdu is the byte array of pdu to be injected into android telephony layer * @param msg is the {@link SmsMessage} to be injected into android telephony layer * @param format is the format of SMS pdu (3gpp or 3gpp2) * @param callback if not NULL this callback is triggered when the message is successfully * received by the android telephony layer. This callback is triggered at Loading @@ -200,15 +205,10 @@ public class SmsDispatchersController extends Handler { * @param ignoreClass if set to false, this method will inject class 1 sms only. */ @VisibleForTesting public void injectSmsPdu(byte[] pdu, String format, SmsInjectionCallback callback, public void injectSmsPdu(SmsMessage msg, String format, SmsInjectionCallback callback, boolean ignoreClass) { Rlog.d(TAG, "SmsDispatchersController:injectSmsPdu"); try { // TODO We need to decide whether we should allow injecting GSM(3gpp) // SMS pdus when the phone is camping on CDMA(3gpp2) network and vice versa. android.telephony.SmsMessage msg = android.telephony.SmsMessage.createFromPdu(pdu, format); if (msg == null) { Rlog.e(TAG, "injectSmsPdu: createFromPdu returned null"); callback.onSmsInjectedResult(Intents.RESULT_SMS_GENERIC_ERROR); Loading Loading
src/java/com/android/internal/telephony/ImsSmsDispatcher.java +10 −2 Original line number Diff line number Diff line Loading @@ -162,7 +162,9 @@ public class ImsSmsDispatcher extends SMSDispatcher { public void onSmsReceived(int token, String format, byte[] pdu) throws RemoteException { Rlog.d(TAG, "SMS received."); mSmsDispatchersController.injectSmsPdu(pdu, format, result -> { android.telephony.SmsMessage message = android.telephony.SmsMessage.createFromPdu(pdu, format); mSmsDispatchersController.injectSmsPdu(message, format, result -> { Rlog.d(TAG, "SMS handled result: " + result); int mappedResult; switch (result) { Loading @@ -180,7 +182,13 @@ public class ImsSmsDispatcher extends SMSDispatcher { break; } try { if (message != null && message.mWrappedSmsMessage != null) { getImsManager().acknowledgeSms(token, message.mWrappedSmsMessage.mMessageRef, mappedResult); } else { Rlog.w(TAG, "SMS Received with a PDU that could not be parsed."); getImsManager().acknowledgeSms(token, 0, mappedResult); } } catch (ImsException e) { Rlog.e(TAG, "Failed to acknowledgeSms(). Error: " + e.getMessage()); } Loading
src/java/com/android/internal/telephony/SmsDispatchersController.java +8 −8 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.provider.Telephony.Sms; import android.provider.Telephony.Sms.Intents; import android.telephony.Rlog; import android.telephony.SmsManager; import android.telephony.SmsMessage; import android.util.Pair; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -186,13 +187,17 @@ public class SmsDispatchersController extends Handler { */ @VisibleForTesting public void injectSmsPdu(byte[] pdu, String format, SmsInjectionCallback callback) { injectSmsPdu(pdu, format, callback, false /* ignoreClass */); // TODO We need to decide whether we should allow injecting GSM(3gpp) // SMS pdus when the phone is camping on CDMA(3gpp2) network and vice versa. android.telephony.SmsMessage msg = android.telephony.SmsMessage.createFromPdu(pdu, format); injectSmsPdu(msg, format, callback, false /* ignoreClass */); } /** * Inject an SMS PDU into the android platform. * * @param pdu is the byte array of pdu to be injected into android telephony layer * @param msg is the {@link SmsMessage} to be injected into android telephony layer * @param format is the format of SMS pdu (3gpp or 3gpp2) * @param callback if not NULL this callback is triggered when the message is successfully * received by the android telephony layer. This callback is triggered at Loading @@ -200,15 +205,10 @@ public class SmsDispatchersController extends Handler { * @param ignoreClass if set to false, this method will inject class 1 sms only. */ @VisibleForTesting public void injectSmsPdu(byte[] pdu, String format, SmsInjectionCallback callback, public void injectSmsPdu(SmsMessage msg, String format, SmsInjectionCallback callback, boolean ignoreClass) { Rlog.d(TAG, "SmsDispatchersController:injectSmsPdu"); try { // TODO We need to decide whether we should allow injecting GSM(3gpp) // SMS pdus when the phone is camping on CDMA(3gpp2) network and vice versa. android.telephony.SmsMessage msg = android.telephony.SmsMessage.createFromPdu(pdu, format); if (msg == null) { Rlog.e(TAG, "injectSmsPdu: createFromPdu returned null"); callback.onSmsInjectedResult(Intents.RESULT_SMS_GENERIC_ERROR); Loading