blob: 18c50448aec2f7db17e75c01c28d6433da463bbd [file] [log] [blame]
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -08001/*******************************************************************************
2 * Copyright (C) 2011 Google Inc.
3 * Licensed to The Android Open Source Project.
Mindy Pereira6f92de62011-12-19 11:31:48 -08004 *
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -08005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Mindy Pereira6f92de62011-12-19 11:31:48 -08008 *
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -08009 * http://www.apache.org/licenses/LICENSE-2.0
Mindy Pereira6f92de62011-12-19 11:31:48 -080010 *
Vikram Aggarwal4f9a4c52012-01-11 15:04:55 -080011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
Mindy Pereira6f92de62011-12-19 11:31:48 -080017
Andy Huang30e2c242012-01-06 18:14:30 -080018package com.android.mail.providers;
Mindy Pereira6f92de62011-12-19 11:31:48 -080019
Paul Westbrook334e64a2012-02-23 13:26:35 -080020import android.content.ContentProvider;
21import android.content.ContentValues;
Mindy Pereira82cc5662012-01-09 17:29:30 -080022import android.content.Context;
Mindy Pereira6f92de62011-12-19 11:31:48 -080023import android.provider.BaseColumns;
Mindy Pereira82cc5662012-01-09 17:29:30 -080024import android.text.TextUtils;
Paul Westbrook334e64a2012-02-23 13:26:35 -080025import android.net.Uri;
Mindy Pereira82cc5662012-01-09 17:29:30 -080026
27import com.android.common.contacts.DataUsageStatUpdater;
Mindy Pereira6f92de62011-12-19 11:31:48 -080028
Paul Westbrook334e64a2012-02-23 13:26:35 -080029import java.lang.String;
Mindy Pereira82cc5662012-01-09 17:29:30 -080030import java.util.ArrayList;
Paul Westbrook82ea6da2011-12-15 11:03:51 -080031
Mindy Pereira6f92de62011-12-19 11:31:48 -080032
33public class UIProvider {
Mindy Pereira82cc5662012-01-09 17:29:30 -080034 public static final String EMAIL_SEPARATOR = "\n";
Mindy Pereira326c6602012-01-04 15:32:42 -080035 public static final long INVALID_CONVERSATION_ID = -1;
36 public static final long INVALID_MESSAGE_ID = -1;
37
Marc Blank9ace18a2012-02-21 16:34:07 -080038 /**
39 * Values for the current state of a Folder/Account; note that it's possible that more than one
40 * sync is in progress
41 */
42 public static final class SyncStatus {
43 // No sync in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080044 public static final int NO_SYNC = 0;
Marc Blank9ace18a2012-02-21 16:34:07 -080045 // A user-requested sync/refresh is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080046 public static final int USER_REFRESH = 1<<0;
Marc Blank9ace18a2012-02-21 16:34:07 -080047 // A user-requested query is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080048 public static final int USER_QUERY = 1<<1;
Marc Blank9ace18a2012-02-21 16:34:07 -080049 // A user request for additional results is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080050 public static final int USER_MORE_RESULTS = 1<<2;
Marc Blank9ace18a2012-02-21 16:34:07 -080051 // A background sync is in progress
Paul Westbrookc808fac2012-02-22 16:42:18 -080052 public static final int BACKGROUND_SYNC = 1<<3;
Marc Blank9ace18a2012-02-21 16:34:07 -080053 }
54
55 /**
56 * Values for the result of the last attempted sync of a Folder/Account
57 */
58 public static final class LastSyncResult {
59 // The sync completed successfully
60 public static final int SUCCESS = 0;
61 // The sync wasn't completed due to a connection error
62 public static final int CONNECTION_ERROR = 1;
63 // The sync wasn't completed due to an authentication error
64 public static final int AUTH_ERROR = 2;
65 // The sync wasn't completed due to a security error
66 public static final int SECURITY_ERROR = 3;
67 // The sync wasn't completed due to a low memory condition
68 public static final int STORAGE_ERROR = 4;
69 // The sync wasn't completed due to an internal error/exception
70 public static final int INTERNAL_ERROR = 5;
71 }
72
Paul Westbrook82ea6da2011-12-15 11:03:51 -080073 // The actual content provider should define its own authority
Andy Huang30e2c242012-01-06 18:14:30 -080074 public static final String AUTHORITY = "com.android.mail.providers";
Mindy Pereira6f92de62011-12-19 11:31:48 -080075
76 public static final String ACCOUNT_LIST_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080077 "vnd.android.cursor.dir/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080078 public static final String ACCOUNT_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -080079 "vnd.android.cursor.item/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -080080
81 public static final String[] ACCOUNTS_PROJECTION = {
82 BaseColumns._ID,
83 AccountColumns.NAME,
84 AccountColumns.PROVIDER_VERSION,
85 AccountColumns.URI,
86 AccountColumns.CAPABILITIES,
87 AccountColumns.FOLDER_LIST_URI,
88 AccountColumns.SEARCH_URI,
89 AccountColumns.ACCOUNT_FROM_ADDRESSES_URI,
Mindy Pereira33fe9082012-01-09 16:24:30 -080090 AccountColumns.SAVE_DRAFT_URI,
Mindy Pereira7ed1c112012-01-18 10:59:25 -080091 AccountColumns.SEND_MAIL_URI,
Mindy Pereira96b5c352012-02-01 11:33:40 -080092 AccountColumns.EXPUNGE_MESSAGE_URI,
Mindy Pereira9600dac2012-02-17 15:59:25 -080093 AccountColumns.UNDO_URI,
Marc Blank9ace18a2012-02-21 16:34:07 -080094 AccountColumns.SETTINGS_INTENT_URI,
95 AccountColumns.SYNC_STATUS
Mindy Pereira6f92de62011-12-19 11:31:48 -080096 };
97
Mindy Pereira33fe9082012-01-09 16:24:30 -080098 public static final int ACCOUNT_ID_COLUMN = 0;
99 public static final int ACCOUNT_NAME_COLUMN = 1;
100 public static final int ACCOUNT_PROVIDER_VERISON_COLUMN = 2;
101 public static final int ACCOUNT_URI_COLUMN = 3;
102 public static final int ACCOUNT_CAPABILITIES_COLUMN = 4;
103 public static final int ACCOUNT_FOLDER_LIST_URI_COLUMN = 5;
104 public static final int ACCOUNT_SEARCH_URI_COLUMN = 6;
105 public static final int ACCOUNT_FROM_ADDRESSES_URI_COLUMN = 7;
106 public static final int ACCOUNT_SAVE_DRAFT_URI_COLUMN = 8;
107 public static final int ACCOUNT_SEND_MESSAGE_URI_COLUMN = 9;
Mindy Pereira82cc5662012-01-09 17:29:30 -0800108 public static final int ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN = 10;
Mindy Pereira96b5c352012-02-01 11:33:40 -0800109 public static final int ACCOUNT_UNDO_URI_COLUMN = 11;
Marc Blank9ace18a2012-02-21 16:34:07 -0800110 public static final int ACCOUNT_SETTINGS_INTENT_URI_COLUMN = 12;
111 public static final int ACCOUNT_SYNC_STATUS_COLUMN = 13;
Mindy Pereira33fe9082012-01-09 16:24:30 -0800112
Mindy Pereira6f92de62011-12-19 11:31:48 -0800113 public static final class AccountCapabilities {
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800114 /**
115 * Whether folders can be synchronized back to the server.
116 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800117 public static final int SYNCABLE_FOLDERS = 0x0001;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800118 /**
119 * Whether the server allows reporting spam back.
120 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800121 public static final int REPORT_SPAM = 0x0002;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800122 /**
123 * Whether the server supports a concept of Archive: removing mail from the Inbox but
124 * keeping it around.
125 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800126 public static final int ARCHIVE = 0x0004;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800127 /**
128 * Whether the server will stop notifying on updates to this thread? This requires
129 * THREADED_CONVERSATIONS to be true, otherwise it should be ignored.
130 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800131 public static final int MUTE = 0x0008;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800132 /**
133 * Whether the server supports searching over all messages. This requires SYNCABLE_FOLDERS
134 * to be true, otherwise it should be ignored.
135 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800136 public static final int SERVER_SEARCH = 0x0010;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800137 /**
138 * Whether the server supports constraining search to a single folder. Requires
139 * SYNCABLE_FOLDERS, otherwise it should be ignored.
140 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800141 public static final int FOLDER_SERVER_SEARCH = 0x0020;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800142 /**
143 * Whether the server sends us sanitized HTML (guaranteed to not contain malicious HTML).
144 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800145 public static final int SANITIZED_HTML = 0x0040;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800146 /**
147 * Whether the server allows synchronization of draft messages. This does NOT require
148 * SYNCABLE_FOLDERS to be set.
149 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800150 public static final int DRAFT_SYNCHRONIZATION = 0x0080;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800151 /**
152 * Does the server allow the user to compose mails (and reply) using addresses other than
153 * their account name? For instance, GMail allows users to set FROM addresses that are
154 * different from account@gmail.com address. For instance, user@gmail.com could have another
155 * FROM: address like user@android.com. If the user has enabled multiple FROM address, he
156 * can compose (and reply) using either address.
157 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800158 public static final int MULTIPLE_FROM_ADDRESSES = 0x0100;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800159 /**
160 * Whether the server allows the original message to be included in the reply by setting a
161 * flag on the reply. If we can avoid including the entire previous message, we save on
162 * bandwidth (replies are shorter).
163 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800164 public static final int SMART_REPLY = 0x0200;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800165 /**
166 * Does this account support searching locally, on the device? This requires the backend
167 * storage to support a mechanism for searching.
168 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800169 public static final int LOCAL_SEARCH = 0x0400;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800170 /**
171 * Whether the server supports a notion of threaded conversations: where replies to messages
172 * are tagged to keep conversations grouped. This could be full threading (each message
173 * lists its parent) or conversation-level threading (each message lists one conversation
174 * which it belongs to)
175 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800176 public static final int THREADED_CONVERSATIONS = 0x0800;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800177 /**
178 * Whether the server supports allowing a conversation to be in multiple folders. (Or allows
179 * multiple labels on a single conversation, since labels and folders are interchangeable
180 * in this application.)
181 */
Mindy Pereira84648892012-02-03 08:29:55 -0800182 public static final int MULTIPLE_FOLDERS_PER_CONV = 0x1000;
Mindy Pereira343ffeb2012-02-22 10:12:14 -0800183 /**
184 * Whether the provider supports undoing operations. If it doesn't, never show the undo bar.
185 */
186 public static final int UNDO = 0x2000;
Mindy Pereira6f92de62011-12-19 11:31:48 -0800187 }
188
189 public static final class AccountColumns {
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800190 /**
191 * This string column contains the human visible name for the account.
192 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800193 public static final String NAME = "name";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800194
195 /**
196 * This integer column returns the version of the UI provider schema from which this
197 * account provider will return results.
198 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800199 public static final String PROVIDER_VERSION = "providerVersion";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800200
201 /**
202 * This string column contains the uri to directly access the information for this account.
203 */
Mindy Pereira6349a042012-01-04 11:25:01 -0800204 public static final String URI = "accountUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800205
206 /**
207 * This integer column contains a bit field of the possible cabibilities that this account
208 * supports.
209 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800210 public static final String CAPABILITIES = "capabilities";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800211
212 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800213 * This string column contains the content provider uri to return the
214 * list of top level folders for this account.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800215 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800216 public static final String FOLDER_LIST_URI = "folderListUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800217
218 /**
219 * This string column contains the content provider uri that can be queried for search
220 * results.
221 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800222 public static final String SEARCH_URI = "searchUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800223
224 /**
225 * This string column contains the content provider uri that can be queried to access the
226 * from addresses for this account.
227 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800228 public static final String ACCOUNT_FROM_ADDRESSES_URI = "accountFromAddressesUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800229
230 /**
231 * This string column contains the content provider uri that can be used to save (insert)
Mindy Pereira82cc5662012-01-09 17:29:30 -0800232 * new draft messages for this account. NOTE: This might be better to
233 * be an update operation on the messageUri.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800234 */
Mindy Pereira33fe9082012-01-09 16:24:30 -0800235 public static final String SAVE_DRAFT_URI = "saveDraftUri";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800236
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800237 /**
238 * This string column contains the content provider uri that can be used to send
239 * a message for this account.
240 * NOTE: This might be better to be an update operation on the messageUri.
241 */
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800242 public static final String SEND_MAIL_URI = "sendMailUri";
Mindy Pereira82cc5662012-01-09 17:29:30 -0800243
244 /**
245 * This string column contains the content provider uri that can be used
246 * to expunge a message from this account. NOTE: This might be better to
247 * be an update operation on the messageUri.
248 */
249 public static final String EXPUNGE_MESSAGE_URI = "expungeMessageUri";
Mindy Pereira96b5c352012-02-01 11:33:40 -0800250
251 /**
252 * This string column contains the content provider uri that can be used
253 * to undo the last committed action.
254 */
Mindy Pereira9600dac2012-02-17 15:59:25 -0800255 public static final String UNDO_URI = "undoUri";
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800256
257 /**
Paul Westbrook9912eee2012-02-22 14:49:03 -0800258 * Uri for EDIT intent that will cause the settings screens for this account type to be
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800259 * shown.
260 * TODO: When we want to support a heterogeneous set of account types, this value may need
261 * to be moved to a global content provider.
262 */
263 public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri";
Marc Blank9ace18a2012-02-21 16:34:07 -0800264
265 /**
266 * This int column contains the current sync status of the account (the logical AND of the
267 * sync status of folders in this account)
268 */
269 public static final String SYNC_STATUS = "syncStatus";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800270 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800271
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800272 // We define a "folder" as anything that contains a list of conversations.
273 public static final String FOLDER_LIST_TYPE =
274 "vnd.android.cursor.dir/vnd.com.android.mail.folder";
275 public static final String FOLDER_TYPE =
Mindy Pereira750cc732011-12-21 13:32:29 -0800276 "vnd.android.cursor.item/vnd.com.android.mail.folder";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800277
278 public static final String[] FOLDERS_PROJECTION = {
279 BaseColumns._ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800280 FolderColumns.URI,
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800281 FolderColumns.NAME,
Mindy Pereira750cc732011-12-21 13:32:29 -0800282 FolderColumns.HAS_CHILDREN,
Mindy Pereira0973b202011-12-21 15:48:12 -0800283 FolderColumns.CAPABILITIES,
Mindy Pereira0973b202011-12-21 15:48:12 -0800284 FolderColumns.SYNC_WINDOW,
Mindy Pereira750cc732011-12-21 13:32:29 -0800285 FolderColumns.CONVERSATION_LIST_URI,
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800286 FolderColumns.CHILD_FOLDERS_LIST_URI,
287 FolderColumns.UNREAD_COUNT,
Marc Blankc8a99422012-01-19 14:27:47 -0800288 FolderColumns.TOTAL_COUNT,
Mindy Pereira77528642012-02-17 15:51:10 -0800289 FolderColumns.REFRESH_URI,
Marc Blank9ace18a2012-02-21 16:34:07 -0800290 FolderColumns.SYNC_STATUS,
291 FolderColumns.LAST_SYNC_RESULT
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800292 };
293
Mindy Pereira818143e2012-01-11 13:59:49 -0800294 public static final int FOLDER_ID_COLUMN = 0;
295 public static final int FOLDER_URI_COLUMN = 1;
296 public static final int FOLDER_NAME_COLUMN = 2;
297 public static final int FOLDER_HAS_CHILDREN_COLUMN = 3;
298 public static final int FOLDER_CAPABILITIES_COLUMN = 4;
Mindy Pereira621b4bd2012-02-23 13:48:50 -0800299 public static final int FOLDER_SYNC_WINDOW_COLUMN = 5;
300 public static final int FOLDER_CONVERSATION_LIST_URI_COLUMN = 6;
301 public static final int FOLDER_CHILD_FOLDERS_LIST_COLUMN = 7;
302 public static final int FOLDER_UNREAD_COUNT_COLUMN = 8;
303 public static final int FOLDER_TOTAL_COUNT_COLUMN = 9;
304 public static final int FOLDER_REFRESH_URI_COLUMN = 10;
305 public static final int FOLDER_SYNC_STATUS_COLUMN = 11;
306 public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 12;
Mindy Pereira818143e2012-01-11 13:59:49 -0800307
Mindy Pereira0973b202011-12-21 15:48:12 -0800308 public static final class FolderCapabilities {
309 public static final int SYNCABLE = 0x0001;
310 public static final int PARENT = 0x0002;
311 public static final int CAN_HOLD_MAIL = 0x0004;
312 public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008;
Paul Westbrook334e64a2012-02-23 13:26:35 -0800313 /**
314 * For accounts that support archive, this will indicate that this folder supports
315 * the archive functionality.
316 */
317 public static final int ARCHIVE = 0x0010;
318
319 /**
320 * For accounts that support report spam, this will indicate that this folder supports
321 * the report spam functionality.
322 */
323 public static final int REPORT_SPAM = 0x0020;
324
325 /**
326 * For accounts that support mute, this will indicate if a mute is performed from within
327 * this folder, the action is destructive.
328 */
329 public static final int DESTRUCTIVE_MUTE = 0x0040;
Mindy Pereira0973b202011-12-21 15:48:12 -0800330 }
331
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800332 public static final class FolderColumns {
Mindy Pereira77528642012-02-17 15:51:10 -0800333 public static final String URI = "folderUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800334 /**
335 * This string column contains the human visible name for the folder.
336 */
337 public static final String NAME = "name";
338 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800339 * This int column represents the capabilities of the folder specified by
340 * FolderCapabilities flags.
341 */
342 public static String CAPABILITIES = "capabilities";
343 /**
Mindy Pereirafc2277e2012-01-11 10:23:44 -0800344 * This int column represents whether or not this folder has any
Mindy Pereira750cc732011-12-21 13:32:29 -0800345 * child folders.
346 */
347 public static String HAS_CHILDREN = "hasChildren";
348 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800349 * This int column represents how large the sync window is.
350 */
351 public static String SYNC_WINDOW = "syncWindow";
352 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800353 * This string column contains the content provider uri to return the
354 * list of conversations for this folder.
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800355 */
356 public static final String CONVERSATION_LIST_URI = "conversationListUri";
Mindy Pereira750cc732011-12-21 13:32:29 -0800357 /**
358 * This string column contains the content provider uri to return the
359 * list of child folders of this folder.
360 */
Mindy Pereira77528642012-02-17 15:51:10 -0800361 public static final String CHILD_FOLDERS_LIST_URI = "childFoldersListUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800362
Mindy Pereira77528642012-02-17 15:51:10 -0800363 public static final String UNREAD_COUNT = "unreadCount";
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800364
Mindy Pereira77528642012-02-17 15:51:10 -0800365 public static final String TOTAL_COUNT = "totalCount";
Mindy Pereira9c002102012-02-17 14:45:58 -0800366 /**
367 * This string column contains the content provider uri to force a
368 * refresh of this folder.
369 */
Mindy Pereira77528642012-02-17 15:51:10 -0800370 public static final String REFRESH_URI = "refreshUri";
371 /**
Marc Blank9ace18a2012-02-21 16:34:07 -0800372 * This int column contains current sync status of the folder; some combination of the
373 * SyncStatus bits defined above
Mindy Pereira77528642012-02-17 15:51:10 -0800374 */
Marc Blank9ace18a2012-02-21 16:34:07 -0800375 public static final String SYNC_STATUS = "syncStatus";
376 /**
377 * This int column contains the sync status of the last sync attempt; one of the
378 * LastSyncStatus values defined above
379 */
380 public static final String LAST_SYNC_RESULT = "lastSyncResult";
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800381
Vikram Aggarwalff7d02a2012-01-11 16:37:45 -0800382 public FolderColumns() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800383 }
384
Mindy Pereiraa1406072011-12-22 10:54:06 -0800385 // We define a "folder" as anything that contains a list of conversations.
386 public static final String CONVERSATION_LIST_TYPE =
387 "vnd.android.cursor.dir/vnd.com.android.mail.conversation";
388 public static final String CONVERSATION_TYPE =
389 "vnd.android.cursor.item/vnd.com.android.mail.conversation";
390
Mindy Pereira9cdc4062012-02-02 14:18:08 -0800391
Mindy Pereiraa1406072011-12-22 10:54:06 -0800392 public static final String[] CONVERSATION_PROJECTION = {
393 BaseColumns._ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800394 ConversationColumns.URI,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800395 ConversationColumns.MESSAGE_LIST_URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800396 ConversationColumns.SUBJECT,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800397 ConversationColumns.SNIPPET,
398 ConversationColumns.SENDER_INFO,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800399 ConversationColumns.DATE_RECEIVED_MS,
Mindy Pereira4db59c52012-01-12 09:45:13 -0800400 ConversationColumns.HAS_ATTACHMENTS,
401 ConversationColumns.NUM_MESSAGES,
402 ConversationColumns.NUM_DRAFTS,
403 ConversationColumns.SENDING_STATE,
Marc Blankc8a99422012-01-19 14:27:47 -0800404 ConversationColumns.PRIORITY,
405 ConversationColumns.READ,
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800406 ConversationColumns.STARRED,
407 ConversationColumns.FOLDER_LIST
Mindy Pereiraa1406072011-12-22 10:54:06 -0800408 };
409
Mindy Pereirafdd984b2011-12-29 09:43:45 -0800410 // These column indexes only work when the caller uses the
411 // default CONVERSATION_PROJECTION defined above.
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -0800412 public static final int CONVERSATION_ID_COLUMN = 0;
Mindy Pereira3263fa92012-01-04 10:15:32 -0800413 public static final int CONVERSATION_URI_COLUMN = 1;
414 public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2;
415 public static final int CONVERSATION_SUBJECT_COLUMN = 3;
416 public static final int CONVERSATION_SNIPPET_COLUMN = 4;
417 public static final int CONVERSATION_SENDER_INFO_COLUMN = 5;
418 public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6;
419 public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800420 public static final int CONVERSATION_NUM_MESSAGES_COLUMN = 8;
421 public static final int CONVERSATION_NUM_DRAFTS_COLUMN = 9;
422 public static final int CONVERSATION_SENDING_STATE_COLUMN = 10;
423 public static final int CONVERSATION_PRIORITY_COLUMN = 11;
Marc Blankc8a99422012-01-19 14:27:47 -0800424 public static final int CONVERSATION_READ_COLUMN = 12;
425 public static final int CONVERSATION_STARRED_COLUMN = 13;
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800426 public static final int CONVERSATION_FOLDER_LIST_COLUMN = 14;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800427
428 public static final class ConversationSendingState {
Mindy Pereiraa4571372012-01-12 14:04:21 -0800429 public static final int OTHER = 0;
430 public static final int SENDING = 1;
431 public static final int SENT = 2;
Mindy Pereira4db59c52012-01-12 09:45:13 -0800432 public static final int SEND_ERROR = -1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800433 }
Mindy Pereira4db59c52012-01-12 09:45:13 -0800434
435 public static final class ConversationPriority {
436 public static final int LOW = 0;
437 public static final int HIGH = 1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800438 }
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -0800439
Marc Blankc8a99422012-01-19 14:27:47 -0800440 public static final class ConversationFlags {
441 public static final int READ = 1<<0;
442 public static final int STARRED = 1<<1;
443 public static final int REPLIED = 1<<2;
444 public static final int FORWARDED = 1<<3;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800445 }
Marc Blankc8a99422012-01-19 14:27:47 -0800446
Mindy Pereiraa1406072011-12-22 10:54:06 -0800447 public static final class ConversationColumns {
Mindy Pereira6349a042012-01-04 11:25:01 -0800448 public static final String URI = "conversationUri";
Mindy Pereiraa1406072011-12-22 10:54:06 -0800449 /**
Mindy Pereiraa1406072011-12-22 10:54:06 -0800450 * This string column contains the content provider uri to return the
451 * list of messages for this conversation.
452 */
453 public static final String MESSAGE_LIST_URI = "messageListUri";
Mindy Pereira27a0cf02011-12-22 13:16:32 -0800454 /**
455 * This string column contains the subject string for a conversation.
456 */
457 public static final String SUBJECT = "subject";
458 /**
459 * This string column contains the snippet string for a conversation.
460 */
461 public static final String SNIPPET = "snippet";
462 /**
463 * This string column contains the sender info string for a
464 * conversation.
465 */
466 public static final String SENDER_INFO = "senderInfo";
467 /**
468 * This long column contains the time in ms of the latest update to a
469 * conversation.
470 */
471 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
472
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800473 /**
474 * This boolean column contains whether any messages in this conversation
475 * have attachments.
476 */
477 public static final String HAS_ATTACHMENTS = "hasAttachments";
478
Mindy Pereira4db59c52012-01-12 09:45:13 -0800479 /**
480 * This int column contains the number of messages in this conversation.
481 * For unthreaded, this will always be 1.
482 */
483 public static String NUM_MESSAGES = "numMessages";
484
485 /**
486 * This int column contains the number of drafts associated with this
487 * conversation.
488 */
489 public static String NUM_DRAFTS = "numDrafts";
490
491 /**
492 * This int column contains the state of drafts and replies associated
493 * with this conversation. Use ConversationSendingState to interpret
494 * this field.
495 */
496 public static String SENDING_STATE = "sendingState";
497
498 /**
499 * This int column contains the priority of this conversation. Use
500 * ConversationPriority to interpret this field.
501 */
502 public static String PRIORITY = "priority";
503
Marc Blankc8a99422012-01-19 14:27:47 -0800504 /**
505 * This boolean column indicates whether the conversation has been read
506 */
507 public static String READ = "read";
508
509 /**
510 * This boolean column indicates whether the conversation has been read
511 */
512 public static String STARRED = "starred";
513
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800514 /**
515 * This string column contains a csv of all folders associated with this
516 * conversation
517 */
518 public static final String FOLDER_LIST = "folderList";
519
Paul Westbrook334e64a2012-02-23 13:26:35 -0800520 private ConversationColumns() {
Andy Huang732600e2012-01-10 17:47:17 -0800521 }
Mindy Pereiraa1406072011-12-22 10:54:06 -0800522 }
523
Mindy Pereira6f92de62011-12-19 11:31:48 -0800524 /**
Paul Westbrook334e64a2012-02-23 13:26:35 -0800525 * List of operations that can can be performed on a conversation. These operations are applied
526 * with {@link ContentProvider#update(Uri, ContentValues, String, String[])}
527 * where the conversation uri is specified, and the ContentValues specifies the operation to
528 * be performed.
529 * <p/>
530 * The operation to be performed is specified in the ContentValues by
531 * the {@link ConversationOperations#OPERATION_KEY}
532 * <p/>
533 * Note not all UI providers will support these operations. {@link AccountCapabilities} can
534 * be used to determine which operations are supported.
Mindy Pereira6f92de62011-12-19 11:31:48 -0800535 */
Paul Westbrook334e64a2012-02-23 13:26:35 -0800536 public static final class ConversationOperations {
537 /**
538 * ContentValues key used to specify the operation to be performed
539 */
540 public static final String OPERATION_KEY = "operation";
541
542 /**
543 * Archive operation
544 */
545 public static final String ARCHIVE = "archive";
546
547 /**
548 * Mute operation
549 */
550 public static final String MUTE = "mute";
551
552 /**
553 * Report spam operation
554 */
555 public static final String REPORT_SPAM = "report_spam";
556
557 private ConversationOperations() {
558 }
559 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800560
561 public static final class DraftType {
Andy Huang97c25be2012-01-12 15:12:09 -0800562 public static final int NOT_A_DRAFT = 0;
563 public static final int COMPOSE = 1;
564 public static final int REPLY = 2;
565 public static final int REPLY_ALL = 3;
566 public static final int FORWARD = 4;
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800567
568 private DraftType() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800569 }
570
Mindy Pereiraa1406072011-12-22 10:54:06 -0800571 public static final String[] MESSAGE_PROJECTION = {
572 BaseColumns._ID,
Mindy Pereira326c6602012-01-04 15:32:42 -0800573 MessageColumns.SERVER_ID,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800574 MessageColumns.URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800575 MessageColumns.CONVERSATION_ID,
576 MessageColumns.SUBJECT,
577 MessageColumns.SNIPPET,
578 MessageColumns.FROM,
579 MessageColumns.TO,
580 MessageColumns.CC,
581 MessageColumns.BCC,
582 MessageColumns.REPLY_TO,
583 MessageColumns.DATE_RECEIVED_MS,
584 MessageColumns.BODY_HTML,
585 MessageColumns.BODY_TEXT,
586 MessageColumns.EMBEDS_EXTERNAL_RESOURCES,
587 MessageColumns.REF_MESSAGE_ID,
588 MessageColumns.DRAFT_TYPE,
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800589 MessageColumns.APPEND_REF_MESSAGE_CONTENT,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800590 MessageColumns.HAS_ATTACHMENTS,
Mindy Pereira326c6602012-01-04 15:32:42 -0800591 MessageColumns.ATTACHMENT_LIST_URI,
Mindy Pereiraf944e962012-01-17 11:43:36 -0800592 MessageColumns.MESSAGE_FLAGS,
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800593 MessageColumns.JOINED_ATTACHMENT_INFOS,
594 MessageColumns.SAVE_MESSAGE_URI,
595 MessageColumns.SEND_MESSAGE_URI
Mindy Pereiraa1406072011-12-22 10:54:06 -0800596 };
597
Mindy Pereiraf944e962012-01-17 11:43:36 -0800598 /** Separates attachment info parts in strings in a message. */
599 public static final String MESSAGE_ATTACHMENT_INFO_SEPARATOR = "\n";
Mindy Pereiraa1406072011-12-22 10:54:06 -0800600 public static final String MESSAGE_LIST_TYPE =
601 "vnd.android.cursor.dir/vnd.com.android.mail.message";
602 public static final String MESSAGE_TYPE =
603 "vnd.android.cursor.item/vnd.com.android.mail.message";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800604
Mindy Pereira6349a042012-01-04 11:25:01 -0800605 public static final int MESSAGE_ID_COLUMN = 0;
Mindy Pereira326c6602012-01-04 15:32:42 -0800606 public static final int MESSAGE_SERVER_ID_COLUMN = 1;
607 public static final int MESSAGE_URI_COLUMN = 2;
608 public static final int MESSAGE_CONVERSATION_ID_COLUMN = 3;
609 public static final int MESSAGE_SUBJECT_COLUMN = 4;
610 public static final int MESSAGE_SNIPPET_COLUMN = 5;
611 public static final int MESSAGE_FROM_COLUMN = 6;
612 public static final int MESSAGE_TO_COLUMN = 7;
613 public static final int MESSAGE_CC_COLUMN = 8;
614 public static final int MESSAGE_BCC_COLUMN = 9;
615 public static final int MESSAGE_REPLY_TO_COLUMN = 10;
616 public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11;
Mindy Pereira16668162012-01-11 16:11:19 -0800617 public static final int MESSAGE_BODY_HTML_COLUMN = 12;
618 public static final int MESSAGE_BODY_TEXT_COLUMN = 13;
Mindy Pereira326c6602012-01-04 15:32:42 -0800619 public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14;
620 public static final int MESSAGE_REF_MESSAGE_ID_COLUMN = 15;
621 public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16;
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800622 public static final int MESSAGE_APPEND_REF_MESSAGE_CONTENT_COLUMN = 17;
623 public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 18;
624 public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 19;
625 public static final int MESSAGE_FLAGS_COLUMN = 20;
Mindy Pereiraf944e962012-01-17 11:43:36 -0800626 public static final int MESSAGE_JOINED_ATTACHMENT_INFOS_COLUMN = 21;
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800627 public static final int MESSAGE_SAVE_URI_COLUMN = 22;
628 public static final int MESSAGE_SEND_URI_COLUMN = 23;
Mindy Pereira6349a042012-01-04 11:25:01 -0800629
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800630 public static final class MessageFlags {
Andy Huangdb977472012-01-11 19:53:25 -0800631 public static final int STARRED = 1 << 0;
632 public static final int UNREAD = 1 << 1;
633 public static final int REPLIED = 1 << 2;
634 public static final int FORWARDED = 1 << 3;
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800635 }
636
Mindy Pereira6f92de62011-12-19 11:31:48 -0800637 public static final class MessageColumns {
Andy Huangdb977472012-01-11 19:53:25 -0800638 /**
639 * This string column contains a content provider URI that points to this single message.
640 */
Mindy Pereira6349a042012-01-04 11:25:01 -0800641 public static final String URI = "messageUri";
Andy Huangdb977472012-01-11 19:53:25 -0800642 /**
643 * This string column contains a server-assigned ID for this message.
644 */
645 public static final String SERVER_ID = "serverMessageId";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800646 public static final String CONVERSATION_ID = "conversationId";
Andy Huangdb977472012-01-11 19:53:25 -0800647 /**
648 * This string column contains the subject of a message.
649 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800650 public static final String SUBJECT = "subject";
Andy Huangdb977472012-01-11 19:53:25 -0800651 /**
652 * This string column contains a snippet of the message body.
653 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800654 public static final String SNIPPET = "snippet";
Andy Huangdb977472012-01-11 19:53:25 -0800655 /**
656 * This string column contains the single email address (and optionally name) of the sender.
657 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800658 public static final String FROM = "fromAddress";
Andy Huangdb977472012-01-11 19:53:25 -0800659 /**
660 * This string column contains a comma-delimited list of "To:" recipient email addresses.
661 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800662 public static final String TO = "toAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800663 /**
664 * This string column contains a comma-delimited list of "CC:" recipient email addresses.
665 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800666 public static final String CC = "ccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800667 /**
668 * This string column contains a comma-delimited list of "BCC:" recipient email addresses.
669 * This value will be null for incoming messages.
670 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800671 public static final String BCC = "bccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -0800672 /**
673 * This string column contains the single email address (and optionally name) of the
674 * sender's reply-to address.
675 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800676 public static final String REPLY_TO = "replyToAddress";
Andy Huangdb977472012-01-11 19:53:25 -0800677 /**
678 * This long column contains the timestamp (in millis) of receipt of the message.
679 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800680 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
Andy Huangdb977472012-01-11 19:53:25 -0800681 /**
682 * This string column contains the HTML form of the message body, if available. If not,
683 * a provider must populate BODY_TEXT.
684 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800685 public static final String BODY_HTML = "bodyHtml";
Andy Huangdb977472012-01-11 19:53:25 -0800686 /**
687 * This string column contains the plaintext form of the message body, if HTML is not
688 * otherwise available. If HTML is available, this value should be left empty (null).
689 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800690 public static final String BODY_TEXT = "bodyText";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800691 public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources";
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800692 /**
693 * This string column contains an opaque string used by the sendMessage api.
694 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800695 public static final String REF_MESSAGE_ID = "refMessageId";
Andy Huangdb977472012-01-11 19:53:25 -0800696 /**
Andy Huang97c25be2012-01-12 15:12:09 -0800697 * This integer column contains the type of this draft, or zero (0) if this message is not a
698 * draft. See {@link DraftType} for possible values.
Andy Huangdb977472012-01-11 19:53:25 -0800699 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800700 public static final String DRAFT_TYPE = "draftType";
Andy Huangdb977472012-01-11 19:53:25 -0800701 /**
702 * This boolean column indicates whether an outgoing message should trigger special quoted
703 * text processing upon send. The value should default to zero (0) for protocols that do
704 * not support or require this flag, and for all incoming messages.
705 */
Mindy Pereira3ce64e72012-01-13 14:29:45 -0800706 public static final String APPEND_REF_MESSAGE_CONTENT = "appendRefMessageContent";
Andy Huangdb977472012-01-11 19:53:25 -0800707 /**
708 * This boolean column indicates whether a message has attachments. The list of attachments
709 * can be retrieved using the URI in {@link MessageColumns#ATTACHMENT_LIST_URI}.
710 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800711 public static final String HAS_ATTACHMENTS = "hasAttachments";
Andy Huangdb977472012-01-11 19:53:25 -0800712 /**
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800713 * This string column contains the content provider URI for the list of
714 * attachments associated with this message.
Andy Huangdb977472012-01-11 19:53:25 -0800715 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800716 public static final String ATTACHMENT_LIST_URI = "attachmentListUri";
Andy Huangdb977472012-01-11 19:53:25 -0800717 /**
718 * This long column is a bit field of flags defined in {@link MessageFlags}.
719 */
Andy Huang732600e2012-01-10 17:47:17 -0800720 public static final String MESSAGE_FLAGS = "messageFlags";
Mindy Pereiraf944e962012-01-17 11:43:36 -0800721 /**
722 * This string column contains a specially formatted string representing all
723 * attachments that we added to a message that is being sent or saved.
724 */
Mindy Pereira84554ec2012-01-17 14:44:44 -0800725 public static final String JOINED_ATTACHMENT_INFOS = "joinedAttachmentInfos";
Mindy Pereira7ed1c112012-01-18 10:59:25 -0800726 /**
727 * This string column contains the content provider URI for saving this
728 * message.
729 */
730 public static final String SAVE_MESSAGE_URI = "saveMessageUri";
731 /**
732 * This string column contains content provider URI for sending this
733 * message.
734 */
735 public static final String SEND_MESSAGE_URI = "sendMessageUri";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800736
737 private MessageColumns() {}
738 }
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800739
740 // We define a "folder" as anything that contains a list of conversations.
741 public static final String ATTACHMENT_LIST_TYPE =
742 "vnd.android.cursor.dir/vnd.com.android.mail.attachment";
743 public static final String ATTACHMENT_TYPE =
744 "vnd.android.cursor.item/vnd.com.android.mail.attachment";
745
746 public static final String[] ATTACHMENT_PROJECTION = {
747 BaseColumns._ID,
748 AttachmentColumns.NAME,
749 AttachmentColumns.SIZE,
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800750 AttachmentColumns.URI,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800751 AttachmentColumns.ORIGIN_EXTRAS,
752 AttachmentColumns.CONTENT_TYPE,
753 AttachmentColumns.SYNCED
754 };
Mindy Pereira82cc5662012-01-09 17:29:30 -0800755 private static final String EMAIL_SEPARATOR_PATTERN = "\n";
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800756 public static final int ATTACHMENT_ID_COLUMN = 0;
757 public static final int ATTACHMENT_NAME_COLUMN = 1;
758 public static final int ATTACHMENT_SIZE_COLUMN = 2;
759 public static final int ATTACHMENT_URI_COLUMN = 3;
Mindy Pereiraf944e962012-01-17 11:43:36 -0800760 public static final int ATTACHMENT_ORIGIN_EXTRAS_COLUMN = 4;
761 public static final int ATTACHMENT_CONTENT_TYPE_COLUMN = 5;
762 public static final int ATTACHMENT_SYNCED_COLUMN = 6;
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800763
764 public static final class AttachmentColumns {
765 public static final String NAME = "name";
766 public static final String SIZE = "size";
Mindy Pereira7a07fb42012-01-11 10:32:48 -0800767 public static final String URI = "uri";
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800768 public static final String ORIGIN_EXTRAS = "originExtras";
769 public static final String CONTENT_TYPE = "contentType";
770 public static final String SYNCED = "synced";
771 }
Mindy Pereira013194c2012-01-06 15:09:33 -0800772
773 public static int getMailMaxAttachmentSize(String account) {
774 // TODO: query the account to see what the max attachment size is?
775 return 5 * 1024 * 1024;
776 }
777
778 public static String getAttachmentTypeSetting() {
779 // TODO: query the account to see what kinds of attachments it supports?
780 return "com.google.android.gm.allowAddAnyAttachment";
781 }
Mindy Pereira82cc5662012-01-09 17:29:30 -0800782
783 public static void incrementRecipientsTimesContacted(Context context, String addressString) {
784 DataUsageStatUpdater statsUpdater = new DataUsageStatUpdater(context);
785 ArrayList<String> recipients = new ArrayList<String>();
786 String[] addresses = TextUtils.split(addressString, EMAIL_SEPARATOR_PATTERN);
787 for (String address : addresses) {
788 recipients.add(address);
789 }
790 statsUpdater.updateWithAddress(recipients);
791 }
Marc Blankb31ab5a2012-02-01 12:28:29 -0800792
793 public static final String[] UNDO_PROJECTION = {
794 ConversationColumns.MESSAGE_LIST_URI
795 };
796 public static final int UNDO_MESSAGE_LIST_COLUMN = 0;
Marc Blankdd10bc82012-02-01 19:10:46 -0800797
798 // Parameter used to indicate the sequence number for an undoable operation
799 public static final String SEQUENCE_QUERY_PARAMETER = "seq";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800800}