Automated import from //branches/master/...@141740,141740
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java
index d802c14..c8f8b40 100644
--- a/core/java/android/provider/Telephony.java
+++ b/core/java/android/provider/Telephony.java
@@ -233,18 +233,37 @@
*/
public static boolean moveMessageToFolder(Context context,
Uri uri, int folder) {
- if ((uri == null) || ((folder != MESSAGE_TYPE_INBOX)
- && (folder != MESSAGE_TYPE_OUTBOX)
- && (folder != MESSAGE_TYPE_SENT)
- && (folder != MESSAGE_TYPE_DRAFT)
- && (folder != MESSAGE_TYPE_FAILED)
- && (folder != MESSAGE_TYPE_QUEUED))) {
+ 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(1);
+ ContentValues values = new ContentValues(2);
values.put(TYPE, folder);
+ if (markAsUnread) {
+ values.put(READ, Integer.valueOf(0));
+ } else if (markAsRead) {
+ values.put(READ, Integer.valueOf(1));
+ }
+
return 1 == SqliteWrapper.update(context, context.getContentResolver(),
uri, values, null, null);
}