diff --git a/core/api/system-current.txt b/core/api/system-current.txt index e976c48f4fce7..dea8314c2467a 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -15912,6 +15912,7 @@ package android.telephony.ims.stub { public class ImsSmsImplBase { ctor public ImsSmsImplBase(); method public void acknowledgeSms(int, @IntRange(from=0, to=65535) int, int); + method public void acknowledgeSms(int, @IntRange(from=0, to=65535) int, int, @NonNull byte[]); method public void acknowledgeSmsReport(int, @IntRange(from=0, to=65535) int, int); method public String getSmsFormat(); method public void onReady(); diff --git a/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl b/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl index 85191734872ad..ea4480dc7958b 100644 --- a/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl +++ b/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl @@ -65,6 +65,7 @@ interface IImsMmTelFeature { oneway void sendSms(in int token, int messageRef, String format, String smsc, boolean retry, in byte[] pdu); oneway void acknowledgeSms(int token, int messageRef, int result); + oneway void acknowledgeSmsWithPdu(int token, int messageRef, int result, in byte[] pdu); oneway void acknowledgeSmsReport(int token, int messageRef, int result); String getSmsFormat(); oneway void onSmsReady(); diff --git a/telephony/java/android/telephony/ims/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java index 8147759769e60..d776928965e57 100644 --- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java +++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java @@ -274,6 +274,12 @@ public class MmTelFeature extends ImsFeature { .acknowledgeSms(token, messageRef, result), "acknowledgeSms"); } + @Override + public void acknowledgeSmsWithPdu(int token, int messageRef, int result, byte[] pdu) { + executeMethodAsyncNoException(() -> MmTelFeature.this + .acknowledgeSms(token, messageRef, result, pdu), "acknowledgeSms"); + } + @Override public void acknowledgeSmsReport(int token, int messageRef, int result) { executeMethodAsyncNoException(() -> MmTelFeature.this @@ -1087,6 +1093,11 @@ public class MmTelFeature extends ImsFeature { getSmsImplementation().acknowledgeSms(token, messageRef, result); } + private void acknowledgeSms(int token, int messageRef, + @ImsSmsImplBase.DeliverStatusResult int result, byte[] pdu) { + getSmsImplementation().acknowledgeSms(token, messageRef, result, pdu); + } + private void acknowledgeSmsReport(int token, int messageRef, @ImsSmsImplBase.StatusReportResult int result) { getSmsImplementation().acknowledgeSmsReport(token, messageRef, result); diff --git a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java index fb997d1184197..66833d18a945e 100644 --- a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java @@ -18,6 +18,7 @@ package android.telephony.ims.stub; import android.annotation.IntDef; import android.annotation.IntRange; +import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.RemoteException; import android.telephony.SmsManager; @@ -174,6 +175,9 @@ public class ImsSmsImplBase { * {@link #onSmsReceived(int, String, byte[])} has been called to deliver the result to the IMS * provider. * + * If the framework needs to provide the PDU used to acknowledge the SMS, + * {@link #acknowledgeSms(int, int, int, byte[])} will be called. + * * @param token token provided in {@link #onSmsReceived(int, String, byte[])} * @param messageRef the message reference, which may be 1 byte if it is in * {@link SmsMessage#FORMAT_3GPP} format (see TS.123.040) or 2 bytes if it is in @@ -185,6 +189,27 @@ public class ImsSmsImplBase { Log.e(LOG_TAG, "acknowledgeSms() not implemented."); } + /** + * This method will be called by the platform after + * {@link #onSmsReceived(int, String, byte[])} has been called to acknowledge an incoming SMS. + * + * This method is only called in cases where the framework needs to provide the PDU such as the + * case where we provide the Short Message Transfer Layer PDU (see 3GPP TS 23.040). Otherwise, + * {@link #acknowledgeSms(int, int, int)} will be used. + * + * @param token token provided in {@link #onSmsReceived(int, String, byte[])} + * @param messageRef the message reference, which may be 1 byte if it is in + * {@link SmsMessage#FORMAT_3GPP} format (see TS.123.040) or 2 bytes if it is in + * {@link SmsMessage#FORMAT_3GPP2} format (see 3GPP2 C.S0015-B). + * @param result result of delivering the message. + * @param pdu PDU representing the contents of the message. + */ + public void acknowledgeSms(int token, @IntRange(from = 0, to = 65535) int messageRef, + @DeliverStatusResult int result, @NonNull byte[] pdu) { + Log.e(LOG_TAG, "acknowledgeSms() not implemented. acknowledgeSms(int, int, int) called."); + acknowledgeSms(token, messageRef, result); + } + /** * This method will be triggered by the platform after * {@link #onSmsStatusReportReceived(int, int, String, byte[])} or