From c38bb60d867c5d61d90b7179a9ed2b2d1848124f Mon Sep 17 00:00:00 2001
From: Wink Saville Type: INTEGER Type: INTEGER Type: TEXT Type: INTEGER (long) Type: INTEGER (long) Type: INTEGER (long) Type: INTEGER (boolean) Type: TEXT Type: TEXT Type: INTEGER (reference to item in content://contacts/people) Type: INTEGER Type: BOOLEAN Type: TEXT Type: INTEGER (boolean) Type: INTEGER Type: TEXT Type: TEXT Type: INTEGERTP-Reply-Path
bit was set on this message
+ *
The extra values can be extracted using + * {@link #getMessagesFromIntent(Intent)}.
+ * + *If a BroadcastReceiver encounters an error while processing + * this intent it should set the result code appropriately.
+ */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String SMS_RECEIVED_ACTION = + "android.provider.Telephony.SMS_RECEIVED"; + + /** + * Broadcast Action: A new data based SMS message has been received + * by the device. The intent will have the following extra + * values: + * + *The extra values can be extracted using + * {@link #getMessagesFromIntent(Intent)}.
+ * + *If a BroadcastReceiver encounters an error while processing + * this intent it should set the result code appropriately.
+ */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String DATA_SMS_RECEIVED_ACTION = + "android.intent.action.DATA_SMS_RECEIVED"; + + /** + * Broadcast Action: A new WAP PUSH message has been received by the + * device. The intent will have the following extra + * values: + * + *If a BroadcastReceiver encounters an error while processing + * this intent it should set the result code appropriately.
+ * + *The contentTypeParameters extra value is map of content parameters keyed by + * their names.
+ * + *If any unassigned well-known parameters are encountered, the key of the map will + * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If + * a parameter has No-Value the value in the map will be null.
+ */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String WAP_PUSH_RECEIVED_ACTION = + "android.provider.Telephony.WAP_PUSH_RECEIVED"; + + /** + * Broadcast Action: A new Cell Broadcast message has been received + * by the device. The intent will have the following extra + * values: + * + *The extra values can be extracted using + * {@link #getMessagesFromIntent(Intent)}.
+ * + *If a BroadcastReceiver encounters an error while processing + * this intent it should set the result code appropriately.
+ */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String SMS_CB_RECEIVED_ACTION = + "android.provider.Telephony.SMS_CB_RECEIVED"; + + /** + * Broadcast Action: A new Emergency Broadcast message has been received + * by the device. The intent will have the following extra + * values: + * + *The extra values can be extracted using + * {@link #getMessagesFromIntent(Intent)}.
+ * + *If a BroadcastReceiver encounters an error while processing + * this intent it should set the result code appropriately.
+ */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String SMS_EMERGENCY_CB_RECEIVED_ACTION = + "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED"; + + /** + * Broadcast Action: A new CDMA SMS has been received containing Service Category + * Program Data (updates the list of enabled broadcast channels). The intent will + * have the following extra values: + * + *The extra values can be extracted using + * {@link #getMessagesFromIntent(Intent)}.
+ * + *If a BroadcastReceiver encounters an error while processing + * this intent it should set the result code appropriately.
+ */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION = + "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED"; + + /** + * Broadcast Action: The SIM storage for SMS messages is full. If + * space is not freed, messages targeted for the SIM (class 2) may + * not be saved. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String SIM_FULL_ACTION = + "android.provider.Telephony.SIM_FULL"; + + /** + * Broadcast Action: An incoming SMS has been rejected by the + * telephony framework. This intent is sent in lieu of any + * of the RECEIVED_ACTION intents. The intent will have the + * following extra value: + * + *{@link #RESULT_SMS_OUT_OF_MEMORY}
,
+ * indicating the error returned to the network.Type: INTEGER (long)
+ */ + public static final String DATE = "date"; + + /** + * The date the message was sent. + *Type: INTEGER (long)
+ */ + public static final String DATE_SENT = "date_sent"; + + /** + * The box which the message belong to, for example, MESSAGE_BOX_INBOX. + *Type: INTEGER
+ */ + public static final String MESSAGE_BOX = "msg_box"; + + /** + * Has the message been read. + *Type: INTEGER (boolean)
+ */ + public static final String READ = "read"; + + /** + * Indicates whether this message has been seen by the user. The "seen" flag will be + * used to figure out whether we need to throw up a statusbar notification or not. + */ + public static final String SEEN = "seen"; + + /** + * The Message-ID of the message. + *Type: TEXT
+ */ + public static final String MESSAGE_ID = "m_id"; + + /** + * The subject of the message, if present. + *Type: TEXT
+ */ + public static final String SUBJECT = "sub"; + + /** + * The character set of the subject, if present. + *Type: INTEGER
+ */ + public static final String SUBJECT_CHARSET = "sub_cs"; + + /** + * The Content-Type of the message. + *Type: TEXT
+ */ + public static final String CONTENT_TYPE = "ct_t"; + + /** + * The Content-Location of the message. + *Type: TEXT
+ */ + public static final String CONTENT_LOCATION = "ct_l"; + + /** + * The address of the sender. + *Type: TEXT
+ */ + public static final String FROM = "from"; + + /** + * The address of the recipients. + *Type: TEXT
+ */ + public static final String TO = "to"; + + /** + * The address of the cc. recipients. + *Type: TEXT
+ */ + public static final String CC = "cc"; + + /** + * The address of the bcc. recipients. + *Type: TEXT
+ */ + public static final String BCC = "bcc"; + + /** + * The expiry time of the message. + *Type: INTEGER
+ */ + public static final String EXPIRY = "exp"; + + /** + * The class of the message. + *Type: TEXT
+ */ + public static final String MESSAGE_CLASS = "m_cls"; + + /** + * The type of the message defined by MMS spec. + *Type: INTEGER
+ */ + public static final String MESSAGE_TYPE = "m_type"; + + /** + * The version of specification that this message conform. + *Type: INTEGER
+ */ + public static final String MMS_VERSION = "v"; + + /** + * The size of the message. + *Type: INTEGER
+ */ + public static final String MESSAGE_SIZE = "m_size"; + + /** + * The priority of the message. + *Type: TEXT
+ */ + public static final String PRIORITY = "pri"; + + /** + * The read-report of the message. + *Type: TEXT
+ */ + public static final String READ_REPORT = "rr"; + + /** + * Whether the report is allowed. + *Type: TEXT
+ */ + public static final String REPORT_ALLOWED = "rpt_a"; + + /** + * The response-status of the message. + *Type: INTEGER
+ */ + public static final String RESPONSE_STATUS = "resp_st"; + + /** + * The status of the message. + *Type: INTEGER
+ */ + public static final String STATUS = "st"; + + /** + * The transaction-id of the message. + *Type: TEXT
+ */ + public static final String TRANSACTION_ID = "tr_id"; + + /** + * The retrieve-status of the message. + *Type: INTEGER
+ */ + public static final String RETRIEVE_STATUS = "retr_st"; + + /** + * The retrieve-text of the message. + *Type: TEXT
+ */ + public static final String RETRIEVE_TEXT = "retr_txt"; + + /** + * The character set of the retrieve-text. + *Type: TEXT
+ */ + public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs"; + + /** + * The read-status of the message. + *Type: INTEGER
+ */ + public static final String READ_STATUS = "read_status"; + + /** + * The content-class of the message. + *Type: INTEGER
+ */ + public static final String CONTENT_CLASS = "ct_cls"; + + /** + * The delivery-report of the message. + *Type: INTEGER
+ */ + public static final String DELIVERY_REPORT = "d_rpt"; + + /** + * The delivery-time-token of the message. + *Type: INTEGER
+ */ + public static final String DELIVERY_TIME_TOKEN = "d_tm_tok"; + + /** + * The delivery-time of the message. + *Type: INTEGER
+ */ + public static final String DELIVERY_TIME = "d_tm"; + + /** + * The response-text of the message. + *Type: TEXT
+ */ + public static final String RESPONSE_TEXT = "resp_txt"; + + /** + * The sender-visibility of the message. + *Type: TEXT
+ */ + public static final String SENDER_VISIBILITY = "s_vis"; + + /** + * The reply-charging of the message. + *Type: INTEGER
+ */ + public static final String REPLY_CHARGING = "r_chg"; + + /** + * The reply-charging-deadline-token of the message. + *Type: INTEGER
+ */ + public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok"; + + /** + * The reply-charging-deadline of the message. + *Type: INTEGER
+ */ + public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl"; + + /** + * The reply-charging-id of the message. + *Type: TEXT
+ */ + public static final String REPLY_CHARGING_ID = "r_chg_id"; + + /** + * The reply-charging-size of the message. + *Type: INTEGER
+ */ + public static final String REPLY_CHARGING_SIZE = "r_chg_sz"; + + /** + * The previously-sent-by of the message. + *Type: TEXT
+ */ + public static final String PREVIOUSLY_SENT_BY = "p_s_by"; + + /** + * The previously-sent-date of the message. + *Type: INTEGER
+ */ + public static final String PREVIOUSLY_SENT_DATE = "p_s_d"; + + /** + * The store of the message. + *Type: TEXT
+ */ + public static final String STORE = "store"; + + /** + * The mm-state of the message. + *Type: INTEGER
+ */ + public static final String MM_STATE = "mm_st"; + + /** + * The mm-flags-token of the message. + *Type: INTEGER
+ */ + public static final String MM_FLAGS_TOKEN = "mm_flg_tok"; + + /** + * The mm-flags of the message. + *Type: TEXT
+ */ + public static final String MM_FLAGS = "mm_flg"; + + /** + * The store-status of the message. + *Type: TEXT
+ */ + public static final String STORE_STATUS = "store_st"; + + /** + * The store-status-text of the message. + *Type: TEXT
+ */ + public static final String STORE_STATUS_TEXT = "store_st_txt"; + + /** + * The stored of the message. + *Type: TEXT
+ */ + public static final String STORED = "stored"; + + /** + * The totals of the message. + *Type: TEXT
+ */ + public static final String TOTALS = "totals"; + + /** + * The mbox-totals of the message. + *Type: TEXT
+ */ + public static final String MBOX_TOTALS = "mb_t"; + + /** + * The mbox-totals-token of the message. + *Type: INTEGER
+ */ + public static final String MBOX_TOTALS_TOKEN = "mb_t_tok"; + + /** + * The quotas of the message. + *Type: TEXT
+ */ + public static final String QUOTAS = "qt"; + + /** + * The mbox-quotas of the message. + *Type: TEXT
+ */ + public static final String MBOX_QUOTAS = "mb_qt"; + + /** + * The mbox-quotas-token of the message. + *Type: INTEGER
+ */ + public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok"; + + /** + * The message-count of the message. + *Type: INTEGER
+ */ + public static final String MESSAGE_COUNT = "m_cnt"; + + /** + * The start of the message. + *Type: INTEGER
+ */ + public static final String START = "start"; + + /** + * The distribution-indicator of the message. + *Type: TEXT
+ */ + public static final String DISTRIBUTION_INDICATOR = "d_ind"; + + /** + * The element-descriptor of the message. + *Type: TEXT
+ */ + public static final String ELEMENT_DESCRIPTOR = "e_des"; + + /** + * The limit of the message. + *Type: INTEGER
+ */ + public static final String LIMIT = "limit"; + + /** + * The recommended-retrieval-mode of the message. + *Type: INTEGER
+ */ + public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod"; + + /** + * The recommended-retrieval-mode-text of the message. + *Type: TEXT
+ */ + public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt"; + + /** + * The status-text of the message. + *Type: TEXT
+ */ + public static final String STATUS_TEXT = "st_txt"; + + /** + * The applic-id of the message. + *Type: TEXT
+ */ + public static final String APPLIC_ID = "apl_id"; + + /** + * The reply-applic-id of the message. + *Type: TEXT
+ */ + public static final String REPLY_APPLIC_ID = "r_apl_id"; + + /** + * The aux-applic-id of the message. + *Type: TEXT
+ */ + public static final String AUX_APPLIC_ID = "aux_apl_id"; + + /** + * The drm-content of the message. + *Type: TEXT
+ */ + public static final String DRM_CONTENT = "drm_c"; + + /** + * The adaptation-allowed of the message. + *Type: TEXT
+ */ + public static final String ADAPTATION_ALLOWED = "adp_a"; + + /** + * The replace-id of the message. + *Type: TEXT
+ */ + public static final String REPLACE_ID = "repl_id"; + + /** + * The cancel-id of the message. + *Type: TEXT
+ */ + public static final String CANCEL_ID = "cl_id"; + + /** + * The cancel-status of the message. + *Type: INTEGER
+ */ + public static final String CANCEL_STATUS = "cl_st"; + + /** + * The thread ID of the message + *Type: INTEGER
+ */ + public static final String THREAD_ID = "thread_id"; + + /** + * Has the message been locked? + *Type: INTEGER (boolean)
+ */ + public static final String LOCKED = "locked"; + + /** + * Meta data used externally. + *Type: TEXT
+ */ + public static final String META_DATA = "meta_data"; + } + + /** + * Columns for the "canonical_addresses" table used by MMS and + * SMS." + */ + public interface CanonicalAddressesColumns extends BaseColumns { + /** + * An address used in MMS or SMS. Email addresses are + * converted to lower case and are compared by string + * equality. Other addresses are compared using + * PHONE_NUMBERS_EQUAL. + *Type: TEXT
+ */ + public static final String ADDRESS = "address"; + } + + /** + * Columns for the "threads" table used by MMS and SMS. + */ + public interface ThreadsColumns extends BaseColumns { + /** + * The date at which the thread was created. + * + *Type: INTEGER (long)
+ */ + public static final String DATE = "date"; + + /** + * A string encoding of the recipient IDs of the recipients of + * the message, in numerical order and separated by spaces. + *Type: TEXT
+ */ + public static final String RECIPIENT_IDS = "recipient_ids"; + + /** + * The message count of the thread. + *Type: INTEGER
+ */ + public static final String MESSAGE_COUNT = "message_count"; + /** + * Indicates whether all messages of the thread have been read. + *Type: INTEGER
+ */ + public static final String READ = "read"; + + /** + * The snippet of the latest message in the thread. + *Type: TEXT
+ */ + public static final String SNIPPET = "snippet"; + /** + * The charset of the snippet. + *Type: INTEGER
+ */ + public static final String SNIPPET_CHARSET = "snippet_cs"; + /** + * Type of the thread, either Threads.COMMON_THREAD or + * Threads.BROADCAST_THREAD. + *Type: INTEGER
+ */ + public static final String TYPE = "type"; + /** + * Indicates whether there is a transmission error in the thread. + *Type: INTEGER
+ */ + public static final String ERROR = "error"; + /** + * Indicates whether this thread contains any attachments. + *Type: INTEGER
+ */ + public static final String HAS_ATTACHMENT = "has_attachment"; + } + + /** + * Helper functions for the "threads" table used by MMS and SMS. + */ + public static final class Threads implements ThreadsColumns { + private static final String[] ID_PROJECTION = { BaseColumns._ID }; + private static final String STANDARD_ENCODING = "UTF-8"; + private static final Uri THREAD_ID_CONTENT_URI = Uri.parse( + "content://mms-sms/threadID"); + public static final Uri CONTENT_URI = Uri.withAppendedPath( + MmsSms.CONTENT_URI, "conversations"); + public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath( + CONTENT_URI, "obsolete"); + + public static final int COMMON_THREAD = 0; + public static final int BROADCAST_THREAD = 1; + + // No one should construct an instance of this class. + private Threads() { + } + + /** + * This is a single-recipient version of + * getOrCreateThreadId. It's convenient for use with SMS + * messages. + */ + public static long getOrCreateThreadId(Context context, String recipient) { + SetType: INTEGER
+ */ + public static final String MSG_ID = "mid"; + + /** + * The order of the part. + *Type: INTEGER
+ */ + public static final String SEQ = "seq"; + + /** + * The content type of the part. + *Type: TEXT
+ */ + public static final String CONTENT_TYPE = "ct"; + + /** + * The name of the part. + *Type: TEXT
+ */ + public static final String NAME = "name"; + + /** + * The charset of the part. + *Type: TEXT
+ */ + public static final String CHARSET = "chset"; + + /** + * The file name of the part. + *Type: TEXT
+ */ + public static final String FILENAME = "fn"; + + /** + * The content disposition of the part. + *Type: TEXT
+ */ + public static final String CONTENT_DISPOSITION = "cd"; + + /** + * The content ID of the part. + *Type: INTEGER
+ */ + public static final String CONTENT_ID = "cid"; + + /** + * The content location of the part. + *Type: INTEGER
+ */ + public static final String CONTENT_LOCATION = "cl"; + + /** + * The start of content-type of the message. + *Type: INTEGER
+ */ + public static final String CT_START = "ctt_s"; + + /** + * The type of content-type of the message. + *Type: TEXT
+ */ + public static final String CT_TYPE = "ctt_t"; + + /** + * The location(on filesystem) of the binary data of the part. + *Type: INTEGER
+ */ + public static final String _DATA = "_data"; + + public static final String TEXT = "text"; + + } + + public static final class Rate { + public static final Uri CONTENT_URI = Uri.withAppendedPath( + Mms.CONTENT_URI, "rate"); + /** + * When a message was successfully sent. + *Type: INTEGER
+ */ + public static final String SENT_TIME = "sent_time"; + } + + public static final class Intents { + private Intents() { + // Non-instantiatable. + } + + /** + * The extra field to store the contents of the Intent, + * which should be an array of Uri. + */ + public static final String EXTRA_CONTENTS = "contents"; + /** + * The extra field to store the type of the contents, + * which should be an array of String. + */ + public static final String EXTRA_TYPES = "types"; + /** + * The extra field to store the 'Cc' addresses. + */ + public static final String EXTRA_CC = "cc"; + /** + * The extra field to store the 'Bcc' addresses; + */ + public static final String EXTRA_BCC = "bcc"; + /** + * The extra field to store the 'Subject'. + */ + public static final String EXTRA_SUBJECT = "subject"; + /** + * Indicates that the contents of specified URIs were changed. + * The application which is showing or caching these contents + * should be updated. + */ + public static final String + CONTENT_CHANGED_ACTION = "android.intent.action.CONTENT_CHANGED"; + /** + * An extra field which stores the URI of deleted contents. + */ + public static final String DELETED_CONTENTS = "deleted_contents"; + } + } + + /** + * Contains all MMS and SMS messages. + */ + public static final class MmsSms implements BaseColumns { + /** + * The column to distinguish SMS & MMS messages in query results. + */ + public static final String TYPE_DISCRIMINATOR_COLUMN = + "transport_type"; + + public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/"); + + public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse( + "content://mms-sms/conversations"); + + public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse( + "content://mms-sms/messages/byphone"); + + public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse( + "content://mms-sms/undelivered"); + + public static final Uri CONTENT_DRAFT_URI = Uri.parse( + "content://mms-sms/draft"); + + public static final Uri CONTENT_LOCKED_URI = Uri.parse( + "content://mms-sms/locked"); + + /*** + * Pass in a query parameter called "pattern" which is the text + * to search for. + * The sort order is fixed to be thread_id ASC,date DESC. + */ + public static final Uri SEARCH_URI = Uri.parse( + "content://mms-sms/search"); + + // Constants for message protocol types. + public static final int SMS_PROTO = 0; + public static final int MMS_PROTO = 1; + + // Constants for error types of pending messages. + public static final int NO_ERROR = 0; + public static final int ERR_TYPE_GENERIC = 1; + public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2; + public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3; + public static final int ERR_TYPE_TRANSPORT_FAILURE = 4; + public static final int ERR_TYPE_GENERIC_PERMANENT = 10; + public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11; + public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12; + + public static final class PendingMessages implements BaseColumns { + public static final Uri CONTENT_URI = Uri.withAppendedPath( + MmsSms.CONTENT_URI, "pending"); + /** + * The type of transport protocol(MMS or SMS). + *Type: INTEGER
+ */ + public static final String PROTO_TYPE = "proto_type"; + /** + * The ID of the message to be sent or downloaded. + *Type: INTEGER
+ */ + public static final String MSG_ID = "msg_id"; + /** + * The type of the message to be sent or downloaded. + * This field is only valid for MM. For SM, its value is always + * set to 0. + */ + public static final String MSG_TYPE = "msg_type"; + /** + * The type of the error code. + *Type: INTEGER
+ */ + public static final String ERROR_TYPE = "err_type"; + /** + * The error code of sending/retrieving process. + *Type: INTEGER
+ */ + public static final String ERROR_CODE = "err_code"; + /** + * How many times we tried to send or download the message. + *Type: INTEGER
+ */ + public static final String RETRY_INDEX = "retry_index"; + /** + * The time to do next retry. + */ + public static final String DUE_TIME = "due_time"; + /** + * The time we last tried to send or download the message. + */ + public static final String LAST_TRY = "last_try"; + } + + public static final class WordsTable { + public static final String ID = "_id"; + public static final String SOURCE_ROW_ID = "source_id"; + public static final String TABLE_ID = "table_to_use"; + public static final String INDEXED_TEXT = "index_text"; + } + } + + public static final class Carriers implements BaseColumns { + /** + * The content:// style URL for this table + */ + public static final Uri CONTENT_URI = + Uri.parse("content://telephony/carriers"); + + /** + * The default sort order for this table + */ + public static final String DEFAULT_SORT_ORDER = "name ASC"; + + public static final String NAME = "name"; + + public static final String APN = "apn"; + + public static final String PROXY = "proxy"; + + public static final String PORT = "port"; + + public static final String MMSPROXY = "mmsproxy"; + + public static final String MMSPORT = "mmsport"; + + public static final String SERVER = "server"; + + public static final String USER = "user"; + + public static final String PASSWORD = "password"; + + public static final String MMSC = "mmsc"; + + public static final String MCC = "mcc"; + + public static final String MNC = "mnc"; + + public static final String NUMERIC = "numeric"; + + public static final String AUTH_TYPE = "authtype"; + + public static final String TYPE = "type"; + + public static final String INACTIVE_TIMER = "inactivetimer"; + + // Only if enabled try Data Connection. + public static final String ENABLED = "enabled"; + + // Rules apply based on class. + public static final String CLASS = "class"; + + /** + * The protocol to be used to connect to this APN. + * + * One of the PDP_type values in TS 27.007 section 10.1.1. + * For example, "IP", "IPV6", "IPV4V6", or "PPP". + */ + public static final String PROTOCOL = "protocol"; + + /** + * The protocol to be used to connect to this APN when roaming. + * + * The syntax is the same as protocol. + */ + public static final String ROAMING_PROTOCOL = "roaming_protocol"; + + public static final String CURRENT = "current"; + + /** + * Current status of APN + * true : enabled APN, false : disabled APN. + */ + public static final String CARRIER_ENABLED = "carrier_enabled"; + + /** + * Radio Access Technology info + * To check what values can hold, refer to ServiceState.java. + * This should be spread to other technologies, + * but currently only used for LTE(14) and EHRPD(13). + */ + public static final String BEARER = "bearer"; + } + + /** + * Contains received SMS cell broadcast messages. + */ + public static final class CellBroadcasts implements BaseColumns { + + /** Not instantiable. */ + private CellBroadcasts() {} + + /** + * The content:// style URL for this table + */ + public static final Uri CONTENT_URI = + Uri.parse("content://cellbroadcasts"); + + /** + * Message geographical scope. + *Type: INTEGER
+ */ + public static final String GEOGRAPHICAL_SCOPE = "geo_scope"; + + /** + * Message serial number. + *Type: INTEGER
+ */ + public static final String SERIAL_NUMBER = "serial_number"; + + /** + * PLMN of broadcast sender. (SERIAL_NUMBER + PLMN + LAC + CID) uniquely identifies a + * broadcast for duplicate detection purposes. + *Type: TEXT
+ */ + public static final String PLMN = "plmn"; + + /** + * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA. + * Only included if Geographical Scope of message is not PLMN wide (01). + *Type: INTEGER
+ */ + public static final String LAC = "lac"; + + /** + * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the + * Geographical Scope of message is cell wide (00 or 11). + *Type: INTEGER
+ */ + public static final String CID = "cid"; + + /** + * Message code (OBSOLETE: merged into SERIAL_NUMBER). + *Type: INTEGER
+ */ + public static final String V1_MESSAGE_CODE = "message_code"; + + /** + * Message identifier (OBSOLETE: renamed to SERVICE_CATEGORY). + *Type: INTEGER
+ */ + public static final String V1_MESSAGE_IDENTIFIER = "message_id"; + + /** + * Service category (GSM/UMTS message identifier, CDMA service category). + *Type: INTEGER
+ */ + public static final String SERVICE_CATEGORY = "service_category"; + + /** + * Message language code. + *Type: TEXT
+ */ + public static final String LANGUAGE_CODE = "language"; + + /** + * Message body. + *Type: TEXT
+ */ + public static final String MESSAGE_BODY = "body"; + + /** + * Message delivery time. + *Type: INTEGER (long)
+ */ + public static final String DELIVERY_TIME = "date"; + + /** + * Has the message been viewed? + *Type: INTEGER (boolean)
+ */ + public static final String MESSAGE_READ = "read"; + + /** + * Message format (3GPP or 3GPP2). + *Type: INTEGER
+ */ + public static final String MESSAGE_FORMAT = "format"; + + /** + * Message priority (including emergency). + *Type: INTEGER
+ */ + public static final String MESSAGE_PRIORITY = "priority"; + + /** + * ETWS warning type (ETWS alerts only). + *Type: INTEGER
+ */ + public static final String ETWS_WARNING_TYPE = "etws_warning_type"; + + /** + * CMAS message class (CMAS alerts only). + *Type: INTEGER
+ */ + public static final String CMAS_MESSAGE_CLASS = "cmas_message_class"; + + /** + * CMAS category (CMAS alerts only). + *Type: INTEGER
+ */ + public static final String CMAS_CATEGORY = "cmas_category"; + + /** + * CMAS response type (CMAS alerts only). + *Type: INTEGER
+ */ + public static final String CMAS_RESPONSE_TYPE = "cmas_response_type"; + + /** + * CMAS severity (CMAS alerts only). + *Type: INTEGER
+ */ + public static final String CMAS_SEVERITY = "cmas_severity"; + + /** + * CMAS urgency (CMAS alerts only). + *Type: INTEGER
+ */ + public static final String CMAS_URGENCY = "cmas_urgency"; + + /** + * CMAS certainty (CMAS alerts only). + *Type: INTEGER
+ */ + public static final String CMAS_CERTAINTY = "cmas_certainty"; + + /** + * The default sort order for this table + */ + public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC"; + + /** + * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects. + */ + public static final String[] QUERY_COLUMNS = { + _ID, + GEOGRAPHICAL_SCOPE, + PLMN, + LAC, + CID, + SERIAL_NUMBER, + SERVICE_CATEGORY, + LANGUAGE_CODE, + MESSAGE_BODY, + DELIVERY_TIME, + MESSAGE_READ, + MESSAGE_FORMAT, + MESSAGE_PRIORITY, + ETWS_WARNING_TYPE, + CMAS_MESSAGE_CLASS, + CMAS_CATEGORY, + CMAS_RESPONSE_TYPE, + CMAS_SEVERITY, + CMAS_URGENCY, + CMAS_CERTAINTY + }; + } +} diff --git a/src/java/android/telephony/CellBroadcastMessage.java b/src/java/android/telephony/CellBroadcastMessage.java new file mode 100644 index 0000000..36c238d --- /dev/null +++ b/src/java/android/telephony/CellBroadcastMessage.java @@ -0,0 +1,422 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package android.telephony; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.graphics.Typeface; +import android.os.Parcel; +import android.os.Parcelable; +import android.provider.Telephony; +import android.telephony.SmsCbCmasInfo; +import android.telephony.SmsCbEtwsInfo; +import android.telephony.SmsCbLocation; +import android.telephony.SmsCbMessage; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.format.DateUtils; +import android.text.style.StyleSpan; + +/** + * Application wrapper for {@link SmsCbMessage}. This is Parcelable so that + * decoded broadcast message objects can be passed between running Services. + * New broadcasts are received by the CellBroadcastReceiver app, which exports + * the database of previously received broadcasts at "content://cellbroadcasts/". + * The "android.permission.READ_CELL_BROADCASTS" permission is required to read + * from the ContentProvider, and writes to the database are not allowed.
+ *
+ * Use {@link #createFromCursor} to create CellBroadcastMessage objects from rows
+ * in the database cursor returned by the ContentProvider.
+ *
+ * {@hide}
+ */
+public class CellBroadcastMessage implements Parcelable {
+
+ /** Identifier for getExtra() when adding this object to an Intent. */
+ public static final String SMS_CB_MESSAGE_EXTRA =
+ "com.android.cellbroadcastreceiver.SMS_CB_MESSAGE";
+
+ /** SmsCbMessage. */
+ private final SmsCbMessage mSmsCbMessage;
+
+ private final long mDeliveryTime;
+ private boolean mIsRead;
+
+ public CellBroadcastMessage(SmsCbMessage message) {
+ mSmsCbMessage = message;
+ mDeliveryTime = System.currentTimeMillis();
+ mIsRead = false;
+ }
+
+ private CellBroadcastMessage(SmsCbMessage message, long deliveryTime, boolean isRead) {
+ mSmsCbMessage = message;
+ mDeliveryTime = deliveryTime;
+ mIsRead = isRead;
+ }
+
+ private CellBroadcastMessage(Parcel in) {
+ mSmsCbMessage = new SmsCbMessage(in);
+ mDeliveryTime = in.readLong();
+ mIsRead = (in.readInt() != 0);
+ }
+
+ /** Parcelable: no special flags. */
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel out, int flags) {
+ mSmsCbMessage.writeToParcel(out, flags);
+ out.writeLong(mDeliveryTime);
+ out.writeInt(mIsRead ? 1 : 0);
+ }
+
+ public static final Parcelable.Creator There are also four different CB message formats: GSM, ETWS Primary Notification (GSM only),
+ * UMTS, and CDMA. Some fields are only applicable for some message formats. Other fields were
+ * unified under a common name, avoiding some names, such as "Message Identifier", that refer to
+ * two completely different concepts in 3GPP and CDMA.
+ *
+ * The GSM/UMTS Message Identifier field is available via {@link #getServiceCategory}, the name
+ * of the equivalent field in CDMA. In both cases the service category is a 16-bit value, but 3GPP
+ * and 3GPP2 have completely different meanings for the respective values. For ETWS and CMAS, the
+ * application should
+ *
+ * The CDMA Message Identifier field is available via {@link #getSerialNumber}, which is used
+ * to detect the receipt of a duplicate message to be discarded. In CDMA, the message ID is
+ * unique to the current PLMN. In GSM/UMTS, there is a 16-bit serial number containing a 2-bit
+ * Geographical Scope field which indicates whether the 10-bit message code and 4-bit update number
+ * are considered unique to the PLMN, to the current cell, or to the current Location Area (or
+ * Service Area in UMTS). The relevant values are concatenated into a single String which will be
+ * unique if the messages are not duplicates.
+ *
+ * The SMS dispatcher does not detect duplicate messages. However, it does concatenate the
+ * pages of a GSM multi-page cell broadcast into a single SmsCbMessage object.
+ *
+ * Interested applications with {@code RECEIVE_SMS_PERMISSION} can register to receive
+ * {@code SMS_CB_RECEIVED_ACTION} broadcast intents for incoming non-emergency broadcasts.
+ * Only system applications such as the CellBroadcastReceiver may receive notifications for
+ * emergency broadcasts (ETWS and CMAS). This is intended to prevent any potential for delays or
+ * interference with the immediate display of the alert message and playing of the alert sound and
+ * vibration pattern, which could be caused by poorly written or malicious non-system code.
+ *
+ * @hide
+ */
+public class SmsCbMessage implements Parcelable {
+
+ protected static final String LOG_TAG = "SMSCB";
+
+ /** Cell wide geographical scope with immediate display (GSM/UMTS only). */
+ public static final int GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE = 0;
+
+ /** PLMN wide geographical scope (GSM/UMTS and all CDMA broadcasts). */
+ public static final int GEOGRAPHICAL_SCOPE_PLMN_WIDE = 1;
+
+ /** Location / service area wide geographical scope (GSM/UMTS only). */
+ public static final int GEOGRAPHICAL_SCOPE_LA_WIDE = 2;
+
+ /** Cell wide geographical scope (GSM/UMTS only). */
+ public static final int GEOGRAPHICAL_SCOPE_CELL_WIDE = 3;
+
+ /** GSM or UMTS format cell broadcast. */
+ public static final int MESSAGE_FORMAT_3GPP = 1;
+
+ /** CDMA format cell broadcast. */
+ public static final int MESSAGE_FORMAT_3GPP2 = 2;
+
+ /** Normal message priority. */
+ public static final int MESSAGE_PRIORITY_NORMAL = 0;
+
+ /** Interactive message priority. */
+ public static final int MESSAGE_PRIORITY_INTERACTIVE = 1;
+
+ /** Urgent message priority. */
+ public static final int MESSAGE_PRIORITY_URGENT = 2;
+
+ /** Emergency message priority. */
+ public static final int MESSAGE_PRIORITY_EMERGENCY = 3;
+
+ /** Format of this message (for interpretation of service category values). */
+ private final int mMessageFormat;
+
+ /** Geographical scope of broadcast. */
+ private final int mGeographicalScope;
+
+ /**
+ * Serial number of broadcast (message identifier for CDMA, geographical scope + message code +
+ * update number for GSM/UMTS). The serial number plus the location code uniquely identify
+ * a cell broadcast for duplicate detection.
+ */
+ private final int mSerialNumber;
+
+ /**
+ * Location identifier for this message. It consists of the current operator MCC/MNC as a
+ * 5 or 6-digit decimal string. In addition, for GSM/UMTS, if the Geographical Scope of the
+ * message is not binary 01, the Location Area is included for comparison. If the GS is
+ * 00 or 11, the Cell ID is also included. LAC and Cell ID are -1 if not specified.
+ */
+ private final SmsCbLocation mLocation;
+
+ /**
+ * 16-bit CDMA service category or GSM/UMTS message identifier. For ETWS and CMAS warnings,
+ * the information provided by the category is also available via {@link #getEtwsWarningInfo()}
+ * or {@link #getCmasWarningInfo()}.
+ */
+ private final int mServiceCategory;
+
+ /** Message language, as a two-character string, e.g. "en". */
+ private final String mLanguage;
+
+ /** Message body, as a String. */
+ private final String mBody;
+
+ /** Message priority (including emergency priority). */
+ private final int mPriority;
+
+ /** ETWS warning notification information (ETWS warnings only). */
+ private final SmsCbEtwsInfo mEtwsWarningInfo;
+
+ /** CMAS warning notification information (CMAS warnings only). */
+ private final SmsCbCmasInfo mCmasWarningInfo;
+
+ /**
+ * Create a new SmsCbMessage with the specified data.
+ */
+ public SmsCbMessage(int messageFormat, int geographicalScope, int serialNumber,
+ SmsCbLocation location, int serviceCategory, String language, String body,
+ int priority, SmsCbEtwsInfo etwsWarningInfo, SmsCbCmasInfo cmasWarningInfo) {
+ mMessageFormat = messageFormat;
+ mGeographicalScope = geographicalScope;
+ mSerialNumber = serialNumber;
+ mLocation = location;
+ mServiceCategory = serviceCategory;
+ mLanguage = language;
+ mBody = body;
+ mPriority = priority;
+ mEtwsWarningInfo = etwsWarningInfo;
+ mCmasWarningInfo = cmasWarningInfo;
+ }
+
+ /** Create a new SmsCbMessage object from a Parcel. */
+ public SmsCbMessage(Parcel in) {
+ mMessageFormat = in.readInt();
+ mGeographicalScope = in.readInt();
+ mSerialNumber = in.readInt();
+ mLocation = new SmsCbLocation(in);
+ mServiceCategory = in.readInt();
+ mLanguage = in.readString();
+ mBody = in.readString();
+ mPriority = in.readInt();
+ int type = in.readInt();
+ switch (type) {
+ case 'E':
+ // unparcel ETWS warning information
+ mEtwsWarningInfo = new SmsCbEtwsInfo(in);
+ mCmasWarningInfo = null;
+ break;
+
+ case 'C':
+ // unparcel CMAS warning information
+ mEtwsWarningInfo = null;
+ mCmasWarningInfo = new SmsCbCmasInfo(in);
+ break;
+
+ default:
+ mEtwsWarningInfo = null;
+ mCmasWarningInfo = null;
+ }
+ }
+
+ /**
+ * Flatten this object into a Parcel.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written (ignored).
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mMessageFormat);
+ dest.writeInt(mGeographicalScope);
+ dest.writeInt(mSerialNumber);
+ mLocation.writeToParcel(dest, flags);
+ dest.writeInt(mServiceCategory);
+ dest.writeString(mLanguage);
+ dest.writeString(mBody);
+ dest.writeInt(mPriority);
+ if (mEtwsWarningInfo != null) {
+ // parcel ETWS warning information
+ dest.writeInt('E');
+ mEtwsWarningInfo.writeToParcel(dest, flags);
+ } else if (mCmasWarningInfo != null) {
+ // parcel CMAS warning information
+ dest.writeInt('C');
+ mCmasWarningInfo.writeToParcel(dest, flags);
+ } else {
+ // no ETWS or CMAS warning information
+ dest.writeInt('0');
+ }
+ }
+
+ public static final Parcelable.Creator This method will soon be deprecated and all applications which handle
+ * incoming SMS messages by processing the {@code SMS_RECEIVED_ACTION} broadcast
+ * intent must now pass the new {@code format} String extra from the intent
+ * into the new method {@code createFromPdu(byte[], String)} which takes an
+ * extra format parameter. This is required in order to correctly decode the PDU on
+ * devices that require support for both 3GPP and 3GPP2 formats at the same time,
+ * such as dual-mode GSM/CDMA and CDMA/LTE phones.
+ */
+ public static SmsMessage createFromPdu(byte[] pdu) {
+ int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
+ String format = (PHONE_TYPE_CDMA == activePhone) ?
+ SmsConstants.FORMAT_3GPP2 : SmsConstants.FORMAT_3GPP;
+ return createFromPdu(pdu, format);
+ }
+
+ /**
+ * Create an SmsMessage from a raw PDU with the specified message format. The
+ * message format is passed in the {@code SMS_RECEIVED_ACTION} as the {@code format}
+ * String extra, and will be either "3gpp" for GSM/UMTS/LTE messages in 3GPP format
+ * or "3gpp2" for CDMA/LTE messages in 3GPP2 format.
+ *
+ * @param pdu the message PDU from the SMS_RECEIVED_ACTION intent
+ * @param format the format extra from the SMS_RECEIVED_ACTION intent
+ * @hide pending API council approval
+ */
+ public static SmsMessage createFromPdu(byte[] pdu, String format) {
+ SmsMessageBase wrappedMessage;
+
+ if (SmsConstants.FORMAT_3GPP2.equals(format)) {
+ wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromPdu(pdu);
+ } else if (SmsConstants.FORMAT_3GPP.equals(format)) {
+ wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromPdu(pdu);
+ } else {
+ Log.e(LOG_TAG, "createFromPdu(): unsupported message format " + format);
+ return null;
+ }
+
+ return new SmsMessage(wrappedMessage);
+ }
+
+ /**
+ * TS 27.005 3.4.1 lines[0] and lines[1] are the two lines read from the
+ * +CMT unsolicited response (PDU mode, of course)
+ * +CMT: [<alpha>],
+ *
+ *
+ * PendingIntent
is
+ * broadcast when the message is successfully sent, or failed.
+ * The result code will be Activity.RESULT_OK
for success,
+ * or one of these errors:
+ * RESULT_ERROR_GENERIC_FAILURE
+ * RESULT_ERROR_RADIO_OFF
+ * RESULT_ERROR_NULL_PDU
+ * For RESULT_ERROR_GENERIC_FAILURE
the sentIntent may include
+ * the extra "errorCode" containing a radio technology specific value,
+ * generally only useful for troubleshooting.
+ * The per-application based SMS control checks sentIntent. If sentIntent
+ * is NULL the caller will be checked against all unknown applications,
+ * which cause smaller number of SMS to be sent in checking period.
+ * @param deliveryIntent if not NULL this PendingIntent
is
+ * broadcast when the message is delivered to the recipient. The
+ * raw pdu of the status report is in the extended data ("pdu").
+ *
+ * @throws IllegalArgumentException if destinationAddress or text are empty
+ */
+ public void sendTextMessage(
+ String destinationAddress, String scAddress, String text,
+ PendingIntent sentIntent, PendingIntent deliveryIntent) {
+ if (TextUtils.isEmpty(destinationAddress)) {
+ throw new IllegalArgumentException("Invalid destinationAddress");
+ }
+
+ if (TextUtils.isEmpty(text)) {
+ throw new IllegalArgumentException("Invalid message body");
+ }
+
+ try {
+ ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+ if (iccISms != null) {
+ iccISms.sendText(destinationAddress, scAddress, text, sentIntent, deliveryIntent);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ }
+
+ /**
+ * Divide a message text into several fragments, none bigger than
+ * the maximum SMS message size.
+ *
+ * @param text the original message. Must not be null.
+ * @return an ArrayList
of strings that, in order,
+ * comprise the original message
+ */
+ public ArrayListdivideMessage
.
+ *
+ * @param destinationAddress the address to send the message to
+ * @param scAddress is the service center address or null to use
+ * the current default SMSC
+ * @param parts an ArrayList
of strings that, in order,
+ * comprise the original message
+ * @param sentIntents if not null, an ArrayList
of
+ * PendingIntent
s (one for each message part) that is
+ * broadcast when the corresponding message part has been sent.
+ * The result code will be Activity.RESULT_OK
for success,
+ * or one of these errors:
+ * RESULT_ERROR_GENERIC_FAILURE
+ * RESULT_ERROR_RADIO_OFF
+ * RESULT_ERROR_NULL_PDU
+ * For RESULT_ERROR_GENERIC_FAILURE
each sentIntent may include
+ * the extra "errorCode" containing a radio technology specific value,
+ * generally only useful for troubleshooting.
+ * The per-application based SMS control checks sentIntent. If sentIntent
+ * is NULL the caller will be checked against all unknown applications,
+ * which cause smaller number of SMS to be sent in checking period.
+ * @param deliveryIntents if not null, an ArrayList
of
+ * PendingIntent
s (one for each message part) that is
+ * broadcast when the corresponding message part has been delivered
+ * to the recipient. The raw pdu of the status report is in the
+ * extended data ("pdu").
+ *
+ * @throws IllegalArgumentException if destinationAddress or data are empty
+ */
+ public void sendMultipartTextMessage(
+ String destinationAddress, String scAddress, ArrayListPendingIntent
is
+ * broadcast when the message is successfully sent, or failed.
+ * The result code will be Activity.RESULT_OK
for success,
+ * or one of these errors:
+ * RESULT_ERROR_GENERIC_FAILURE
+ * RESULT_ERROR_RADIO_OFF
+ * RESULT_ERROR_NULL_PDU
+ * For RESULT_ERROR_GENERIC_FAILURE
the sentIntent may include
+ * the extra "errorCode" containing a radio technology specific value,
+ * generally only useful for troubleshooting.
+ * The per-application based SMS control checks sentIntent. If sentIntent
+ * is NULL the caller will be checked against all unknown applications,
+ * which cause smaller number of SMS to be sent in checking period.
+ * @param deliveryIntent if not NULL this PendingIntent
is
+ * broadcast when the message is delivered to the recipient. The
+ * raw pdu of the status report is in the extended data ("pdu").
+ *
+ * @throws IllegalArgumentException if destinationAddress or data are empty
+ */
+ public void sendDataMessage(
+ String destinationAddress, String scAddress, short destinationPort,
+ byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
+ if (TextUtils.isEmpty(destinationAddress)) {
+ throw new IllegalArgumentException("Invalid destinationAddress");
+ }
+
+ if (data == null || data.length == 0) {
+ throw new IllegalArgumentException("Invalid message data");
+ }
+
+ try {
+ ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+ if (iccISms != null) {
+ iccISms.sendData(destinationAddress, scAddress, destinationPort & 0xFFFF,
+ data, sentIntent, deliveryIntent);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ }
+
+ /**
+ * Get the default instance of the SmsManager
+ *
+ * @return the default instance of the SmsManager
+ */
+ public static SmsManager getDefault() {
+ return sInstance;
+ }
+
+ private SmsManager() {
+ //nothing
+ }
+
+ /**
+ * Copy a raw SMS PDU to the ICC.
+ * ICC (Integrated Circuit Card) is the card of the device.
+ * For example, this can be the SIM or USIM for GSM.
+ *
+ * @param smsc the SMSC for this message, or NULL for the default SMSC
+ * @param pdu the raw PDU to store
+ * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD,
+ * STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
+ * @return true for success
+ *
+ * {@hide}
+ */
+ public boolean copyMessageToIcc(byte[] smsc, byte[] pdu, int status) {
+ boolean success = false;
+
+ try {
+ ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+ if (iccISms != null) {
+ success = iccISms.copyMessageToIccEf(status, pdu, smsc);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ return success;
+ }
+
+ /**
+ * Delete the specified message from the ICC.
+ * ICC (Integrated Circuit Card) is the card of the device.
+ * For example, this can be the SIM or USIM for GSM.
+ *
+ * @param messageIndex is the record index of the message on ICC
+ * @return true for success
+ *
+ * {@hide}
+ */
+ public boolean
+ deleteMessageFromIcc(int messageIndex) {
+ boolean success = false;
+ byte[] pdu = new byte[IccConstants.SMS_RECORD_LENGTH-1];
+ Arrays.fill(pdu, (byte)0xff);
+
+ try {
+ ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+ if (iccISms != null) {
+ success = iccISms.updateMessageOnIccEf(messageIndex, STATUS_ON_ICC_FREE, pdu);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ return success;
+ }
+
+ /**
+ * Update the specified message on the ICC.
+ * ICC (Integrated Circuit Card) is the card of the device.
+ * For example, this can be the SIM or USIM for GSM.
+ *
+ * @param messageIndex record index of message to update
+ * @param newStatus new message status (STATUS_ON_ICC_READ,
+ * STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT,
+ * STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE)
+ * @param pdu the raw PDU to store
+ * @return true for success
+ *
+ * {@hide}
+ */
+ public boolean updateMessageOnIcc(int messageIndex, int newStatus, byte[] pdu) {
+ boolean success = false;
+
+ try {
+ ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+ if (iccISms != null) {
+ success = iccISms.updateMessageOnIccEf(messageIndex, newStatus, pdu);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ return success;
+ }
+
+ /**
+ * Retrieves all messages currently stored on ICC.
+ * ICC (Integrated Circuit Card) is the card of the device.
+ * For example, this can be the SIM or USIM for GSM.
+ *
+ * @return ArrayList
of SmsMessage
objects
+ *
+ * {@hide}
+ */
+ public static ArrayListSmsMessage
s from a list of RawSmsData
+ * records returned by getAllMessagesFromIcc()
+ *
+ * @param records SMS EF records, returned by
+ * getAllMessagesFromIcc
+ * @return ArrayList
of SmsMessage
objects.
+ */
+ private static ArrayListArrayList
of strings that, in order,
+ * comprise the original msg text
+ *
+ * @hide
+ */
+ public static ArrayListSubmitPdu
containing the encoded SC
+ * address, if applicable, and the encoded message.
+ * Returns null on encode error.
+ */
+ public static SubmitPdu getSubmitPdu(String scAddress,
+ String destinationAddress, String message, boolean statusReportRequested) {
+ SubmitPduBase spb;
+ int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
+
+ if (PHONE_TYPE_CDMA == activePhone) {
+ spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, message, statusReportRequested, null);
+ } else {
+ spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, message, statusReportRequested);
+ }
+
+ return new SubmitPdu(spb);
+ }
+
+ /**
+ * Get an SMS-SUBMIT PDU for a data message to a destination address & port.
+ * This method will not attempt to use any GSM national language 7 bit encodings.
+ *
+ * @param scAddress Service Centre address. null == use default
+ * @param destinationAddress the address of the destination for the message
+ * @param destinationPort the port to deliver the message to at the
+ * destination
+ * @param data the data for the message
+ * @return a SubmitPdu
containing the encoded SC
+ * address, if applicable, and the encoded message.
+ * Returns null on encode error.
+ */
+ public static SubmitPdu getSubmitPdu(String scAddress,
+ String destinationAddress, short destinationPort, byte[] data,
+ boolean statusReportRequested) {
+ SubmitPduBase spb;
+ int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
+
+ if (PHONE_TYPE_CDMA == activePhone) {
+ spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, destinationPort, data, statusReportRequested);
+ } else {
+ spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, destinationPort, data, statusReportRequested);
+ }
+
+ return new SubmitPdu(spb);
+ }
+
+ /**
+ * Returns the address of the SMS service center that relayed this message
+ * or null if there is none.
+ */
+ public String getServiceCenterAddress() {
+ return mWrappedSmsMessage.getServiceCenterAddress();
+ }
+
+ /**
+ * Returns the originating address (sender) of this SMS message in String
+ * form or null if unavailable
+ */
+ public String getOriginatingAddress() {
+ return mWrappedSmsMessage.getOriginatingAddress();
+ }
+
+ /**
+ * Returns the originating address, or email from address if this message
+ * was from an email gateway. Returns null if originating address
+ * unavailable.
+ */
+ public String getDisplayOriginatingAddress() {
+ return mWrappedSmsMessage.getDisplayOriginatingAddress();
+ }
+
+ /**
+ * Returns the message body as a String, if it exists and is text based.
+ * @return message body is there is one, otherwise null
+ */
+ public String getMessageBody() {
+ return mWrappedSmsMessage.getMessageBody();
+ }
+
+ /**
+ * Returns the class of this message.
+ */
+ public MessageClass getMessageClass() {
+ switch(mWrappedSmsMessage.getMessageClass()) {
+ case CLASS_0: return MessageClass.CLASS_0;
+ case CLASS_1: return MessageClass.CLASS_1;
+ case CLASS_2: return MessageClass.CLASS_2;
+ case CLASS_3: return MessageClass.CLASS_3;
+ default: return MessageClass.UNKNOWN;
+
+ }
+ }
+
+ /**
+ * Returns the message body, or email message body if this message was from
+ * an email gateway. Returns null if message body unavailable.
+ */
+ public String getDisplayMessageBody() {
+ return mWrappedSmsMessage.getDisplayMessageBody();
+ }
+
+ /**
+ * Unofficial convention of a subject line enclosed in parens empty string
+ * if not present
+ */
+ public String getPseudoSubject() {
+ return mWrappedSmsMessage.getPseudoSubject();
+ }
+
+ /**
+ * Returns the service centre timestamp in currentTimeMillis() format
+ */
+ public long getTimestampMillis() {
+ return mWrappedSmsMessage.getTimestampMillis();
+ }
+
+ /**
+ * Returns true if message is an email.
+ *
+ * @return true if this message came through an email gateway and email
+ * sender / subject / parsed body are available
+ */
+ public boolean isEmail() {
+ return mWrappedSmsMessage.isEmail();
+ }
+
+ /**
+ * @return if isEmail() is true, body of the email sent through the gateway.
+ * null otherwise
+ */
+ public String getEmailBody() {
+ return mWrappedSmsMessage.getEmailBody();
+ }
+
+ /**
+ * @return if isEmail() is true, email from address of email sent through
+ * the gateway. null otherwise
+ */
+ public String getEmailFrom() {
+ return mWrappedSmsMessage.getEmailFrom();
+ }
+
+ /**
+ * Get protocol identifier.
+ */
+ public int getProtocolIdentifier() {
+ return mWrappedSmsMessage.getProtocolIdentifier();
+ }
+
+ /**
+ * See TS 23.040 9.2.3.9 returns true if this is a "replace short message"
+ * SMS
+ */
+ public boolean isReplace() {
+ return mWrappedSmsMessage.isReplace();
+ }
+
+ /**
+ * Returns true for CPHS MWI toggle message.
+ *
+ * @return true if this is a CPHS MWI toggle message See CPHS 4.2 section
+ * B.4.2
+ */
+ public boolean isCphsMwiMessage() {
+ return mWrappedSmsMessage.isCphsMwiMessage();
+ }
+
+ /**
+ * returns true if this message is a CPHS voicemail / message waiting
+ * indicator (MWI) clear message
+ */
+ public boolean isMWIClearMessage() {
+ return mWrappedSmsMessage.isMWIClearMessage();
+ }
+
+ /**
+ * returns true if this message is a CPHS voicemail / message waiting
+ * indicator (MWI) set message
+ */
+ public boolean isMWISetMessage() {
+ return mWrappedSmsMessage.isMWISetMessage();
+ }
+
+ /**
+ * returns true if this message is a "Message Waiting Indication Group:
+ * Discard Message" notification and should not be stored.
+ */
+ public boolean isMwiDontStore() {
+ return mWrappedSmsMessage.isMwiDontStore();
+ }
+
+ /**
+ * returns the user data section minus the user data header if one was
+ * present.
+ */
+ public byte[] getUserData() {
+ return mWrappedSmsMessage.getUserData();
+ }
+
+ /**
+ * Returns the raw PDU for the message.
+ *
+ * @return the raw PDU for the message.
+ */
+ public byte[] getPdu() {
+ return mWrappedSmsMessage.getPdu();
+ }
+
+ /**
+ * Returns the status of the message on the SIM (read, unread, sent, unsent).
+ *
+ * @return the status of the message on the SIM. These are:
+ * SmsManager.STATUS_ON_SIM_FREE
+ * SmsManager.STATUS_ON_SIM_READ
+ * SmsManager.STATUS_ON_SIM_UNREAD
+ * SmsManager.STATUS_ON_SIM_SEND
+ * SmsManager.STATUS_ON_SIM_UNSENT
+ * @deprecated Use getStatusOnIcc instead.
+ */
+ @Deprecated public int getStatusOnSim() {
+ return mWrappedSmsMessage.getStatusOnIcc();
+ }
+
+ /**
+ * Returns the status of the message on the ICC (read, unread, sent, unsent).
+ *
+ * @return the status of the message on the ICC. These are:
+ * SmsManager.STATUS_ON_ICC_FREE
+ * SmsManager.STATUS_ON_ICC_READ
+ * SmsManager.STATUS_ON_ICC_UNREAD
+ * SmsManager.STATUS_ON_ICC_SEND
+ * SmsManager.STATUS_ON_ICC_UNSENT
+ */
+ public int getStatusOnIcc() {
+ return mWrappedSmsMessage.getStatusOnIcc();
+ }
+
+ /**
+ * Returns the record index of the message on the SIM (1-based index).
+ * @return the record index of the message on the SIM, or -1 if this
+ * SmsMessage was not created from a SIM SMS EF record.
+ * @deprecated Use getIndexOnIcc instead.
+ */
+ @Deprecated public int getIndexOnSim() {
+ return mWrappedSmsMessage.getIndexOnIcc();
+ }
+
+ /**
+ * Returns the record index of the message on the ICC (1-based index).
+ * @return the record index of the message on the ICC, or -1 if this
+ * SmsMessage was not created from a ICC SMS EF record.
+ */
+ public int getIndexOnIcc() {
+ return mWrappedSmsMessage.getIndexOnIcc();
+ }
+
+ /**
+ * GSM:
+ * For an SMS-STATUS-REPORT message, this returns the status field from
+ * the status report. This field indicates the status of a previously
+ * submitted SMS, if requested. See TS 23.040, 9.2.3.15 TP-Status for a
+ * description of values.
+ * CDMA:
+ * For not interfering with status codes from GSM, the value is
+ * shifted to the bits 31-16.
+ * The value is composed of an error class (bits 25-24) and a status code (bits 23-16).
+ * Possible codes are described in C.S0015-B, v2.0, 4.5.21.
+ *
+ * @return 0 indicates the previously sent message was received.
+ * See TS 23.040, 9.9.2.3.15 and C.S0015-B, v2.0, 4.5.21
+ * for a description of other possible values.
+ */
+ public int getStatus() {
+ return mWrappedSmsMessage.getStatus();
+ }
+
+ /**
+ * Return true iff the message is a SMS-STATUS-REPORT message.
+ */
+ public boolean isStatusReportMessage() {
+ return mWrappedSmsMessage.isStatusReportMessage();
+ }
+
+ /**
+ * Returns true iff the TP-Reply-Path
bit is set in
+ * this message.
+ */
+ public boolean isReplyPathPresent() {
+ return mWrappedSmsMessage.isReplyPathPresent();
+ }
+}
diff --git a/src/java/android/telephony/gsm/SmsManager.java b/src/java/android/telephony/gsm/SmsManager.java
new file mode 100644
index 0000000..3b75298
--- /dev/null
+++ b/src/java/android/telephony/gsm/SmsManager.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.gsm;
+
+import android.app.PendingIntent;
+
+import java.util.ArrayList;
+
+
+/**
+ * Manages SMS operations such as sending data, text, and pdu SMS messages.
+ * Get this object by calling the static method SmsManager.getDefault().
+ * @deprecated Replaced by android.telephony.SmsManager that supports both GSM and CDMA.
+ */
+@Deprecated public final class SmsManager {
+ private static SmsManager sInstance;
+ private android.telephony.SmsManager mSmsMgrProxy;
+
+ /** Get the default instance of the SmsManager
+ *
+ * @return the default instance of the SmsManager
+ * @deprecated Use android.telephony.SmsManager.
+ */
+ @Deprecated
+ public static final SmsManager getDefault() {
+ if (sInstance == null) {
+ sInstance = new SmsManager();
+ }
+ return sInstance;
+ }
+
+ @Deprecated
+ private SmsManager() {
+ mSmsMgrProxy = android.telephony.SmsManager.getDefault();
+ }
+
+ /**
+ * Send a text based SMS.
+ *
+ * @param destinationAddress the address to send the message to
+ * @param scAddress is the service center address or null to use
+ * the current default SMSC
+ * @param text the body of the message to send
+ * @param sentIntent if not NULL this PendingIntent
is
+ * broadcast when the message is successfully sent, or failed.
+ * The result code will be Activity.RESULT_OK
for success,
+ * or one of these errors:
+ *
RESULT_ERROR_GENERIC_FAILURE
+ * RESULT_ERROR_RADIO_OFF
+ * RESULT_ERROR_NULL_PDU
.
+ * The per-application based SMS control checks sentIntent. If sentIntent
+ * is NULL the caller will be checked against all unknown applications,
+ * which cause smaller number of SMS to be sent in checking period.
+ * @param deliveryIntent if not NULL this PendingIntent
is
+ * broadcast when the message is delivered to the recipient. The
+ * raw pdu of the status report is in the extended data ("pdu").
+ *
+ * @throws IllegalArgumentException if destinationAddress or text are empty
+ * @deprecated Use android.telephony.SmsManager.
+ */
+ @Deprecated
+ public final void sendTextMessage(
+ String destinationAddress, String scAddress, String text,
+ PendingIntent sentIntent, PendingIntent deliveryIntent) {
+ mSmsMgrProxy.sendTextMessage(destinationAddress, scAddress, text,
+ sentIntent, deliveryIntent);
+ }
+
+ /**
+ * Divide a text message into several messages, none bigger than
+ * the maximum SMS message size.
+ *
+ * @param text the original message. Must not be null.
+ * @return an ArrayList
of strings that, in order,
+ * comprise the original message
+ * @deprecated Use android.telephony.SmsManager.
+ */
+ @Deprecated
+ public final ArrayListdivideMessage
.
+ *
+ * @param destinationAddress the address to send the message to
+ * @param scAddress is the service center address or null to use
+ * the current default SMSC
+ * @param parts an ArrayList
of strings that, in order,
+ * comprise the original message
+ * @param sentIntents if not null, an ArrayList
of
+ * PendingIntent
s (one for each message part) that is
+ * broadcast when the corresponding message part has been sent.
+ * The result code will be Activity.RESULT_OK
for success,
+ * or one of these errors:
+ *
RESULT_ERROR_GENERIC_FAILURE
+ * RESULT_ERROR_RADIO_OFF
+ * RESULT_ERROR_NULL_PDU
.
+ * The per-application based SMS control checks sentIntent. If sentIntent
+ * is NULL the caller will be checked against all unknown applicaitons,
+ * which cause smaller number of SMS to be sent in checking period.
+ * @param deliveryIntents if not null, an ArrayList
of
+ * PendingIntent
s (one for each message part) that is
+ * broadcast when the corresponding message part has been delivered
+ * to the recipient. The raw pdu of the status report is in the
+ * extended data ("pdu").
+ *
+ * @throws IllegalArgumentException if destinationAddress or data are empty
+ * @deprecated Use android.telephony.SmsManager.
+ */
+ @Deprecated
+ public final void sendMultipartTextMessage(
+ String destinationAddress, String scAddress, ArrayListPendingIntent
is
+ * broadcast when the message is sucessfully sent, or failed.
+ * The result code will be Activity.RESULT_OK
for success,
+ * or one of these errors:
+ *
RESULT_ERROR_GENERIC_FAILURE
+ * RESULT_ERROR_RADIO_OFF
+ * RESULT_ERROR_NULL_PDU
.
+ * The per-application based SMS control checks sentIntent. If sentIntent
+ * is NULL the caller will be checked against all unknown applicaitons,
+ * which cause smaller number of SMS to be sent in checking period.
+ * @param deliveryIntent if not NULL this PendingIntent
is
+ * broadcast when the message is delivered to the recipient. The
+ * raw pdu of the status report is in the extended data ("pdu").
+ *
+ * @throws IllegalArgumentException if destinationAddress or data are empty
+ * @deprecated Use android.telephony.SmsManager.
+ */
+ @Deprecated
+ public final void sendDataMessage(
+ String destinationAddress, String scAddress, short destinationPort,
+ byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
+ mSmsMgrProxy.sendDataMessage(destinationAddress, scAddress, destinationPort,
+ data, sentIntent, deliveryIntent);
+ }
+
+ /**
+ * Copy a raw SMS PDU to the SIM.
+ *
+ * @param smsc the SMSC for this message, or NULL for the default SMSC
+ * @param pdu the raw PDU to store
+ * @param status message status (STATUS_ON_SIM_READ, STATUS_ON_SIM_UNREAD,
+ * STATUS_ON_SIM_SENT, STATUS_ON_SIM_UNSENT)
+ * @return true for success
+ * @deprecated Use android.telephony.SmsManager.
+ * {@hide}
+ */
+ @Deprecated
+ public final boolean copyMessageToSim(byte[] smsc, byte[] pdu, int status) {
+ return mSmsMgrProxy.copyMessageToIcc(smsc, pdu, status);
+ }
+
+ /**
+ * Delete the specified message from the SIM.
+ *
+ * @param messageIndex is the record index of the message on SIM
+ * @return true for success
+ * @deprecated Use android.telephony.SmsManager.
+ * {@hide}
+ */
+ @Deprecated
+ public final boolean deleteMessageFromSim(int messageIndex) {
+ return mSmsMgrProxy.deleteMessageFromIcc(messageIndex);
+ }
+
+ /**
+ * Update the specified message on the SIM.
+ *
+ * @param messageIndex record index of message to update
+ * @param newStatus new message status (STATUS_ON_SIM_READ,
+ * STATUS_ON_SIM_UNREAD, STATUS_ON_SIM_SENT,
+ * STATUS_ON_SIM_UNSENT, STATUS_ON_SIM_FREE)
+ * @param pdu the raw PDU to store
+ * @return true for success
+ * @deprecated Use android.telephony.SmsManager.
+ * {@hide}
+ */
+ @Deprecated
+ public final boolean updateMessageOnSim(int messageIndex, int newStatus, byte[] pdu) {
+ return mSmsMgrProxy.updateMessageOnIcc(messageIndex, newStatus, pdu);
+ }
+
+ /**
+ * Retrieves all messages currently stored on SIM.
+ * @return ArrayList
of SmsMessage
objects
+ * @deprecated Use android.telephony.SmsManager.
+ * {@hide}
+ */
+ @Deprecated
+ public final ArrayListSubmitPdu
containing the encoded SC
+ * address, if applicable, and the encoded message.
+ * Returns null on encode error.
+ * @deprecated Use android.telephony.SmsMessage.
+ * @hide
+ */
+ @Deprecated
+ public static SubmitPdu getSubmitPdu(String scAddress,
+ String destinationAddress, String message,
+ boolean statusReportRequested, byte[] header) {
+ SubmitPduBase spb;
+ int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
+
+ if (PHONE_TYPE_CDMA == activePhone) {
+ spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, message, statusReportRequested,
+ SmsHeader.fromByteArray(header));
+ } else {
+ spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, message, statusReportRequested, header);
+ }
+
+ return new SubmitPdu(spb);
+ }
+
+ /**
+ * Get an SMS-SUBMIT PDU for a destination address and a message
+ *
+ * @param scAddress Service Centre address. Null means use default.
+ * @return a SubmitPdu
containing the encoded SC
+ * address, if applicable, and the encoded message.
+ * Returns null on encode error.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public static SubmitPdu getSubmitPdu(String scAddress,
+ String destinationAddress, String message, boolean statusReportRequested) {
+ SubmitPduBase spb;
+ int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
+
+ if (PHONE_TYPE_CDMA == activePhone) {
+ spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, message, statusReportRequested, null);
+ } else {
+ spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, message, statusReportRequested);
+ }
+
+ return new SubmitPdu(spb);
+ }
+
+ /**
+ * Get an SMS-SUBMIT PDU for a data message to a destination address & port
+ *
+ * @param scAddress Service Centre address. null == use default
+ * @param destinationAddress the address of the destination for the message
+ * @param destinationPort the port to deliver the message to at the
+ * destination
+ * @param data the dat for the message
+ * @return a SubmitPdu
containing the encoded SC
+ * address, if applicable, and the encoded message.
+ * Returns null on encode error.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public static SubmitPdu getSubmitPdu(String scAddress,
+ String destinationAddress, short destinationPort, byte[] data,
+ boolean statusReportRequested) {
+ SubmitPduBase spb;
+ int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
+
+ if (PHONE_TYPE_CDMA == activePhone) {
+ spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, destinationPort, data, statusReportRequested);
+ } else {
+ spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
+ destinationAddress, destinationPort, data, statusReportRequested);
+ }
+
+ return new SubmitPdu(spb);
+ }
+
+ /**
+ * Returns the address of the SMS service center that relayed this message
+ * or null if there is none.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getServiceCenterAddress() {
+ return mWrappedSmsMessage.getServiceCenterAddress();
+ }
+
+ /**
+ * Returns the originating address (sender) of this SMS message in String
+ * form or null if unavailable
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getOriginatingAddress() {
+ return mWrappedSmsMessage.getOriginatingAddress();
+ }
+
+ /**
+ * Returns the originating address, or email from address if this message
+ * was from an email gateway. Returns null if originating address
+ * unavailable.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getDisplayOriginatingAddress() {
+ return mWrappedSmsMessage.getDisplayOriginatingAddress();
+ }
+
+ /**
+ * Returns the message body as a String, if it exists and is text based.
+ * @return message body is there is one, otherwise null
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getMessageBody() {
+ return mWrappedSmsMessage.getMessageBody();
+ }
+
+ /**
+ * Returns the class of this message.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public MessageClass getMessageClass() {
+ int index = mWrappedSmsMessage.getMessageClass().ordinal();
+
+ return MessageClass.values()[index];
+ }
+
+ /**
+ * Returns the message body, or email message body if this message was from
+ * an email gateway. Returns null if message body unavailable.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getDisplayMessageBody() {
+ return mWrappedSmsMessage.getDisplayMessageBody();
+ }
+
+ /**
+ * Unofficial convention of a subject line enclosed in parens empty string
+ * if not present
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getPseudoSubject() {
+ return mWrappedSmsMessage.getPseudoSubject();
+ }
+
+ /**
+ * Returns the service centre timestamp in currentTimeMillis() format
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public long getTimestampMillis() {
+ return mWrappedSmsMessage.getTimestampMillis();
+ }
+
+ /**
+ * Returns true if message is an email.
+ *
+ * @return true if this message came through an email gateway and email
+ * sender / subject / parsed body are available
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isEmail() {
+ return mWrappedSmsMessage.isEmail();
+ }
+
+ /**
+ * @return if isEmail() is true, body of the email sent through the gateway.
+ * null otherwise
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getEmailBody() {
+ return mWrappedSmsMessage.getEmailBody();
+ }
+
+ /**
+ * @return if isEmail() is true, email from address of email sent through
+ * the gateway. null otherwise
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public String getEmailFrom() {
+ return mWrappedSmsMessage.getEmailFrom();
+ }
+
+ /**
+ * Get protocol identifier.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public int getProtocolIdentifier() {
+ return mWrappedSmsMessage.getProtocolIdentifier();
+ }
+
+ /**
+ * See TS 23.040 9.2.3.9 returns true if this is a "replace short message" SMS
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isReplace() {
+ return mWrappedSmsMessage.isReplace();
+ }
+
+ /**
+ * Returns true for CPHS MWI toggle message.
+ *
+ * @return true if this is a CPHS MWI toggle message See CPHS 4.2 section B.4.2
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isCphsMwiMessage() {
+ return mWrappedSmsMessage.isCphsMwiMessage();
+ }
+
+ /**
+ * returns true if this message is a CPHS voicemail / message waiting
+ * indicator (MWI) clear message
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isMWIClearMessage() {
+ return mWrappedSmsMessage.isMWIClearMessage();
+ }
+
+ /**
+ * returns true if this message is a CPHS voicemail / message waiting
+ * indicator (MWI) set message
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isMWISetMessage() {
+ return mWrappedSmsMessage.isMWISetMessage();
+ }
+
+ /**
+ * returns true if this message is a "Message Waiting Indication Group:
+ * Discard Message" notification and should not be stored.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isMwiDontStore() {
+ return mWrappedSmsMessage.isMwiDontStore();
+ }
+
+ /**
+ * returns the user data section minus the user data header if one was present.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public byte[] getUserData() {
+ return mWrappedSmsMessage.getUserData();
+ }
+
+ /* Not part of the SDK interface and only needed by specific classes:
+ protected SmsHeader getUserDataHeader()
+ */
+
+ /**
+ * Returns the raw PDU for the message.
+ *
+ * @return the raw PDU for the message.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public byte[] getPdu() {
+ return mWrappedSmsMessage.getPdu();
+ }
+
+ /**
+ * Returns the status of the message on the SIM (read, unread, sent, unsent).
+ *
+ * @return the status of the message on the SIM. These are:
+ * SmsManager.STATUS_ON_SIM_FREE
+ * SmsManager.STATUS_ON_SIM_READ
+ * SmsManager.STATUS_ON_SIM_UNREAD
+ * SmsManager.STATUS_ON_SIM_SEND
+ * SmsManager.STATUS_ON_SIM_UNSENT
+ * @deprecated Use android.telephony.SmsMessage and getStatusOnIcc instead.
+ */
+ @Deprecated
+ public int getStatusOnSim() {
+ return mWrappedSmsMessage.getStatusOnIcc();
+ }
+
+ /**
+ * Returns the status of the message on the ICC (read, unread, sent, unsent).
+ *
+ * @return the status of the message on the ICC. These are:
+ * SmsManager.STATUS_ON_ICC_FREE
+ * SmsManager.STATUS_ON_ICC_READ
+ * SmsManager.STATUS_ON_ICC_UNREAD
+ * SmsManager.STATUS_ON_ICC_SEND
+ * SmsManager.STATUS_ON_ICC_UNSENT
+ * @deprecated Use android.telephony.SmsMessage.
+ * @hide
+ */
+ @Deprecated
+ public int getStatusOnIcc() {
+
+ return mWrappedSmsMessage.getStatusOnIcc();
+ }
+
+ /**
+ * Returns the record index of the message on the SIM (1-based index).
+ * @return the record index of the message on the SIM, or -1 if this
+ * SmsMessage was not created from a SIM SMS EF record.
+ * @deprecated Use android.telephony.SmsMessage and getIndexOnIcc instead.
+ */
+ @Deprecated
+ public int getIndexOnSim() {
+ return mWrappedSmsMessage.getIndexOnIcc();
+ }
+
+ /**
+ * Returns the record index of the message on the ICC (1-based index).
+ * @return the record index of the message on the ICC, or -1 if this
+ * SmsMessage was not created from a ICC SMS EF record.
+ * @deprecated Use android.telephony.SmsMessage.
+ * @hide
+ */
+ @Deprecated
+ public int getIndexOnIcc() {
+
+ return mWrappedSmsMessage.getIndexOnIcc();
+ }
+
+ /**
+ * GSM:
+ * For an SMS-STATUS-REPORT message, this returns the status field from
+ * the status report. This field indicates the status of a previously
+ * submitted SMS, if requested. See TS 23.040, 9.2.3.15 TP-Status for a
+ * description of values.
+ * CDMA:
+ * For not interfering with status codes from GSM, the value is
+ * shifted to the bits 31-16.
+ * The value is composed of an error class (bits 25-24) and a status code (bits 23-16).
+ * Possible codes are described in C.S0015-B, v2.0, 4.5.21.
+ *
+ * @return 0 indicates the previously sent message was received.
+ * See TS 23.040, 9.9.2.3.15 and C.S0015-B, v2.0, 4.5.21
+ * for a description of other possible values.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public int getStatus() {
+ return mWrappedSmsMessage.getStatus();
+ }
+
+ /**
+ * Return true iff the message is a SMS-STATUS-REPORT message.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isStatusReportMessage() {
+ return mWrappedSmsMessage.isStatusReportMessage();
+ }
+
+ /**
+ * Returns true iff the TP-Reply-Path
bit is set in
+ * this message.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ @Deprecated
+ public boolean isReplyPathPresent() {
+ return mWrappedSmsMessage.isReplyPathPresent();
+ }
+
+ /** This method returns the reference to a specific
+ * SmsMessage object, which is used for accessing its static methods.
+ * @return Specific SmsMessage.
+ * @deprecated Use android.telephony.SmsMessage.
+ */
+ private static final SmsMessageBase getSmsFacility(){
+ int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
+ if (PHONE_TYPE_CDMA == activePhone) {
+ return new com.android.internal.telephony.cdma.SmsMessage();
+ } else {
+ return new com.android.internal.telephony.gsm.SmsMessage();
+ }
+ }
+}
--
cgit v1.1