diff options
author | Brad Ebinger <breadley@google.com> | 2019-09-24 18:11:02 -0700 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2019-10-10 13:25:03 -0700 |
commit | 50c7b1bedf2c6d0ed70df7833d334b7c17caadaf (patch) | |
tree | a9b8895e61866da213eab584767ed626f3c19063 /telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java | |
parent | b6a549d916c0e421c5fed6b780eeb3ef20603beb (diff) |
Fix annotations in ImsSmsImplBase
Bug: 141568452
Test: manual
Change-Id: Iad595b75d47dc9fd356e6362e3adbcb5815e375d
Diffstat (limited to 'telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java')
-rw-r--r-- | telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java | 144 |
1 files changed, 51 insertions, 93 deletions
diff --git a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java index 175769bd34e4..36ece958d501 100644 --- a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java @@ -17,6 +17,7 @@ package android.telephony.ims.stub; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.SystemApi; import android.os.RemoteException; import android.telephony.SmsManager; @@ -148,14 +149,16 @@ public class ImsSmsImplBase { * * @param token unique token generated by the platform that should be used when triggering * callbacks for this specific message. - * @param messageRef the message reference. - * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and - * {@link SmsMessage#FORMAT_3GPP2}. + * @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 format the format of the message. * @param smsc the Short Message Service Center address. * @param isRetry whether it is a retry of an already attempted message or not. * @param pdu PDU representing the contents of the message. */ - public void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry, + public void sendSms(int token, @IntRange(from = 0, to = 65535) int messageRef, + @SmsMessage.Format String format, String smsc, boolean isRetry, byte[] pdu) { // Base implementation returns error. Should be overridden. try { @@ -172,14 +175,13 @@ public class ImsSmsImplBase { * provider. * * @param token token provided in {@link #onSmsReceived(int, String, byte[])} - * @param messageRef the message reference - * @param result result of delivering the message. Valid values are: - * {@link #DELIVER_STATUS_OK}, - * {@link #DELIVER_STATUS_ERROR_GENERIC}, - * {@link #DELIVER_STATUS_ERROR_NO_MEMORY}, - * {@link #DELIVER_STATUS_ERROR_REQUEST_NOT_SUPPORTED} + * @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. */ - public void acknowledgeSms(int token, int messageRef, @DeliverStatusResult int result) { + public void acknowledgeSms(int token, @IntRange(from = 0, to = 65535) int messageRef, + @DeliverStatusResult int result) { Log.e(LOG_TAG, "acknowledgeSms() not implemented."); } @@ -191,12 +193,13 @@ public class ImsSmsImplBase { * * @param token token provided in {@link #onSmsStatusReportReceived(int, int, String, byte[])} * or {@link #onSmsStatusReportReceived(int, String, byte[])} - * @param messageRef the message reference - * @param result result of delivering the message. Valid values are: - * {@link #STATUS_REPORT_STATUS_OK}, - * {@link #STATUS_REPORT_STATUS_ERROR} + * @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. */ - public void acknowledgeSmsReport(int token, int messageRef, @StatusReportResult int result) { + public void acknowledgeSmsReport(int token, @IntRange(from = 0, to = 65535) int messageRef, + @StatusReportResult int result) { Log.e(LOG_TAG, "acknowledgeSmsReport() not implemented."); } @@ -210,12 +213,12 @@ public class ImsSmsImplBase { * {@link #DELIVER_STATUS_ERROR_GENERIC} result code. * @param token unique token generated by IMS providers that the platform will use to trigger * callbacks for this message. - * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and - * {@link SmsMessage#FORMAT_3GPP2}. + * @param format the format of the message. * @param pdu PDU representing the contents of the message. * @throws RuntimeException if called before {@link #onReady()} is triggered. */ - public final void onSmsReceived(int token, String format, byte[] pdu) throws RuntimeException { + public final void onSmsReceived(int token, @SmsMessage.Format String format, byte[] pdu) + throws RuntimeException { synchronized (mLock) { if (mListener == null) { throw new RuntimeException("Feature not ready."); @@ -241,13 +244,16 @@ public class ImsSmsImplBase { * sent successfully. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} - * @param messageRef the message reference. Should be between 0 and 255 per TS.123.040 + * @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). * * @throws RuntimeException if called before {@link #onReady()} is triggered or if the * connection to the framework is not available. If this happens attempting to send the SMS * should be aborted. */ - public final void onSendSmsResultSuccess(int token, int messageRef) throws RuntimeException { + public final void onSendSmsResultSuccess(int token, + @IntRange(from = 0, to = 65535) int messageRef) throws RuntimeException { synchronized (mLock) { if (mListener == null) { throw new RuntimeException("Feature not ready."); @@ -266,34 +272,11 @@ public class ImsSmsImplBase { * to the platform. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} - * @param messageRef the message reference. Should be between 0 and 255 per TS.123.040 + * @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 status result of sending the SMS. - * @param reason reason in case status is failure. Valid values are: - * {@link SmsManager#RESULT_ERROR_NONE}, - * {@link SmsManager#RESULT_ERROR_GENERIC_FAILURE}, - * {@link SmsManager#RESULT_ERROR_RADIO_OFF}, - * {@link SmsManager#RESULT_ERROR_NULL_PDU}, - * {@link SmsManager#RESULT_ERROR_NO_SERVICE}, - * {@link SmsManager#RESULT_ERROR_LIMIT_EXCEEDED}, - * {@link SmsManager#RESULT_ERROR_FDN_CHECK_FAILURE}, - * {@link SmsManager#RESULT_ERROR_SHORT_CODE_NOT_ALLOWED}, - * {@link SmsManager#RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED}, - * {@link SmsManager#RESULT_RADIO_NOT_AVAILABLE}, - * {@link SmsManager#RESULT_NETWORK_REJECT}, - * {@link SmsManager#RESULT_INVALID_ARGUMENTS}, - * {@link SmsManager#RESULT_INVALID_STATE}, - * {@link SmsManager#RESULT_NO_MEMORY}, - * {@link SmsManager#RESULT_INVALID_SMS_FORMAT}, - * {@link SmsManager#RESULT_SYSTEM_ERROR}, - * {@link SmsManager#RESULT_MODEM_ERROR}, - * {@link SmsManager#RESULT_NETWORK_ERROR}, - * {@link SmsManager#RESULT_ENCODING_ERROR}, - * {@link SmsManager#RESULT_INVALID_SMSC_ADDRESS}, - * {@link SmsManager#RESULT_OPERATION_NOT_ALLOWED}, - * {@link SmsManager#RESULT_INTERNAL_ERROR}, - * {@link SmsManager#RESULT_NO_RESOURCES}, - * {@link SmsManager#RESULT_CANCELLED}, - * {@link SmsManager#RESULT_REQUEST_NOT_SUPPORTED} + * @param reason reason in case status is failure. * * @throws RuntimeException if called before {@link #onReady()} is triggered or if the * connection to the framework is not available. If this happens attempting to send the SMS @@ -303,8 +286,8 @@ public class ImsSmsImplBase { * send result. */ @Deprecated - public final void onSendSmsResult(int token, int messageRef, @SendStatusResult int status, - int reason) throws RuntimeException { + public final void onSendSmsResult(int token, @IntRange(from = 0, to = 65535) int messageRef, + @SendStatusResult int status, @SmsManager.Result int reason) throws RuntimeException { synchronized (mLock) { if (mListener == null) { throw new RuntimeException("Feature not ready."); @@ -324,34 +307,10 @@ public class ImsSmsImplBase { * network. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} - * @param messageRef the message reference. Should be between 0 and 255 per TS.123.040 + * @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 status result of sending the SMS. - * @param reason Valid values are: - * {@link SmsManager#RESULT_ERROR_NONE}, - * {@link SmsManager#RESULT_ERROR_GENERIC_FAILURE}, - * {@link SmsManager#RESULT_ERROR_RADIO_OFF}, - * {@link SmsManager#RESULT_ERROR_NULL_PDU}, - * {@link SmsManager#RESULT_ERROR_NO_SERVICE}, - * {@link SmsManager#RESULT_ERROR_LIMIT_EXCEEDED}, - * {@link SmsManager#RESULT_ERROR_FDN_CHECK_FAILURE}, - * {@link SmsManager#RESULT_ERROR_SHORT_CODE_NOT_ALLOWED}, - * {@link SmsManager#RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED}, - * {@link SmsManager#RESULT_RADIO_NOT_AVAILABLE}, - * {@link SmsManager#RESULT_NETWORK_REJECT}, - * {@link SmsManager#RESULT_INVALID_ARGUMENTS}, - * {@link SmsManager#RESULT_INVALID_STATE}, - * {@link SmsManager#RESULT_NO_MEMORY}, - * {@link SmsManager#RESULT_INVALID_SMS_FORMAT}, - * {@link SmsManager#RESULT_SYSTEM_ERROR}, - * {@link SmsManager#RESULT_MODEM_ERROR}, - * {@link SmsManager#RESULT_NETWORK_ERROR}, - * {@link SmsManager#RESULT_ENCODING_ERROR}, - * {@link SmsManager#RESULT_INVALID_SMSC_ADDRESS}, - * {@link SmsManager#RESULT_OPERATION_NOT_ALLOWED}, - * {@link SmsManager#RESULT_INTERNAL_ERROR}, - * {@link SmsManager#RESULT_NO_RESOURCES}, - * {@link SmsManager#RESULT_CANCELLED}, - * {@link SmsManager#RESULT_REQUEST_NOT_SUPPORTED} * @param networkErrorCode the error code reported by the carrier network if sending this SMS * has resulted in an error or {@link #RESULT_NO_NETWORK_ERROR} if no network error was * generated. See 3GPP TS 24.011 Section 7.3.4 for valid error codes and more information. @@ -360,9 +319,9 @@ public class ImsSmsImplBase { * connection to the framework is not available. If this happens attempting to send the SMS * should be aborted. */ - public final void onSendSmsResultError(int token, int messageRef, @SendStatusResult int status, - int reason, int networkErrorCode) - throws RuntimeException { + public final void onSendSmsResultError(int token, + @IntRange(from = 0, to = 65535) int messageRef, @SendStatusResult int status, + @SmsManager.Result int reason, int networkErrorCode) throws RuntimeException { synchronized (mLock) { if (mListener == null) { throw new RuntimeException("Feature not ready."); @@ -384,9 +343,10 @@ public class ImsSmsImplBase { * the platform is not available, {@link #acknowledgeSmsReport(int, int, int)} will be called * with the {@link #STATUS_REPORT_STATUS_ERROR} result code. * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} - * @param messageRef the message reference. - * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and - * {@link SmsMessage#FORMAT_3GPP2}. + * @param messageRef the message reference, which may be 1 byte if it is in + * {@link SmsMessage#FORMAT_3GPP} format or 2 bytes if it is in + * {@link SmsMessage#FORMAT_3GPP2} format (see 3GPP2 C.S0015-B). + * @param format the format of the message. * @param pdu PDU representing the content of the status report. * @throws RuntimeException if called before {@link #onReady()} is triggered * @@ -394,7 +354,8 @@ public class ImsSmsImplBase { * message reference. */ @Deprecated - public final void onSmsStatusReportReceived(int token, int messageRef, String format, + public final void onSmsStatusReportReceived(int token, + @IntRange(from = 0, to = 65535) int messageRef, @SmsMessage.Format String format, byte[] pdu) throws RuntimeException { synchronized (mLock) { if (mListener == null) { @@ -419,13 +380,12 @@ public class ImsSmsImplBase { * with the {@link #STATUS_REPORT_STATUS_ERROR} result code. * @param token unique token generated by IMS providers that the platform will use to trigger * callbacks for this message. - * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and - * {@link SmsMessage#FORMAT_3GPP2}. + * @param format the format of the message. * @param pdu PDU representing the content of the status report. * @throws RuntimeException if called before {@link #onReady()} is triggered */ - public final void onSmsStatusReportReceived(int token, String format, byte[] pdu) - throws RuntimeException { + public final void onSmsStatusReportReceived(int token, @SmsMessage.Format String format, + byte[] pdu) throws RuntimeException { synchronized (mLock) { if (mListener == null) { throw new RuntimeException("Feature not ready."); @@ -450,13 +410,11 @@ public class ImsSmsImplBase { } /** - * Returns the SMS format. Default is {@link SmsMessage#FORMAT_3GPP} unless overridden by IMS - * Provider. + * Returns the SMS format that the ImsService expects. * - * @return the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and - * {@link SmsMessage#FORMAT_3GPP2}. + * @return The expected format of the SMS messages. */ - public String getSmsFormat() { + public @SmsMessage.Format String getSmsFormat() { return SmsMessage.FORMAT_3GPP; } |