Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccc1c3e2 authored by Tom Taylor's avatar Tom Taylor
Browse files

Add sms receiver result codes

During the process of receiving an sms, there are a number of situations
that will cause the receive process to fail. Sms receive failures are
broadcast via the SMS_REJECTED_ACTION in the "result" action.

Bug: b/135755360

Test: manually tested sms/mms send and receive
Change-Id: If5c7d465ecaac60c1ce9517c3bc00a9664bc51ec
parent e34def6c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -39568,10 +39568,16 @@ package android.provider {
    field public static final String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED";
    field public static final String EXTRA_IS_DEFAULT_SMS_APP = "android.provider.extra.IS_DEFAULT_SMS_APP";
    field public static final String EXTRA_PACKAGE_NAME = "package";
    field public static final int RESULT_SMS_DATABASE_ERROR = 10; // 0xa
    field public static final int RESULT_SMS_DISPATCH_FAILURE = 6; // 0x6
    field public static final int RESULT_SMS_DUPLICATED = 5; // 0x5
    field public static final int RESULT_SMS_GENERIC_ERROR = 2; // 0x2
    field public static final int RESULT_SMS_HANDLED = 1; // 0x1
    field public static final int RESULT_SMS_INVALID_URI = 11; // 0xb
    field public static final int RESULT_SMS_NULL_MESSAGE = 8; // 0x8
    field public static final int RESULT_SMS_NULL_PDU = 7; // 0x7
    field public static final int RESULT_SMS_OUT_OF_MEMORY = 3; // 0x3
    field public static final int RESULT_SMS_RECEIVED_WHILE_ENCRYPTED = 9; // 0x9
    field public static final int RESULT_SMS_UNSUPPORTED = 4; // 0x4
    field @Deprecated public static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
    field public static final String SIM_FULL_ACTION = "android.provider.Telephony.SIM_FULL";
@@ -45099,6 +45105,13 @@ package android.telephony {
    field public static final int RESULT_NO_RESOURCES = 22; // 0x16
    field public static final int RESULT_OPERATION_NOT_ALLOWED = 20; // 0x14
    field public static final int RESULT_RADIO_NOT_AVAILABLE = 9; // 0x9
    field public static final int RESULT_RECEIVE_DISPATCH_FAILURE = 500; // 0x1f4
    field public static final int RESULT_RECEIVE_INJECTED_NULL_PDU = 501; // 0x1f5
    field public static final int RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL = 503; // 0x1f7
    field public static final int RESULT_RECEIVE_RUNTIME_EXCEPTION = 502; // 0x1f6
    field public static final int RESULT_RECEIVE_SQL_EXCEPTION = 505; // 0x1f9
    field public static final int RESULT_RECEIVE_URI_EXCEPTION = 506; // 0x1fa
    field public static final int RESULT_RECEIVE_WHILE_ENCRYPTED = 504; // 0x1f8
    field public static final int RESULT_REMOTE_EXCEPTION = 31; // 0x1f
    field public static final int RESULT_REQUEST_NOT_SUPPORTED = 24; // 0x18
    field public static final int RESULT_RIL_CANCELLED = 119; // 0x77
+42 −6
Original line number Diff line number Diff line
@@ -877,23 +877,59 @@ public final class Telephony {
            public static final int RESULT_SMS_GENERIC_ERROR = 2;

            /**
             * Set by BroadcastReceiver to indicate insufficient memory to store
             * the message.
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate
             * insufficient memory to store the message.
             */
            public static final int RESULT_SMS_OUT_OF_MEMORY = 3;

            /**
             * Set by BroadcastReceiver to indicate that the message, while
             * possibly valid, is of a format or encoding that is not
             * supported.
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate that
             * the message, while possibly valid, is of a format or encoding that is not supported.
             */
            public static final int RESULT_SMS_UNSUPPORTED = 4;

            /**
             * Set by BroadcastReceiver to indicate a duplicate incoming message.
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a
             * duplicate incoming message.
             */
            public static final int RESULT_SMS_DUPLICATED = 5;

            /**
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a
             * dispatch failure.
             */
            public static final int RESULT_SMS_DISPATCH_FAILURE = 6;

            /**
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a null
             * PDU was received.
             */
            public static final int RESULT_SMS_NULL_PDU = 7;

            /**
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a null
             * message was encountered.
             */
            public static final int RESULT_SMS_NULL_MESSAGE = 8;

            /**
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate an sms
             * was received while the phone was in encrypted state.
             */
            public static final int RESULT_SMS_RECEIVED_WHILE_ENCRYPTED = 9;

            /**
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a
             * telephony database error.
             */
            public static final int RESULT_SMS_DATABASE_ERROR = 10;

            /**
             * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate an
             * invalid uri.
             */
            public static final int RESULT_SMS_INVALID_URI = 11;

            /**
             * Activity action: Ask the user to change the default
             * SMS application. This will show a dialog that asks the
+72 −4
Original line number Diff line number Diff line
@@ -733,8 +733,8 @@ public final class SmsManager {
     *  android application framework, or failed. This intent is broadcasted at
     *  the same time an SMS received from radio is acknowledged back.
     *  The result code will be {@link android.provider.Telephony.Sms.Intents#RESULT_SMS_HANDLED}
     *  for success, or {@link android.provider.Telephony.Sms.Intents#RESULT_SMS_GENERIC_ERROR} for
     *  error.
     *  for success, or {@link android.provider.Telephony.Sms.Intents#RESULT_SMS_GENERIC_ERROR} or
     *  {@link #RESULT_REMOTE_EXCEPTION} for error.
     *
     * @throws IllegalArgumentException if the format is invalid.
     */
@@ -2047,7 +2047,36 @@ public final class SmsManager {
            RESULT_INTERNAL_ERROR,
            RESULT_NO_RESOURCES,
            RESULT_CANCELLED,
            RESULT_REQUEST_NOT_SUPPORTED
            RESULT_REQUEST_NOT_SUPPORTED,
            RESULT_NO_BLUETOOTH_SERVICE,
            RESULT_INVALID_BLUETOOTH_ADDRESS,
            RESULT_BLUETOOTH_DISCONNECTED,
            RESULT_UNEXPECTED_EVENT_STOP_SENDING,
            RESULT_SMS_BLOCKED_DURING_EMERGENCY,
            RESULT_SMS_SEND_RETRY_FAILED,
            RESULT_REMOTE_EXCEPTION,
            RESULT_NO_DEFAULT_SMS_APP,
            RESULT_RIL_RADIO_NOT_AVAILABLE,
            RESULT_RIL_SMS_SEND_FAIL_RETRY,
            RESULT_RIL_NETWORK_REJECT,
            RESULT_RIL_INVALID_STATE,
            RESULT_RIL_INVALID_ARGUMENTS,
            RESULT_RIL_NO_MEMORY,
            RESULT_RIL_REQUEST_RATE_LIMITED,
            RESULT_RIL_INVALID_SMS_FORMAT,
            RESULT_RIL_SYSTEM_ERR,
            RESULT_RIL_ENCODING_ERR,
            RESULT_RIL_INVALID_SMSC_ADDRESS,
            RESULT_RIL_MODEM_ERR,
            RESULT_RIL_NETWORK_ERR,
            RESULT_RIL_INTERNAL_ERR,
            RESULT_RIL_REQUEST_NOT_SUPPORTED,
            RESULT_RIL_INVALID_MODEM_STATE,
            RESULT_RIL_NETWORK_NOT_READY,
            RESULT_RIL_OPERATION_NOT_ALLOWED,
            RESULT_RIL_NO_RESOURCES,
            RESULT_RIL_CANCELLED,
            RESULT_RIL_SIM_ABSENT
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Result {}
@@ -2297,7 +2326,7 @@ public final class SmsManager {
    public static final int RESULT_RIL_OPERATION_NOT_ALLOWED = 117;

    /**
     * There are not sufficient resources to process the request.
     * There are insufficient resources to process the request.
     */
    public static final int RESULT_RIL_NO_RESOURCES = 118;

@@ -2312,6 +2341,45 @@ public final class SmsManager {
     */
    public static final int RESULT_RIL_SIM_ABSENT = 120;

    // SMS receiving results sent as a "result" extra in {@link Intents.SMS_REJECTED_ACTION}

    /**
     * SMS receive dispatch failure.
     */
    public static final int RESULT_RECEIVE_DISPATCH_FAILURE = 500;

    /**
     * SMS receive injected null PDU.
     */
    public static final int RESULT_RECEIVE_INJECTED_NULL_PDU = 501;

    /**
     * SMS receive encountered runtime exception.
     */
    public static final int RESULT_RECEIVE_RUNTIME_EXCEPTION = 502;

    /**
     * SMS received null message from the radio interface layer.
     */
    public static final int RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL = 503;

    /**
     * SMS short code received while the phone is in encrypted state.
     */
    public static final int RESULT_RECEIVE_WHILE_ENCRYPTED = 504;

    /**
     * SMS receive encountered an SQL exception.
     */
    public static final int RESULT_RECEIVE_SQL_EXCEPTION = 505;

    /**
     * SMS receive an exception parsing a uri.
     */
    public static final int RESULT_RECEIVE_URI_EXCEPTION = 506;



    /**
     * Send an MMS message
     *