diff --git a/mms-common/java/com/android/mmscommon/ContentType.java b/core/java/com/google/android/mms/ContentType.java similarity index 98% rename from mms-common/java/com/android/mmscommon/ContentType.java rename to core/java/com/google/android/mms/ContentType.java index ca449fe2e3653..94bc9fdcd4bf7 100644 --- a/mms-common/java/com/android/mmscommon/ContentType.java +++ b/core/java/com/google/android/mms/ContentType.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon; +package com.google.android.mms; import java.util.ArrayList; @@ -26,7 +26,6 @@ public class ContentType { public static final String MMS_GENERIC = "application/vnd.wap.mms-generic"; public static final String MULTIPART_MIXED = "application/vnd.wap.multipart.mixed"; public static final String MULTIPART_RELATED = "application/vnd.wap.multipart.related"; - public static final String MULTIPART_ALTERNATIVE = "application/vnd.wap.multipart.alternative"; public static final String TEXT_PLAIN = "text/plain"; public static final String TEXT_HTML = "text/html"; diff --git a/mms-common/java/com/android/mmscommon/InvalidHeaderValueException.java b/core/java/com/google/android/mms/InvalidHeaderValueException.java similarity index 97% rename from mms-common/java/com/android/mmscommon/InvalidHeaderValueException.java rename to core/java/com/google/android/mms/InvalidHeaderValueException.java index 34d5871ec87a3..73d78328e257a 100644 --- a/mms-common/java/com/android/mmscommon/InvalidHeaderValueException.java +++ b/core/java/com/google/android/mms/InvalidHeaderValueException.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon; +package com.google.android.mms; /** * Thrown when an invalid header value was set. diff --git a/mms-common/java/com/android/mmscommon/MmsException.java b/core/java/com/google/android/mms/MmsException.java similarity index 98% rename from mms-common/java/com/android/mmscommon/MmsException.java rename to core/java/com/google/android/mms/MmsException.java index 296a2c3460fb2..6ca0c7eab9ac7 100644 --- a/mms-common/java/com/android/mmscommon/MmsException.java +++ b/core/java/com/google/android/mms/MmsException.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon; +package com.google.android.mms; /** * A generic exception that is thrown by the Mms client. diff --git a/core/java/com/google/android/mms/package.html b/core/java/com/google/android/mms/package.html new file mode 100755 index 0000000000000..c9f96a66ab3bc --- /dev/null +++ b/core/java/com/google/android/mms/package.html @@ -0,0 +1,5 @@ +
+ +{@hide} + + diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/AcknowledgeInd.java b/core/java/com/google/android/mms/pdu/AcknowledgeInd.java similarity index 94% rename from mms-common/java/com/android/mmscommon/mms/pdu/AcknowledgeInd.java rename to core/java/com/google/android/mms/pdu/AcknowledgeInd.java index d1243b22b6acd..0e96c60bd096f 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/AcknowledgeInd.java +++ b/core/java/com/google/android/mms/pdu/AcknowledgeInd.java @@ -15,10 +15,9 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; -import com.android.mmscommon.InvalidHeaderValueException; -import com.android.mmscommon.PduHeaders; +import com.google.android.mms.InvalidHeaderValueException; /** * M-Acknowledge.ind PDU. diff --git a/core/java/com/google/android/mms/pdu/Base64.java b/core/java/com/google/android/mms/pdu/Base64.java new file mode 100644 index 0000000000000..604bee0d50fe0 --- /dev/null +++ b/core/java/com/google/android/mms/pdu/Base64.java @@ -0,0 +1,167 @@ +/* + * Copyright (C) 2007 Esmertec AG. + * 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 com.google.android.mms.pdu; + +public class Base64 { + /** + * Used to get the number of Quadruples. + */ + static final int FOURBYTE = 4; + + /** + * Byte used to pad output. + */ + static final byte PAD = (byte) '='; + + /** + * The base length. + */ + static final int BASELENGTH = 255; + + // Create arrays to hold the base64 characters + private static byte[] base64Alphabet = new byte[BASELENGTH]; + + // Populating the character arrays + static { + for (int i = 0; i < BASELENGTH; i++) { + base64Alphabet[i] = (byte) -1; + } + for (int i = 'Z'; i >= 'A'; i--) { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + for (int i = '9'; i >= '0'; i--) { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + } + + /** + * Decodes Base64 data into octects + * + * @param base64Data Byte array containing Base64 data + * @return Array containing decoded data. + */ + public static byte[] decodeBase64(byte[] base64Data) { + // RFC 2045 requires that we discard ALL non-Base64 characters + base64Data = discardNonBase64(base64Data); + + // handle the edge case, so we don't have to worry about it later + if (base64Data.length == 0) { + return new byte[0]; + } + + int numberQuadruple = base64Data.length / FOURBYTE; + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0; + + // Throw away anything not in base64Data + + int encodedIndex = 0; + int dataIndex = 0; + { + // this sizes the output array properly - rlw + int lastData = base64Data.length; + // ignore the '=' padding + while (base64Data[lastData - 1] == PAD) { + if (--lastData == 0) { + return new byte[0]; + } + } + decodedData = new byte[lastData - numberQuadruple]; + } + + for (int i = 0; i < numberQuadruple; i++) { + dataIndex = i * 4; + marker0 = base64Data[dataIndex + 2]; + marker1 = base64Data[dataIndex + 3]; + + b1 = base64Alphabet[base64Data[dataIndex]]; + b2 = base64Alphabet[base64Data[dataIndex + 1]]; + + if (marker0 != PAD && marker1 != PAD) { + //No PAD e.g 3cQl + b3 = base64Alphabet[marker0]; + b4 = base64Alphabet[marker1]; + + decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex + 1] = + (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex + 2] = (byte) (b3 << 6 | b4); + } else if (marker0 == PAD) { + //Two PAD e.g. 3c[Pad][Pad] + decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + } else if (marker1 == PAD) { + //One PAD e.g. 3cQ[Pad] + b3 = base64Alphabet[marker0]; + + decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex + 1] = + (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + } + encodedIndex += 3; + } + return decodedData; + } + + /** + * Check octect wheter it is a base64 encoding. + * + * @param octect to be checked byte + * @return ture if it is base64 encoding, false otherwise. + */ + private static boolean isBase64(byte octect) { + if (octect == PAD) { + return true; + } else if (base64Alphabet[octect] == -1) { + return false; + } else { + return true; + } + } + + /** + * Discards any characters outside of the base64 alphabet, per + * the requirements on page 25 of RFC 2045 - "Any characters + * outside of the base64 alphabet are to be ignored in base64 + * encoded data." + * + * @param data The base-64 encoded data to groom + * @return The data, less non-base64 characters (see RFC 2045). + */ + static byte[] discardNonBase64(byte[] data) { + byte groomedData[] = new byte[data.length]; + int bytesCopied = 0; + + for (int i = 0; i < data.length; i++) { + if (isBase64(data[i])) { + groomedData[bytesCopied++] = data[i]; + } + } + + byte packedData[] = new byte[bytesCopied]; + + System.arraycopy(groomedData, 0, packedData, 0, bytesCopied); + + return packedData; + } +} diff --git a/mms-common/java/com/android/mmscommon/CharacterSets.java b/core/java/com/google/android/mms/pdu/CharacterSets.java similarity index 99% rename from mms-common/java/com/android/mmscommon/CharacterSets.java rename to core/java/com/google/android/mms/pdu/CharacterSets.java index f19b078354852..4e22ca5e2cf82 100644 --- a/mms-common/java/com/android/mmscommon/CharacterSets.java +++ b/core/java/com/google/android/mms/pdu/CharacterSets.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon; +package com.google.android.mms.pdu; import java.io.UnsupportedEncodingException; import java.util.HashMap; diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/DeliveryInd.java b/core/java/com/google/android/mms/pdu/DeliveryInd.java similarity index 95% rename from mms-common/java/com/android/mmscommon/mms/pdu/DeliveryInd.java rename to core/java/com/google/android/mms/pdu/DeliveryInd.java index e83729b8b1090..dafa8d11b871a 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/DeliveryInd.java +++ b/core/java/com/google/android/mms/pdu/DeliveryInd.java @@ -15,11 +15,9 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; -import com.android.mmscommon.EncodedStringValue; -import com.android.mmscommon.InvalidHeaderValueException; -import com.android.mmscommon.PduHeaders; +import com.google.android.mms.InvalidHeaderValueException; /** * M-Delivery.Ind Pdu. diff --git a/mms-common/java/com/android/mmscommon/EncodedStringValue.java b/core/java/com/google/android/mms/pdu/EncodedStringValue.java similarity index 99% rename from mms-common/java/com/android/mmscommon/EncodedStringValue.java rename to core/java/com/google/android/mms/pdu/EncodedStringValue.java index 0a4424e2880af..a27962d41e4de 100644 --- a/mms-common/java/com/android/mmscommon/EncodedStringValue.java +++ b/core/java/com/google/android/mms/pdu/EncodedStringValue.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon; +package com.google.android.mms.pdu; import android.util.Config; import android.util.Log; @@ -269,7 +269,7 @@ public class EncodedStringValue implements Cloneable { return new EncodedStringValue(value.mCharacterSet, value.mData); } - + public static EncodedStringValue[] encodeStrings(String[] array) { int count = array.length; if (count > 0) { diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/GenericPdu.java b/core/java/com/google/android/mms/pdu/GenericPdu.java similarity index 94% rename from mms-common/java/com/android/mmscommon/mms/pdu/GenericPdu.java rename to core/java/com/google/android/mms/pdu/GenericPdu.java index c38e502504ab5..705de6afb8b61 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/GenericPdu.java +++ b/core/java/com/google/android/mms/pdu/GenericPdu.java @@ -15,11 +15,9 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; -import com.android.mmscommon.EncodedStringValue; -import com.android.mmscommon.InvalidHeaderValueException; -import com.android.mmscommon.PduHeaders; +import com.google.android.mms.InvalidHeaderValueException; public class GenericPdu { /** diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/MultimediaMessagePdu.java b/core/java/com/google/android/mms/pdu/MultimediaMessagePdu.java similarity index 94% rename from mms-common/java/com/android/mmscommon/mms/pdu/MultimediaMessagePdu.java rename to core/java/com/google/android/mms/pdu/MultimediaMessagePdu.java index 04fde2d453ec0..5a85e0e79ddc1 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/MultimediaMessagePdu.java +++ b/core/java/com/google/android/mms/pdu/MultimediaMessagePdu.java @@ -15,11 +15,9 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; -import com.android.mmscommon.EncodedStringValue; -import com.android.mmscommon.InvalidHeaderValueException; -import com.android.mmscommon.PduHeaders; +import com.google.android.mms.InvalidHeaderValueException; /** * Multimedia message PDU. diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/NotificationInd.java b/core/java/com/google/android/mms/pdu/NotificationInd.java similarity index 97% rename from mms-common/java/com/android/mmscommon/mms/pdu/NotificationInd.java rename to core/java/com/google/android/mms/pdu/NotificationInd.java index 24f17b09ae7f4..c56cba6d14bfb 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/NotificationInd.java +++ b/core/java/com/google/android/mms/pdu/NotificationInd.java @@ -15,11 +15,9 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; -import com.android.mmscommon.EncodedStringValue; -import com.android.mmscommon.InvalidHeaderValueException; -import com.android.mmscommon.PduHeaders; +import com.google.android.mms.InvalidHeaderValueException; /** * M-Notification.ind PDU. diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/NotifyRespInd.java b/core/java/com/google/android/mms/pdu/NotifyRespInd.java similarity index 96% rename from mms-common/java/com/android/mmscommon/mms/pdu/NotifyRespInd.java rename to core/java/com/google/android/mms/pdu/NotifyRespInd.java index c2e2b26535e32..2cc2fce0812df 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/NotifyRespInd.java +++ b/core/java/com/google/android/mms/pdu/NotifyRespInd.java @@ -15,10 +15,9 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; -import com.android.mmscommon.InvalidHeaderValueException; -import com.android.mmscommon.PduHeaders; +import com.google.android.mms.InvalidHeaderValueException; /** * M-NofifyResp.ind PDU. diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/PduBody.java b/core/java/com/google/android/mms/pdu/PduBody.java similarity index 99% rename from mms-common/java/com/android/mmscommon/mms/pdu/PduBody.java rename to core/java/com/google/android/mms/pdu/PduBody.java index cc28d80eb06bc..fa0416c6be6a8 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/PduBody.java +++ b/core/java/com/google/android/mms/pdu/PduBody.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; import java.util.HashMap; import java.util.Map; diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/PduComposer.java b/core/java/com/google/android/mms/pdu/PduComposer.java similarity index 99% rename from mms-common/java/com/android/mmscommon/mms/pdu/PduComposer.java rename to core/java/com/google/android/mms/pdu/PduComposer.java index bb3116d69ef05..8940945a605a0 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/PduComposer.java +++ b/core/java/com/google/android/mms/pdu/PduComposer.java @@ -15,10 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; - -import com.android.mmscommon.EncodedStringValue; -import com.android.mmscommon.PduHeaders; +package com.google.android.mms.pdu; import android.content.ContentResolver; import android.content.Context; diff --git a/mms-common/java/com/android/mmscommon/mms/pdu/PduContentTypes.java b/core/java/com/google/android/mms/pdu/PduContentTypes.java similarity index 99% rename from mms-common/java/com/android/mmscommon/mms/pdu/PduContentTypes.java rename to core/java/com/google/android/mms/pdu/PduContentTypes.java index 3f971fd98d048..7799e0e834af2 100644 --- a/mms-common/java/com/android/mmscommon/mms/pdu/PduContentTypes.java +++ b/core/java/com/google/android/mms/pdu/PduContentTypes.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.mmscommon.mms.pdu; +package com.google.android.mms.pdu; public class PduContentTypes { /** diff --git a/mms-common/java/com/android/mmscommon/PduHeaders.java b/core/java/com/google/android/mms/pdu/PduHeaders.java similarity index 97% rename from mms-common/java/com/android/mmscommon/PduHeaders.java rename to core/java/com/google/android/mms/pdu/PduHeaders.java index d8f12111bf54c..43138150f8045 100644 --- a/mms-common/java/com/android/mmscommon/PduHeaders.java +++ b/core/java/com/google/android/mms/pdu/PduHeaders.java @@ -15,7 +15,9 @@ * limitations under the License. */ -package com.android.mmscommon; +package com.google.android.mms.pdu; + +import com.google.android.mms.InvalidHeaderValueException; import java.util.ArrayList; import java.util.HashMap; @@ -337,7 +339,7 @@ public class PduHeaders { * with specified header field. Return 0 if * the value is not set. */ - public int getOctet(int field) { + protected int getOctet(int field) { Integer octet = (Integer) mHeaderMap.get(field); if (null == octet) { return 0; @@ -353,7 +355,7 @@ public class PduHeaders { * @param field the field * @throws InvalidHeaderValueException if the value is invalid. */ - public void setOctet(int value, int field) + protected void setOctet(int value, int field) throws InvalidHeaderValueException{ /** * Check whether this field can be set for specific @@ -497,7 +499,7 @@ public class PduHeaders { * @return the TextString value of the pdu header * with specified header field */ - public byte[] getTextString(int field) { + protected byte[] getTextString(int field) { return (byte[]) mHeaderMap.get(field); } @@ -510,7 +512,7 @@ public class PduHeaders { * with specified header field * @throws NullPointerException if the value is null. */ - public void setTextString(byte[] value, int field) { + protected void setTextString(byte[] value, int field) { /** * Check whether this field can be set for specific * header and check validity of the field. @@ -546,7 +548,7 @@ public class PduHeaders { * @return the EncodedStringValue value of the pdu header * with specified header field */ - public EncodedStringValue getEncodedStringValue(int field) { + protected EncodedStringValue getEncodedStringValue(int field) { return (EncodedStringValue) mHeaderMap.get(field); } @@ -557,7 +559,7 @@ public class PduHeaders { * @return the EncodeStringValue array of the pdu header * with specified header field */ - public EncodedStringValue[] getEncodedStringValues(int field) { + protected EncodedStringValue[] getEncodedStringValues(int field) { ArrayListType: INTEGER
- */ - public static final String TYPE = "type"; - - public static final int MESSAGE_TYPE_ALL = 0; - public static final int MESSAGE_TYPE_INBOX = 1; - public static final int MESSAGE_TYPE_SENT = 2; - public static final int MESSAGE_TYPE_DRAFT = 3; - public static final int MESSAGE_TYPE_OUTBOX = 4; - public static final int MESSAGE_TYPE_FAILED = 5; // for failed outgoing messages - public static final int MESSAGE_TYPE_QUEUED = 6; // for messages to send later - - - /** - * The thread ID of the message - *Type: INTEGER
- */ - public static final String THREAD_ID = "thread_id"; - - /** - * The address of the other party - *Type: TEXT
- */ - public static final String ADDRESS = "address"; - - /** - * The person ID of the sender - *Type: INTEGER (long)
- */ - public static final String PERSON_ID = "person"; - - /** - * The date the message was sent - *Type: INTEGER (long)
- */ - public static final String DATE = "date"; - - /** - * 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 TP-Status value for the message, or -1 if no status has - * been received - */ - public static final String STATUS = "status"; - - public static final int STATUS_NONE = -1; - public static final int STATUS_COMPLETE = 0; - public static final int STATUS_PENDING = 64; - public static final int STATUS_FAILED = 128; - - /** - * The subject of the message, if present - *Type: TEXT
- */ - public static final String SUBJECT = "subject"; - - /** - * The body of the message - *Type: TEXT
- */ - public static final String BODY = "body"; - - /** - * The id of the sender of the conversation, if present - *Type: INTEGER (reference to item in content://contacts/people)
- */ - public static final String PERSON = "person"; - - /** - * The protocol identifier code - *Type: INTEGER
- */ - public static final String PROTOCOL = "protocol"; - - /** - * Whether theTP-Reply-Path bit was set on this message
- * Type: BOOLEAN
- */ - public static final String REPLY_PATH_PRESENT = "reply_path_present"; - - /** - * The service center (SC) through which to send the message, if present - *Type: TEXT
- */ - public static final String SERVICE_CENTER = "service_center"; - - /** - * Has the message been locked? - *Type: INTEGER (boolean)
- */ - public static final String LOCKED = "locked"; - - /** - * Error code associated with sending or receiving this message - *Type: INTEGER
- */ - public static final String ERROR_CODE = "error_code"; -} - - /** - * Contains all text based SMS messages. - */ - public static final class Sms implements BaseColumns, TextBasedSmsColumns { - public static final Cursor query(ContentResolver cr, String[] projection) { - return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); - } - - public static final Cursor query(ContentResolver cr, String[] projection, - String where, String orderBy) { - return cr.query(CONTENT_URI, projection, where, - null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); - } - - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the given URI. - * - * @param resolver the content resolver to use - * @param uri the URI to add the message to - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param read true if the message has been read, false if not - * @param deliveryReport true if a delivery report was requested, false if not - * @return the URI for the new message - */ - public static Uri addMessageToUri(ContentResolver resolver, - Uri uri, String address, String body, String subject, - Long date, boolean read, boolean deliveryReport) { - return addMessageToUri(resolver, uri, address, body, subject, - date, read, deliveryReport, -1L); - } - - /** - * Add an SMS to the given URI with thread_id specified. - * - * @param resolver the content resolver to use - * @param uri the URI to add the message to - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param read true if the message has been read, false if not - * @param deliveryReport true if a delivery report was requested, false if not - * @param threadId the thread_id of the message - * @return the URI for the new message - */ - public static Uri addMessageToUri(ContentResolver resolver, - Uri uri, String address, String body, String subject, - Long date, boolean read, boolean deliveryReport, long threadId) { - ContentValues values = new ContentValues(7); - - values.put(ADDRESS, address); - if (date != null) { - values.put(DATE, date); - } - values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0)); - values.put(SUBJECT, subject); - values.put(BODY, body); - if (deliveryReport) { - values.put(STATUS, STATUS_PENDING); - } - if (threadId != -1L) { - values.put(THREAD_ID, threadId); - } - return resolver.insert(uri, values); - } - - /** - * Move a message to the given folder. - * - * @param context the context to use - * @param uri the message to move - * @param folder the folder to move to - * @return true if the operation succeeded - */ - public static boolean moveMessageToFolder(Context context, - Uri uri, int folder, int error) { - if (uri == null) { - return false; - } - - boolean markAsUnread = false; - boolean markAsRead = false; - switch(folder) { - case MESSAGE_TYPE_INBOX: - case MESSAGE_TYPE_DRAFT: - break; - case MESSAGE_TYPE_OUTBOX: - case MESSAGE_TYPE_SENT: - markAsRead = true; - break; - case MESSAGE_TYPE_FAILED: - case MESSAGE_TYPE_QUEUED: - markAsUnread = true; - break; - default: - return false; - } - - ContentValues values = new ContentValues(3); - - values.put(TYPE, folder); - if (markAsUnread) { - values.put(READ, Integer.valueOf(0)); - } else if (markAsRead) { - values.put(READ, Integer.valueOf(1)); - } - values.put(ERROR_CODE, error); - - return 1 == SqliteWrapper.update(context, context.getContentResolver(), - uri, values, null, null); - } - - /** - * Returns true iff the folder (message type) identifies an - * outgoing message. - */ - public static boolean isOutgoingFolder(int messageType) { - return (messageType == MESSAGE_TYPE_FAILED) - || (messageType == MESSAGE_TYPE_OUTBOX) - || (messageType == MESSAGE_TYPE_SENT) - || (messageType == MESSAGE_TYPE_QUEUED); - } - - /** - * Contains all text based SMS messages in the SMS app's inbox. - */ - public static final class Inbox implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/inbox"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Draft box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param read true if the message has been read, false if not - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date, - boolean read) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, read, false); - } - } - - /** - * Contains all sent text based SMS messages in the SMS app's. - */ - public static final class Sent implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/sent"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Draft box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, true, false); - } - } - - /** - * Contains all sent text based SMS messages in the SMS app's. - */ - public static final class Draft implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/draft"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Draft box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, true, false); - } - - /** - * Save over an existing draft message. - * - * @param resolver the content resolver to use - * @param uri of existing message - * @param body the new body for the draft message - * @return true is successful, false otherwise - */ - public static boolean saveMessage(ContentResolver resolver, - Uri uri, String body) { - ContentValues values = new ContentValues(2); - values.put(BODY, body); - values.put(DATE, System.currentTimeMillis()); - return resolver.update(uri, values, null, null) == 1; - } - } - - /** - * Contains all pending outgoing text based SMS messages. - */ - public static final class Outbox implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/outbox"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * Add an SMS to the Out box. - * - * @param resolver the content resolver to use - * @param address the address of the sender - * @param body the body of the message - * @param subject the psuedo-subject of the message - * @param date the timestamp for the message - * @param deliveryReport whether a delivery report was requested for the message - * @return the URI for the new message - */ - public static Uri addMessage(ContentResolver resolver, - String address, String body, String subject, Long date, - boolean deliveryReport, long threadId) { - return addMessageToUri(resolver, CONTENT_URI, address, body, - subject, date, true, deliveryReport, threadId); - } - } - - /** - * Contains all sent text-based SMS messages in the SMS app's. - */ - public static final class Conversations - implements BaseColumns, TextBasedSmsColumns { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = - Uri.parse("content://sms/conversations"); - - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "date DESC"; - - /** - * The first 45 characters of the body of the message - *Type: TEXT
- */ - public static final String SNIPPET = "snippet"; - - /** - * The number of messages in the conversation - *Type: INTEGER
- */ - public static final String MESSAGE_COUNT = "msg_count"; - } - - /** - * Contains info about SMS related Intents that are broadcast. - */ - public static final class Intents { - /** - * Set by BroadcastReceiver. Indicates the message was handled - * successfully. - */ - public static final int RESULT_SMS_HANDLED = 1; - - /** - * Set by BroadcastReceiver. Indicates a generic error while - * processing the message. - */ - public static final int RESULT_SMS_GENERIC_ERROR = 2; - - /** - * Set by BroadcastReceiver. Indicates insufficient memory to store - * the message. - */ - public static final int RESULT_SMS_OUT_OF_MEMORY = 3; - - /** - * Set by BroadcastReceiver. Indicates the message, while - * possibly valid, is of a format or encoding that is not - * supported. - */ - public static final int RESULT_SMS_UNSUPPORTED = 4; - - /** - * Broadcast Action: A new text 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.
- */ - 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.
- */ - 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.
- */ - public static final String WAP_PUSH_RECEIVED_ACTION = - "android.provider.Telephony.WAP_PUSH_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. - */ - 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.- * Requires the READ_PHONE_STATE permission. - * - *
This is a protected intent that can only be sent - * by the system. - */ - public static final String ACTION_SERVICE_STATE_CHANGED = - "android.intent.action.SERVICE_STATE"; - - /** - * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a - * {@link #DATA_SMS_RECEIVED_ACTION} intent. - * - * @param intent the intent to read from - * @return an array of SmsMessages for the PDUs - */ - public static final SmsMessage[] getMessagesFromIntent( - Intent intent) { - Object[] messages = (Object[]) intent.getSerializableExtra("pdus"); - byte[][] pduObjs = new byte[messages.length][]; - - for (int i = 0; i < messages.length; i++) { - pduObjs[i] = (byte[]) messages[i]; - } - byte[][] pdus = new byte[pduObjs.length][]; - int pduCount = pdus.length; - SmsMessage[] msgs = new SmsMessage[pduCount]; - for (int i = 0; i < pduCount; i++) { - pdus[i] = pduObjs[i]; - msgs[i] = SmsMessage.createFromPdu(pdus[i]); - } - return msgs; - } - } - } - - /** - * Base columns for tables that contain MMSs. - */ - public interface BaseMmsColumns extends BaseColumns { - - public static final int MESSAGE_BOX_ALL = 0; - public static final int MESSAGE_BOX_INBOX = 1; - public static final int MESSAGE_BOX_SENT = 2; - public static final int MESSAGE_BOX_DRAFTS = 3; - public static final int MESSAGE_BOX_OUTBOX = 4; - - /** - * The date the message was sent. - *
Type: INTEGER (long)
- */ - public static final String DATE = "date"; - - /** - * 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"; - } - - /** - * 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 ScrapSpace { - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = Uri.parse("content://mms/scrapSpace"); - - /** - * This is the scrap file we use to store the media attachment when the user - * chooses to capture a photo to be attached . We pass {#link@Uri} to the Camera app, - * which streams the captured image to the uri. Internally we write the media content - * to this file. It's named '.temp.jpg' so Gallery won't pick it up. - */ - public static final String SCRAP_FILE_PATH = "/sdcard/mms/scrapSpace/.temp.jpg"; - } - - 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 CURRENT = "current"; - } - - public static final class Intents { - private Intents() { - // Not instantiable - } - - /** - * Broadcast Action: A "secret code" has been entered in the dialer. Secret codes are - * of the form *#*##*#*. The intent will have the data URI:
- *
- * android_secret_code://<code>
- */
- public static final String SECRET_CODE_ACTION =
- "android.provider.Telephony.SECRET_CODE";
-
- /**
- * Broadcast Action: The Service Provider string(s) have been updated. Activities or
- * services that use these strings should update their display.
- * The intent will have the following extra values:
- *
- * - showPlmn - Boolean that indicates whether the PLMN should be shown.
- * - plmn - The operator name of the registered network, as a string.
- * - showSpn - Boolean that indicates whether the SPN should be shown.
- * - spn - The service provider name, as a string.
- *
- * Note that showPlmn may indicate that plmn should be displayed, even
- * though the value for plmn is null. This can happen, for example, if the phone
- * has not registered to a network yet. In this case the receiver may substitute an
- * appropriate placeholder string (eg, "No service").
- *
- * It is recommended to display plmn before / above spn if
- * both are displayed.
- *
- * Note this is a protected intent that can only be sent
- * by the system.
- */
- public static final String SPN_STRINGS_UPDATED_ACTION =
- "android.provider.Telephony.SPN_STRINGS_UPDATED";
-
- public static final String EXTRA_SHOW_PLMN = "showPlmn";
- public static final String EXTRA_PLMN = "plmn";
- public static final String EXTRA_SHOW_SPN = "showSpn";
- public static final String EXTRA_SPN = "spn";
- }
-}