blob: 3b4493458cc94adbcc4c06f028595b430d2ace8a [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
Alice Yang64273142013-04-10 18:26:56 -070020import android.content.ContentProvider;
21import android.content.ContentValues;
Andy Huangd521baf2013-05-21 18:08:08 -070022import android.database.Cursor;
Alice Yang64273142013-04-10 18:26:56 -070023import android.net.Uri;
Andy Huang7f39bbd2013-05-20 20:36:38 -070024import android.os.Bundle;
Andy Huangd521baf2013-05-21 18:08:08 -070025import android.os.Parcelable;
Mindy Pereira6f92de62011-12-19 11:31:48 -080026import android.provider.BaseColumns;
Paul Westbrookc97d8ac2012-03-23 15:21:48 -070027import android.provider.OpenableColumns;
Mindy Pereira82cc5662012-01-09 17:29:30 -080028import android.text.TextUtils;
29
Tony Mantler42fe4862013-10-23 11:39:19 -070030import com.google.common.collect.ImmutableList;
Alice Yang64273142013-04-10 18:26:56 -070031import com.google.common.collect.ImmutableMap;
Mindy Pereira6f92de62011-12-19 11:31:48 -080032
Andy Huangbab92212012-11-16 18:32:18 -080033import java.util.Map;
Mark Wei479505d2013-03-21 06:04:46 -070034import java.util.regex.Pattern;
Paul Westbrook82ea6da2011-12-15 11:03:51 -080035
Mindy Pereira6f92de62011-12-19 11:31:48 -080036public class UIProvider {
Mindy Pereira048b5c82012-04-02 11:11:33 -070037 public static final String EMAIL_SEPARATOR = ",";
Mindy Pereira326c6602012-01-04 15:32:42 -080038 public static final long INVALID_CONVERSATION_ID = -1;
39 public static final long INVALID_MESSAGE_ID = -1;
40
Marc Blank9ace18a2012-02-21 16:34:07 -080041 /**
42 * Values for the current state of a Folder/Account; note that it's possible that more than one
43 * sync is in progress
44 */
45 public static final class SyncStatus {
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070046 /**
47 * No sync in progress
48 */
Paul Westbrookc808fac2012-02-22 16:42:18 -080049 public static final int NO_SYNC = 0;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070050 /**
51 * A user-requested sync/refresh is in progress. This occurs when the user taps on the
52 * refresh icon in the action bar.
53 */
Paul Westbrookc808fac2012-02-22 16:42:18 -080054 public static final int USER_REFRESH = 1<<0;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070055 /**
56 * A user-requested live query is in progress. This occurs when the user goes past the end
57 * of the fetched results in the conversation list.
58 */
59 public static final int LIVE_QUERY = 1<<1;
60 /** Please use the constant {@link #LIVE_QUERY} instead. */
61 @Deprecated
Paul Westbrookc808fac2012-02-22 16:42:18 -080062 public static final int USER_QUERY = 1<<1;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070063 /**
64 * A background sync is in progress. This happens on <b>no</b> user interaction.
65 */
66 public static final int BACKGROUND_SYNC = 1<<2;
67 /**
68 * An initial sync is needed for this Account/Folder to be used. This is account-wide, when
69 * the user has added an account, and the first sync has not completed successfully.
70 */
71 public static final int INITIAL_SYNC_NEEDED = 1<<3;
72 /**
73 * Manual sync is required. This is account-wide, when the user has disabled sync on the
74 * Gmail account.
75 */
76 public static final int MANUAL_SYNC_REQUIRED = 1<<4;
Paul Westbrookdfa1dec2012-09-26 16:27:28 -070077 /**
78 * Account initialization is required.
79 */
80 public static final int ACCOUNT_INITIALIZATION_REQUIRED = 1<<5;
Mindy Pereira70a70c92012-08-02 08:39:45 -070081
82 public static boolean isSyncInProgress(int syncStatus) {
83 return 0 != (syncStatus & (BACKGROUND_SYNC |
84 USER_REFRESH |
Vikram Aggarwald31f0cf2013-01-18 15:34:40 -080085 LIVE_QUERY));
Mindy Pereira70a70c92012-08-02 08:39:45 -070086 }
Marc Blank9ace18a2012-02-21 16:34:07 -080087 }
88
89 /**
90 * Values for the result of the last attempted sync of a Folder/Account
91 */
92 public static final class LastSyncResult {
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070093 /** The sync completed successfully */
Marc Blank9ace18a2012-02-21 16:34:07 -080094 public static final int SUCCESS = 0;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070095 /** The sync wasn't completed due to a connection error */
Marc Blank9ace18a2012-02-21 16:34:07 -080096 public static final int CONNECTION_ERROR = 1;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070097 /** The sync wasn't completed due to an authentication error */
Marc Blank9ace18a2012-02-21 16:34:07 -080098 public static final int AUTH_ERROR = 2;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -070099 /** The sync wasn't completed due to a security error */
Marc Blank9ace18a2012-02-21 16:34:07 -0800100 public static final int SECURITY_ERROR = 3;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -0700101 /** The sync wasn't completed due to a low memory condition */
Marc Blank9ace18a2012-02-21 16:34:07 -0800102 public static final int STORAGE_ERROR = 4;
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -0700103 /** The sync wasn't completed due to an internal error/exception */
Marc Blank9ace18a2012-02-21 16:34:07 -0800104 public static final int INTERNAL_ERROR = 5;
105 }
106
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800107 // The actual content provider should define its own authority
Andy Huang30e2c242012-01-06 18:14:30 -0800108 public static final String AUTHORITY = "com.android.mail.providers";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800109
110 public static final String ACCOUNT_LIST_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800111 "vnd.android.cursor.dir/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800112 public static final String ACCOUNT_TYPE =
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800113 "vnd.android.cursor.item/vnd.com.android.mail.account";
Mindy Pereira6f92de62011-12-19 11:31:48 -0800114
Paul Westbrook2d82d612012-03-07 09:21:14 -0800115 /**
116 * Query parameter key that can be used to control the behavior of list queries. The value
117 * must be a serialized {@link ListParams} object. UIProvider implementations are not
118 * required to respect this query parameter
119 */
120 public static final String LIST_PARAMS_QUERY_PARAMETER = "listParams";
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800121 public static final String LABEL_QUERY_PARAMETER = "label";
122 public static final String SEEN_QUERY_PARAMETER = "seen";
Paul Westbrook2d82d612012-03-07 09:21:14 -0800123
Scott Kennedy41c16942013-07-11 17:16:28 -0700124 /**
125 * Query parameter that can be used to specify a parent for a the returned folder object from a
126 * query. When set, if a folder is returned that does not have a true parent, it will use this
127 * uri as its parent uri.
128 */
129 public static final String DEFAULT_PARENT_QUERY_PARAMETER = "defaultParent";
130
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800131 public static final Map<String, Class<?>> ACCOUNTS_COLUMNS_NO_CAPABILITIES =
Andy Huangbab92212012-11-16 18:32:18 -0800132 new ImmutableMap.Builder<String, Class<?>>()
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800133 .put(AccountColumns._ID, Integer.class)
Andy Huangbab92212012-11-16 18:32:18 -0800134 .put(AccountColumns.NAME, String.class)
Tony Mantlerbb036ff72013-10-18 14:03:43 -0700135 .put(AccountColumns.SENDER_NAME, String.class)
Tony Mantler3e166872013-09-24 16:39:18 -0700136 .put(AccountColumns.ACCOUNT_MANAGER_NAME, String.class)
Scott Kennedye5883802013-04-14 14:33:20 -0700137 .put(AccountColumns.TYPE, String.class)
Andy Huangbab92212012-11-16 18:32:18 -0800138 .put(AccountColumns.PROVIDER_VERSION, Integer.class)
139 .put(AccountColumns.URI, String.class)
Andy Huangbab92212012-11-16 18:32:18 -0800140 .put(AccountColumns.FOLDER_LIST_URI, String.class)
141 .put(AccountColumns.FULL_FOLDER_LIST_URI, String.class)
Tony Mantler009f1b52013-09-20 14:32:23 -0700142 .put(AccountColumns.ALL_FOLDER_LIST_URI, String.class)
Andy Huangbab92212012-11-16 18:32:18 -0800143 .put(AccountColumns.SEARCH_URI, String.class)
144 .put(AccountColumns.ACCOUNT_FROM_ADDRESSES, String.class)
Andy Huangbab92212012-11-16 18:32:18 -0800145 .put(AccountColumns.EXPUNGE_MESSAGE_URI, String.class)
146 .put(AccountColumns.UNDO_URI, String.class)
147 .put(AccountColumns.SETTINGS_INTENT_URI, String.class)
148 .put(AccountColumns.SYNC_STATUS, Integer.class)
149 .put(AccountColumns.HELP_INTENT_URI, String.class)
150 .put(AccountColumns.SEND_FEEDBACK_INTENT_URI, String.class)
151 .put(AccountColumns.REAUTHENTICATION_INTENT_URI, String.class)
152 .put(AccountColumns.COMPOSE_URI, String.class)
153 .put(AccountColumns.MIME_TYPE, String.class)
154 .put(AccountColumns.RECENT_FOLDER_LIST_URI, String.class)
155 .put(AccountColumns.COLOR, Integer.class)
156 .put(AccountColumns.DEFAULT_RECENT_FOLDER_LIST_URI, String.class)
157 .put(AccountColumns.MANUAL_SYNC_URI, String.class)
158 .put(AccountColumns.VIEW_INTENT_PROXY_URI, String.class)
159 .put(AccountColumns.ACCOUNT_COOKIE_QUERY_URI, String.class)
160 .put(AccountColumns.SettingsColumns.SIGNATURE, String.class)
161 .put(AccountColumns.SettingsColumns.AUTO_ADVANCE, Integer.class)
162 .put(AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE, Integer.class)
163 .put(AccountColumns.SettingsColumns.SNAP_HEADERS, Integer.class)
164 .put(AccountColumns.SettingsColumns.REPLY_BEHAVIOR, Integer.class)
Scott Kennedy251d6c42013-04-23 16:46:24 -0700165 .put(AccountColumns.SettingsColumns.CONV_LIST_ICON, Integer.class)
Mark Weiaa76bdf2013-08-06 18:20:11 -0700166 .put(AccountColumns.SettingsColumns.CONV_LIST_ATTACHMENT_PREVIEWS, Integer.class)
Andy Huangbab92212012-11-16 18:32:18 -0800167 .put(AccountColumns.SettingsColumns.CONFIRM_DELETE, Integer.class)
168 .put(AccountColumns.SettingsColumns.CONFIRM_ARCHIVE, Integer.class)
169 .put(AccountColumns.SettingsColumns.CONFIRM_SEND, Integer.class)
170 .put(AccountColumns.SettingsColumns.DEFAULT_INBOX, String.class)
171 .put(AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME, String.class)
172 .put(AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT, Integer.class)
173 .put(AccountColumns.SettingsColumns.MAX_ATTACHMENT_SIZE, Integer.class)
174 .put(AccountColumns.SettingsColumns.SWIPE, Integer.class)
175 .put(AccountColumns.SettingsColumns.PRIORITY_ARROWS_ENABLED, Integer.class)
176 .put(AccountColumns.SettingsColumns.SETUP_INTENT_URI, String.class)
177 .put(AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE, Integer.class)
Vikram Aggarwal69a6cdf2013-01-08 16:05:17 -0800178 .put(AccountColumns.SettingsColumns.VEILED_ADDRESS_PATTERN, String.class)
Andy Huangbab92212012-11-16 18:32:18 -0800179 .put(AccountColumns.UPDATE_SETTINGS_URI, String.class)
Alice Yang3617b412013-05-10 00:30:07 -0700180 .put(AccountColumns.ENABLE_MESSAGE_TRANSFORMS, Integer.class)
Alice Yangc86b1fb2013-08-11 22:27:25 -0700181 .put(AccountColumns.SYNC_AUTHORITY, String.class)
Tony Mantler59e69092013-08-14 11:05:00 -0700182 .put(AccountColumns.QUICK_RESPONSE_URI, String.class)
Scott Kennedydd2ec682013-06-03 19:16:13 -0700183 .put(AccountColumns.SettingsColumns.MOVE_TO_INBOX, String.class)
Alice Yangf323c042013-10-30 00:15:02 -0700184 .put(AccountColumns.SettingsColumns.SHOW_IMAGES, Integer.class)
Andy Huangbab92212012-11-16 18:32:18 -0800185 .build();
186
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800187 public static final Map<String, Class<?>> ACCOUNTS_COLUMNS =
188 new ImmutableMap.Builder<String, Class<?>>()
189 .putAll(ACCOUNTS_COLUMNS_NO_CAPABILITIES)
190 .put(AccountColumns.CAPABILITIES, Integer.class)
191 .build();
Mindy Pereira6f92de62011-12-19 11:31:48 -0800192
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800193 // pull out the keyset from above to form the projection
194 public static final String[] ACCOUNTS_PROJECTION =
195 ACCOUNTS_COLUMNS.keySet().toArray(new String[ACCOUNTS_COLUMNS.size()]);
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700196
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800197 public static final
198 String[] ACCOUNTS_PROJECTION_NO_CAPABILITIES = ACCOUNTS_COLUMNS_NO_CAPABILITIES.keySet()
199 .toArray(new String[ACCOUNTS_COLUMNS_NO_CAPABILITIES.size()]);
Scott Kennedy0d0f8b02012-10-12 15:18:18 -0700200
Mindy Pereira6f92de62011-12-19 11:31:48 -0800201 public static final class AccountCapabilities {
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800202 /**
203 * Whether folders can be synchronized back to the server.
204 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800205 public static final int SYNCABLE_FOLDERS = 0x0001;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800206 /**
207 * Whether the server allows reporting spam back.
208 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800209 public static final int REPORT_SPAM = 0x0002;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800210 /**
Paul Westbrook77eee622012-07-10 13:41:57 -0700211 * Whether the server allows reporting phishing back.
212 */
213 public static final int REPORT_PHISHING = 0x0004;
214 /**
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800215 * Whether the server supports a concept of Archive: removing mail from the Inbox but
216 * keeping it around.
217 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700218 public static final int ARCHIVE = 0x0008;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800219 /**
220 * Whether the server will stop notifying on updates to this thread? This requires
221 * THREADED_CONVERSATIONS to be true, otherwise it should be ignored.
222 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700223 public static final int MUTE = 0x0010;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800224 /**
225 * Whether the server supports searching over all messages. This requires SYNCABLE_FOLDERS
226 * to be true, otherwise it should be ignored.
227 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700228 public static final int SERVER_SEARCH = 0x0020;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800229 /**
230 * Whether the server supports constraining search to a single folder. Requires
231 * SYNCABLE_FOLDERS, otherwise it should be ignored.
232 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700233 public static final int FOLDER_SERVER_SEARCH = 0x0040;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800234 /**
235 * Whether the server sends us sanitized HTML (guaranteed to not contain malicious HTML).
236 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700237 public static final int SANITIZED_HTML = 0x0080;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800238 /**
239 * Whether the server allows synchronization of draft messages. This does NOT require
240 * SYNCABLE_FOLDERS to be set.
241 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700242 public static final int DRAFT_SYNCHRONIZATION = 0x0100;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800243 /**
244 * Does the server allow the user to compose mails (and reply) using addresses other than
245 * their account name? For instance, GMail allows users to set FROM addresses that are
246 * different from account@gmail.com address. For instance, user@gmail.com could have another
247 * FROM: address like user@android.com. If the user has enabled multiple FROM address, he
248 * can compose (and reply) using either address.
249 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700250 public static final int MULTIPLE_FROM_ADDRESSES = 0x0200;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800251 /**
252 * Whether the server allows the original message to be included in the reply by setting a
253 * flag on the reply. If we can avoid including the entire previous message, we save on
254 * bandwidth (replies are shorter).
255 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700256 public static final int SMART_REPLY = 0x0400;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800257 /**
258 * Does this account support searching locally, on the device? This requires the backend
259 * storage to support a mechanism for searching.
260 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700261 public static final int LOCAL_SEARCH = 0x0800;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800262 /**
263 * Whether the server supports a notion of threaded conversations: where replies to messages
264 * are tagged to keep conversations grouped. This could be full threading (each message
265 * lists its parent) or conversation-level threading (each message lists one conversation
266 * which it belongs to)
267 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700268 public static final int THREADED_CONVERSATIONS = 0x1000;
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800269 /**
270 * Whether the server supports allowing a conversation to be in multiple folders. (Or allows
Mindy Pereira30fd47b2012-03-09 09:24:00 -0800271 * multiple folders on a single conversation)
Vikram Aggarwal859681b2012-02-03 10:02:24 -0800272 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700273 public static final int MULTIPLE_FOLDERS_PER_CONV = 0x2000;
Mindy Pereira343ffeb2012-02-22 10:12:14 -0800274 /**
275 * Whether the provider supports undoing operations. If it doesn't, never show the undo bar.
276 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700277 public static final int UNDO = 0x4000;
Paul Westbrook94e440d2012-02-24 11:03:47 -0800278 /**
279 * Whether the account provides help content.
280 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700281 public static final int HELP_CONTENT = 0x8000;
Mindy Pereira7f0a9622012-02-29 15:00:34 -0800282 /**
Paul Westbrook517743e2012-03-22 10:40:46 -0700283 * Whether the account provides a way to send feedback content.
284 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700285 public static final int SEND_FEEDBACK = 0x10000;
Paul Westbrook517743e2012-03-22 10:40:46 -0700286 /**
Mindy Pereira7f0a9622012-02-29 15:00:34 -0800287 * Whether the account provides a mechanism for marking conversations as important.
288 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700289 public static final int MARK_IMPORTANT = 0x20000;
Marc Blank51144942012-03-20 13:59:32 -0700290 /**
291 * Whether initial conversation queries should use a limit parameter
292 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700293 public static final int INITIAL_CONVERSATION_LIMIT = 0x40000;
Marc Blankd3707922012-04-24 11:51:50 -0700294 /**
295 * Whether the account cannot be used for sending
296 */
Paul Westbrook77eee622012-07-10 13:41:57 -0700297 public static final int SENDING_UNAVAILABLE = 0x80000;
Paul Westbrookef362542012-08-27 14:53:32 -0700298 /**
299 * Whether the account supports discarding drafts from a conversation. This should be
300 * removed when all providers support this capability
301 */
302 public static final int DISCARD_CONVERSATION_DRAFTS = 0x100000;
Scott Kennedy7ee089e2013-03-25 17:05:44 -0400303 /**
304 * Whether the account supports emptying the trash folder
305 */
306 public static final int EMPTY_TRASH = 0x200000;
307 /**
308 * Whether the account supports emptying the spam folder
309 */
310 public static final int EMPTY_SPAM = 0x400000;
Scott Kennedy0e8dc842013-09-10 11:13:53 -0700311 /**
312 * Whether the account supports nested folders
313 */
314 public static final int NESTED_FOLDERS = 0x800000;
Mindy Pereira6f92de62011-12-19 11:31:48 -0800315 }
316
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800317 public static final class AccountColumns implements BaseColumns {
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800318 /**
319 * This string column contains the human visible name for the account.
320 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800321 public static final String NAME = "name";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800322
323 /**
Tony Mantlerbb036ff72013-10-18 14:03:43 -0700324 * This string column contains the real name associated with the account, e.g. "John Doe"
325 */
326 public static final String SENDER_NAME = "senderName";
327
328 /**
Tony Mantler3e166872013-09-24 16:39:18 -0700329 * This string column contains the account manager name of this account.
330 */
331
332 public static final String ACCOUNT_MANAGER_NAME = "accountManagerName";
333
334 /**
Vikram Aggarwal6dde1782012-03-12 17:16:48 -0700335 * This integer contains the type of the account: Google versus non google. This is not
336 * returned by the UIProvider, rather this is a notion in the system.
337 */
338 public static final String TYPE = "type";
339
340 /**
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800341 * This integer column returns the version of the UI provider schema from which this
342 * account provider will return results.
343 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800344 public static final String PROVIDER_VERSION = "providerVersion";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800345
346 /**
347 * This string column contains the uri to directly access the information for this account.
348 */
Mindy Pereira6349a042012-01-04 11:25:01 -0800349 public static final String URI = "accountUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800350
351 /**
Andy Huange0b83b82012-03-06 19:57:04 -0800352 * This integer column contains a bit field of the possible capabilities that this account
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800353 * supports.
354 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800355 public static final String CAPABILITIES = "capabilities";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800356
357 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800358 * This string column contains the content provider uri to return the
359 * list of top level folders for this account.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800360 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800361 public static final String FOLDER_LIST_URI = "folderListUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800362
363 /**
Mindy Pereira31d79672012-06-26 14:43:09 -0700364 * This string column contains the content provider uri to return the
Tony Mantler009f1b52013-09-20 14:32:23 -0700365 * list of all real folders for this account.
Mindy Pereira31d79672012-06-26 14:43:09 -0700366 */
367 public static final String FULL_FOLDER_LIST_URI = "fullFolderListUri";
368
369 /**
Tony Mantler009f1b52013-09-20 14:32:23 -0700370 * This string column contains the content provider uri to return the
371 * list of all real and synthetic folders for this account.
372 */
373 public static final String ALL_FOLDER_LIST_URI = "allFolderListUri";
374
375 /**
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800376 * This string column contains the content provider uri that can be queried for search
377 * results.
Paul Westbrook8130e6f2012-03-06 13:51:01 -0800378 * The supported query parameters are limited to those listed
Andy Huangd8e249e2012-03-21 17:01:37 -0700379 * in {@link SearchQueryParameters}
Paul Westbrook1475a7a2012-03-08 15:06:27 -0800380 * The cursor returned from this query is expected have one row, where the columnm are a
Andy Huangd8e249e2012-03-21 17:01:37 -0700381 * subset of the columns specified in {@link FolderColumns}
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800382 */
Mindy Pereira6f92de62011-12-19 11:31:48 -0800383 public static final String SEARCH_URI = "searchUri";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800384
385 /**
Mindy Pereira92551d02012-04-05 11:31:12 -0700386 * This string column contains a json array of json objects representing
387 * custom from addresses for this account or null if there are none.
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800388 */
Mindy Pereira92551d02012-04-05 11:31:12 -0700389 public static final String ACCOUNT_FROM_ADDRESSES = "accountFromAddresses";
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800390
391 /**
Mindy Pereira82cc5662012-01-09 17:29:30 -0800392 * This string column contains the content provider uri that can be used
393 * to expunge a message from this account. NOTE: This might be better to
394 * be an update operation on the messageUri.
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -0700395 * When {@link android.content.ContentResolver#update(Uri, ContentValues, String, String[])}
396 * is called with this uri, the {@link ContentValues} object is expected to have
397 * {@link BaseColumns#_ID} specified with the local message id of the message.
Mindy Pereira82cc5662012-01-09 17:29:30 -0800398 */
399 public static final String EXPUNGE_MESSAGE_URI = "expungeMessageUri";
Mindy Pereira96b5c352012-02-01 11:33:40 -0800400
401 /**
402 * This string column contains the content provider uri that can be used
403 * to undo the last committed action.
404 */
Mindy Pereira9600dac2012-02-17 15:59:25 -0800405 public static final String UNDO_URI = "undoUri";
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800406
407 /**
Paul Westbrook9912eee2012-02-22 14:49:03 -0800408 * Uri for EDIT intent that will cause the settings screens for this account type to be
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800409 * shown.
Paul Westbrooke5503552012-03-28 00:35:57 -0700410 * Optionally, extra values from {@link EditSettingsExtras} can be used to indicate
411 * which settings the user wants to edit.
Paul Westbrook2861b6a2012-02-15 15:25:34 -0800412 * TODO: When we want to support a heterogeneous set of account types, this value may need
413 * to be moved to a global content provider.
414 */
Paul Westbrookb8911732013-04-28 11:54:49 -0700415 public static final String SETTINGS_INTENT_URI = "accountSettingsIntentUri";
Marc Blank9ace18a2012-02-21 16:34:07 -0800416
417 /**
Paul Westbrook94e440d2012-02-24 11:03:47 -0800418 * Uri for VIEW intent that will cause the help screens for this account type to be
419 * shown.
420 * TODO: When we want to support a heterogeneous set of account types, this value may need
421 * to be moved to a global content provider.
422 */
Paul Westbrookb8911732013-04-28 11:54:49 -0700423 public static final String HELP_INTENT_URI = "helpIntentUri";
Paul Westbrook94e440d2012-02-24 11:03:47 -0800424
425 /**
Paul Westbrook517743e2012-03-22 10:40:46 -0700426 * Uri for VIEW intent that will cause the send feedback for this account type to be
427 * shown.
428 * TODO: When we want to support a heterogeneous set of account types, this value may need
429 * to be moved to a global content provider.
430 */
Paul Westbrookb8911732013-04-28 11:54:49 -0700431 public static final String SEND_FEEDBACK_INTENT_URI = "sendFeedbackIntentUri";
Paul Westbrook517743e2012-03-22 10:40:46 -0700432
433 /**
Paul Westbrook122f7c22012-08-20 17:50:31 -0700434 * Uri for VIEW intent that will cause the user to be prompted for authentication for
435 * this account. startActivityForResult() will be called with this intent. Activities that
Vikram Aggarwal41b9e8f2012-09-25 10:15:04 -0700436 * handle this intent are expected to return {@link android.app.Activity#RESULT_OK} if the
Paul Westbrook122f7c22012-08-20 17:50:31 -0700437 * user successfully authenticated.
438 */
Paul Westbrookb8911732013-04-28 11:54:49 -0700439 public static final String REAUTHENTICATION_INTENT_URI = "reauthenticationUri";
Paul Westbrook122f7c22012-08-20 17:50:31 -0700440
441 /**
Marc Blank9ace18a2012-02-21 16:34:07 -0800442 * This int column contains the current sync status of the account (the logical AND of the
443 * sync status of folders in this account)
444 */
445 public static final String SYNC_STATUS = "syncStatus";
Mindy Pereira23755e22012-02-27 13:58:04 -0800446 /**
447 * Uri for VIEW intent that will cause the compose screens for this type
448 * of account to be shown.
449 */
450 public static final String COMPOSE_URI = "composeUri";
Mindy Pereira898cd382012-03-06 08:42:47 -0800451 /**
452 * Mime-type defining this account.
453 */
454 public static final String MIME_TYPE = "mimeType";
Vikram Aggarwal27e85f22012-03-05 16:29:17 -0800455 /**
456 * URI for location of recent folders viewed on this account.
457 */
458 public static final String RECENT_FOLDER_LIST_URI = "recentFolderListUri";
Marc Blankb2878332012-05-17 15:16:59 -0700459 /**
Vikram Aggarwal27d89ad2012-06-12 13:38:40 -0700460 * URI for default recent folders for this account, if any.
461 */
462 public static final String DEFAULT_RECENT_FOLDER_LIST_URI = "defaultRecentFolderListUri";
463 /**
Andy Huangbab92212012-11-16 18:32:18 -0800464 * Color (integer) used for this account (for Email/Combined view)
Marc Blankb2878332012-05-17 15:16:59 -0700465 */
466 public static final String COLOR = "color";
Mindy Pereirab378d642012-07-11 09:46:20 -0700467 /**
468 * URI for forcing a manual sync of this account.
469 */
470 public static final String MANUAL_SYNC_URI = "manualSyncUri";
Mark Wei9982fdb2012-08-30 18:27:46 -0700471 /**
472 * Optional URI of this account for proxying view intents.
473 */
474 public static final String VIEW_INTENT_PROXY_URI = "viewProxyUri";
Paul Westbrookb8361c92012-09-27 10:57:14 -0700475 /**
476 * Optional URI for querying for the cookie needed for accessing inline content. The cookie
477 * specified here will be set on the uri specified in the
478 * {@link ConversationColumns#CONVERSATION_BASE_URI} column. The cursor returned from this
479 * query is expected have one row, where the columns are specified in
480 * {@link AccountCookieColumns}
481 */
482 public static final String ACCOUNT_COOKIE_QUERY_URI = "accountCookieUri";
Scott Kennedy0d0f8b02012-10-12 15:18:18 -0700483 /**
484 * URI to be used with an update() ContentResolver call with a {@link ContentValues} object
485 * where the keys are from the {@link AccountColumns.SettingsColumns}, and the values are
486 * the new values.
487 */
488 public static final String UPDATE_SETTINGS_URI = "updateSettingsUri";
Alice Yang3617b412013-05-10 00:30:07 -0700489 /**
490 * Whether message transforms (HTML DOM manipulation) should be enabled.
491 */
492 public static final String ENABLE_MESSAGE_TRANSFORMS = "enableMessageTransforms";
Alice Yangc86b1fb2013-08-11 22:27:25 -0700493 /**
494 * Sync authority to use.
495 */
496 public static final String SYNC_AUTHORITY = "syncAuthority";
Tony Mantler59e69092013-08-14 11:05:00 -0700497 /**
498 * URI for querying this account's quick responses
499 */
500 public static final String QUICK_RESPONSE_URI = "quickResponseUri";
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700501
502 public static final class SettingsColumns {
503 /**
504 * String column containing the contents of the signature for this account. If no
505 * signature has been specified, the value will be null.
506 */
507 public static final String SIGNATURE = "signature";
508
509 /**
510 * Integer column containing the user's specified auto-advance policy. This value will
511 * be one of the values in {@link UIProvider.AutoAdvance}
512 */
513 public static final String AUTO_ADVANCE = "auto_advance";
514
515 /**
516 * Integer column containing the user's specified message text size preference. This
517 * value will be one of the values in {@link UIProvider.MessageTextSize}
518 */
519 public static final String MESSAGE_TEXT_SIZE = "message_text_size";
520
521 /**
522 * Integer column contaning the user's specified snap header preference. This value
523 * will be one of the values in {@link UIProvider.SnapHeaderValue}
524 */
525 public static final String SNAP_HEADERS = "snap_headers";
526
527 /**
528 * Integer column containing the user's specified default reply behavior. This value
529 * will be one of the values in {@link UIProvider.DefaultReplyBehavior}
530 */
531 public static final String REPLY_BEHAVIOR = "reply_behavior";
532
533 /**
Alice Yang4a53f5b2013-05-02 16:10:48 -0700534 * Integer column containing the user's preference for whether to show sender images
535 * or not in the conversation list view. This value will be one of the values in
536 * {@link UIProvider.ConversationListIcon}.
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700537 */
Alice Yang64273142013-04-10 18:26:56 -0700538 public static final String CONV_LIST_ICON = "conversation_list_icon";
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700539
540 /**
Mark Weiaa76bdf2013-08-06 18:20:11 -0700541 * Integer column containing the user's preference for whether to show attachment
542 * previews or not in the conversation list view. A non zero value indicates that
543 * attachment previews should be displayed.
544 */
545 public static final String CONV_LIST_ATTACHMENT_PREVIEWS
546 = "conversation_list_attachment_previews";
547
548 /**
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700549 * Integer column containing the user's specified confirm delete preference value.
550 * A non zero value indicates that the user has indicated that a confirmation should
551 * be shown when a delete action is performed.
552 */
553 public static final String CONFIRM_DELETE = "confirm_delete";
554
555 /**
556 * Integer column containing the user's specified confirm archive preference value.
557 * A non zero value indicates that the user has indicated that a confirmation should
558 * be shown when an archive action is performed.
559 */
560 public static final String CONFIRM_ARCHIVE = "confirm_archive";
561
562 /**
563 * Integer column containing the user's specified confirm send preference value.
564 * A non zero value indicates that the user has indicated that a confirmation should
565 * be shown when a send action is performed.
566 */
567 public static final String CONFIRM_SEND = "confirm_send";
568 /**
Mindy Pereira571de222012-07-20 09:28:44 -0700569 * String containing the URI for the default inbox for this account.
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700570 */
571 public static final String DEFAULT_INBOX = "default_inbox";
572 /**
Vikram Aggarwal5e63e8a2012-07-19 10:05:24 -0700573 * String containing the name of the default Inbox for this account
574 */
575 public static final String DEFAULT_INBOX_NAME = "default_inbox_name";
576 /**
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700577 * Integer column containing a non zero value if replies should always be sent from
578 * a default address instead of a recipient.
579 */
Mindy Pereira3cd4f402012-07-17 11:16:18 -0700580 public static final String FORCE_REPLY_FROM_DEFAULT = "force_reply_from_default";
581 /**
582 * Integer column containing the max attachment size in kb.
583 */
584 public static final String MAX_ATTACHMENT_SIZE = "max_attachment_size";
Mindy Pereira71a8f5e2012-07-25 14:33:18 -0700585 /**
586 * Integer column containing a value matching one of the constants from {@link Swipe}
587 */
588 public static final String SWIPE = "swipe";
Vikram Aggarwal707f24c2012-07-31 15:59:36 -0700589 /**
Andy Huangbab92212012-11-16 18:32:18 -0800590 * Integer column containing whether priority inbox arrows are enabled.
Vikram Aggarwal707f24c2012-07-31 15:59:36 -0700591 */
592 public static final String PRIORITY_ARROWS_ENABLED = "priority_inbox_arrows_enabled";
Marc Blank57899082012-09-05 11:35:57 -0700593 /**
594 * Uri for EDIT intent that will cause account-specific setup UI to be shown. If not
595 * null, this intent should be used when an account is "entered" (i.e. viewing a folder
596 * in the account, etc.)
597 */
598 public static final String SETUP_INTENT_URI = "setup_intent_uri";
Paul Westbrookfa255c02012-10-13 14:32:52 -0700599 /**
Vikram Aggarwal69a6cdf2013-01-08 16:05:17 -0800600 * The regex that defines a veiled address, something that must be hidden from user
601 * view because it is temporary, long and clumsy.
602 */
Vikram Aggarwal6c3875a2013-01-15 16:00:11 -0800603 public static final String VEILED_ADDRESS_PATTERN = "veiled_address_pattern";
Vikram Aggarwal69a6cdf2013-01-08 16:05:17 -0800604 /**
Paul Westbrookfa255c02012-10-13 14:32:52 -0700605 * Integer column containing the Conversation view mode. This value will match one of
606 * constants from {@link ConversationViewMode}
607 */
608 public static final String CONVERSATION_VIEW_MODE = "conversation_view_mode";
Scott Kennedydd2ec682013-06-03 19:16:13 -0700609 /**
610 * String containing the URI for the inbox conversations should be moved to for this
611 * account.
612 */
613 public static final String MOVE_TO_INBOX = "move_to_inbox";
Alice Yangf323c042013-10-30 00:15:02 -0700614 /**
615 * Show images in conversation view.
616 */
617 public static final String SHOW_IMAGES = "show_images";
Paul Westbrookb1f573c2012-04-06 11:38:28 -0700618 }
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800619 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -0800620
Tony Mantler59e69092013-08-14 11:05:00 -0700621 public static final String[] QUICK_RESPONSE_PROJECTION = {
622 BaseColumns._ID,
623 QuickResponseColumns.TEXT,
624 QuickResponseColumns.URI
625 };
626
627 public static final class QuickResponseColumns {
628 /**
629 * Text of the Quick Response
630 */
631 public static final String TEXT = "quickResponse";
632 /**
633 * URI to access this row directly
634 */
635 public static final String URI = "uri";
636 }
637
Paul Westbrookb8361c92012-09-27 10:57:14 -0700638 public static final String[] ACCOUNT_COOKIE_PROJECTION = {
639 AccountCookieColumns.COOKIE
640 };
641
642 public static final class AccountCookieColumns {
643 /**
644 * String column containing the cookie string for this account.
645 */
646 public static final String COOKIE = "cookie";
647 }
648
Paul Westbrook8130e6f2012-03-06 13:51:01 -0800649 public static final class SearchQueryParameters {
650 /**
651 * Parameter used to specify the search query.
652 */
653 public static final String QUERY = "query";
654
Paul Westbrook8130e6f2012-03-06 13:51:01 -0800655 private SearchQueryParameters() {}
656 }
657
Marc Blank51144942012-03-20 13:59:32 -0700658 public static final class ConversationListQueryParameters {
659 public static final String DEFAULT_LIMIT = "50";
660 /**
661 * Parameter used to limit the number of rows returned by a conversation list query
662 */
663 public static final String LIMIT = "limit";
664
Paul Westbrook5f2876a2012-03-20 18:47:22 -0700665 /**
666 * Parameter used to control whether the this query a remote server.
667 */
668 public static final String USE_NETWORK = "use_network";
669
Paul Westbrook4880b5d2012-07-24 09:10:25 -0700670 /**
671 * Parameter used to allow the caller to indicate desire to receive all notifications.
672 * (Including ones for user initiated actions)
673 */
674 public static final String ALL_NOTIFICATIONS = "all_notifications";
675
Marc Blank51144942012-03-20 13:59:32 -0700676 private ConversationListQueryParameters() {}
677 }
678
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800679 // We define a "folder" as anything that contains a list of conversations.
680 public static final String FOLDER_LIST_TYPE =
681 "vnd.android.cursor.dir/vnd.com.android.mail.folder";
682 public static final String FOLDER_TYPE =
Mindy Pereira750cc732011-12-21 13:32:29 -0800683 "vnd.android.cursor.item/vnd.com.android.mail.folder";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800684
685 public static final String[] FOLDERS_PROJECTION = {
Tony Mantler70147a92013-10-14 16:34:45 -0700686 FolderColumns._ID,
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800687 FolderColumns.PERSISTENT_ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800688 FolderColumns.URI,
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800689 FolderColumns.NAME,
Mindy Pereira750cc732011-12-21 13:32:29 -0800690 FolderColumns.HAS_CHILDREN,
Mindy Pereira0973b202011-12-21 15:48:12 -0800691 FolderColumns.CAPABILITIES,
Mindy Pereira0973b202011-12-21 15:48:12 -0800692 FolderColumns.SYNC_WINDOW,
Mindy Pereira750cc732011-12-21 13:32:29 -0800693 FolderColumns.CONVERSATION_LIST_URI,
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800694 FolderColumns.CHILD_FOLDERS_LIST_URI,
Scott Kennedy61bd0e82012-12-10 18:18:17 -0800695 FolderColumns.UNSEEN_COUNT,
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800696 FolderColumns.UNREAD_COUNT,
Marc Blankc8a99422012-01-19 14:27:47 -0800697 FolderColumns.TOTAL_COUNT,
Mindy Pereira77528642012-02-17 15:51:10 -0800698 FolderColumns.REFRESH_URI,
Marc Blank9ace18a2012-02-21 16:34:07 -0800699 FolderColumns.SYNC_STATUS,
Mindy Pereira78664722012-03-05 13:53:07 -0800700 FolderColumns.LAST_SYNC_RESULT,
701 FolderColumns.TYPE,
Mindy Pereira9275a062012-03-08 15:12:14 -0800702 FolderColumns.ICON_RES_ID,
Scott Kennedy61bd0e82012-12-10 18:18:17 -0800703 FolderColumns.NOTIFICATION_ICON_RES_ID,
Mindy Pereira9275a062012-03-08 15:12:14 -0800704 FolderColumns.BG_COLOR,
Marc Blank48a4aed2012-03-10 14:07:00 -0800705 FolderColumns.FG_COLOR,
Mindy Pereirac1e87902012-06-26 11:51:41 -0700706 FolderColumns.LOAD_MORE_URI,
Scott Kennedy7c8325d2013-02-28 10:46:10 -0800707 FolderColumns.HIERARCHICAL_DESC,
Vikram Aggarwala3bbac02013-07-03 15:53:44 -0700708 FolderColumns.LAST_MESSAGE_TIMESTAMP,
709 FolderColumns.PARENT_URI
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800710 };
711
Tony Mantler42fe4862013-10-23 11:39:19 -0700712 public static final String[] FOLDERS_PROJECTION_WITH_UNREAD_SENDERS =
713 (new ImmutableList.Builder<String>()
714 .addAll(ImmutableList.copyOf(FOLDERS_PROJECTION))
715 .add(FolderColumns.UNREAD_SENDERS)
716 .build().toArray(new String[0]));
717
Mindy Pereira7e5de7a2012-03-13 15:36:03 -0700718 public static final int FOLDER_ID_COLUMN = 0;
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800719 public static final int FOLDER_PERSISTENT_ID_COLUMN = 1;
720 public static final int FOLDER_URI_COLUMN = 2;
721 public static final int FOLDER_NAME_COLUMN = 3;
722 public static final int FOLDER_HAS_CHILDREN_COLUMN = 4;
723 public static final int FOLDER_CAPABILITIES_COLUMN = 5;
724 public static final int FOLDER_SYNC_WINDOW_COLUMN = 6;
725 public static final int FOLDER_CONVERSATION_LIST_URI_COLUMN = 7;
726 public static final int FOLDER_CHILD_FOLDERS_LIST_COLUMN = 8;
Scott Kennedy61bd0e82012-12-10 18:18:17 -0800727 public static final int FOLDER_UNSEEN_COUNT_COLUMN = 9;
728 public static final int FOLDER_UNREAD_COUNT_COLUMN = 10;
729 public static final int FOLDER_TOTAL_COUNT_COLUMN = 11;
730 public static final int FOLDER_REFRESH_URI_COLUMN = 12;
731 public static final int FOLDER_SYNC_STATUS_COLUMN = 13;
732 public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 14;
733 public static final int FOLDER_TYPE_COLUMN = 15;
734 public static final int FOLDER_ICON_RES_ID_COLUMN = 16;
735 public static final int FOLDER_NOTIFICATION_ICON_RES_ID_COLUMN = 17;
736 public static final int FOLDER_BG_COLOR_COLUMN = 18;
737 public static final int FOLDER_FG_COLOR_COLUMN = 19;
738 public static final int FOLDER_LOAD_MORE_URI_COLUMN = 20;
739 public static final int FOLDER_HIERARCHICAL_DESC_COLUMN = 21;
Scott Kennedy7c8325d2013-02-28 10:46:10 -0800740 public static final int FOLDER_LAST_MESSAGE_TIMESTAMP_COLUMN = 22;
Vikram Aggarwala3bbac02013-07-03 15:53:44 -0700741 public static final int FOLDER_PARENT_URI_COLUMN = 23;
Mindy Pereira78664722012-03-05 13:53:07 -0800742
743 public static final class FolderType {
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700744 /** A user defined label. */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700745 public static final int DEFAULT = 1 << 0;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700746 /** A system defined inbox */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700747 public static final int INBOX = 1 << 1;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700748 /** A system defined containing mails to be edited before sending. */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700749 public static final int DRAFT = 1 << 2;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700750 /** A system defined folder containing mails <b>to be</b> sent */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700751 public static final int OUTBOX = 1 << 3;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700752 /** A system defined folder containing sent mails */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700753 public static final int SENT = 1 << 4;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700754 /** A system defined trash folder */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700755 public static final int TRASH = 1 << 5;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700756 /** A system defined spam folder */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700757 public static final int SPAM = 1 << 6;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700758 /** A system defined starred folder */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700759 public static final int STARRED = 1 << 7;
Vikram Aggarwal58cad2e2012-08-28 16:18:23 -0700760 /** Any other system label that we do not have a specific name for. */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700761 public static final int OTHER_PROVIDER_FOLDER = 1 << 8;
Scott Kennedydd2ec682013-06-03 19:16:13 -0700762 /** All mail folder */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700763 public static final int ALL_MAIL = 1 << 9;
Scott Kennedydd2ec682013-06-03 19:16:13 -0700764 /** Gmail's inbox sections */
Scott Kennedy8c1058e2013-03-20 13:40:20 -0700765 public static final int INBOX_SECTION = 1 << 10;
Andrew Sappersteine58a66c2013-06-26 16:27:02 -0700766 /** A system defined unread folder */
767 public static final int UNREAD = 1 << 11;
Scott Kennedya158ac82013-09-04 13:48:13 -0700768 /** A "fake" search folder */
769 public static final int SEARCH = 1 << 12;
Mindy Pereira78664722012-03-05 13:53:07 -0800770 }
Mindy Pereira818143e2012-01-11 13:59:49 -0800771
Mindy Pereira0973b202011-12-21 15:48:12 -0800772 public static final class FolderCapabilities {
773 public static final int SYNCABLE = 0x0001;
774 public static final int PARENT = 0x0002;
Andrew Sappersteinf33d7d42013-09-03 15:11:25 -0700775 // FEEL FREE TO USE 0x0004 - was previous CAN_HOLD_MAIL but that was true for all
776 // folders so we removed that value
Mindy Pereira0973b202011-12-21 15:48:12 -0800777 public static final int CAN_ACCEPT_MOVED_MESSAGES = 0x0008;
Marc Blanka8352052012-04-04 11:37:48 -0700778 /**
Paul Westbrook334e64a2012-02-23 13:26:35 -0800779 * For accounts that support archive, this will indicate that this folder supports
780 * the archive functionality.
781 */
782 public static final int ARCHIVE = 0x0010;
783
784 /**
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700785 * This will indicated that this folder supports the delete functionality.
786 */
787 public static final int DELETE = 0x0020;
788
789 /**
Paul Westbrook334e64a2012-02-23 13:26:35 -0800790 * For accounts that support report spam, this will indicate that this folder supports
791 * the report spam functionality.
792 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700793 public static final int REPORT_SPAM = 0x0040;
Paul Westbrook334e64a2012-02-23 13:26:35 -0800794
795 /**
Paul Westbrook77eee622012-07-10 13:41:57 -0700796 * For accounts that support report spam, this will indicate that this folder supports
Paul Westbrook76b20622012-07-12 11:45:43 -0700797 * the mark not spam functionality.
Paul Westbrook77eee622012-07-10 13:41:57 -0700798 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700799 public static final int MARK_NOT_SPAM = 0x0080;
Paul Westbrook77eee622012-07-10 13:41:57 -0700800
801 /**
Paul Westbrook334e64a2012-02-23 13:26:35 -0800802 * For accounts that support mute, this will indicate if a mute is performed from within
803 * this folder, the action is destructive.
804 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700805 public static final int DESTRUCTIVE_MUTE = 0x0100;
Marc Blanka8352052012-04-04 11:37:48 -0700806
807 /**
808 * Indicates that a folder supports settings (sync lookback, etc.)
809 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700810 public static final int SUPPORTS_SETTINGS = 0x0200;
Vikram Aggarwal04dc8192012-04-09 13:07:19 -0700811 /**
812 * All the messages in this folder are important.
813 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700814 public static final int ONLY_IMPORTANT = 0x0400;
Marc Blank386243f2012-05-25 10:40:59 -0700815 /**
816 * Deletions in this folder can't be undone (could include archive if desirable)
817 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700818 public static final int DELETE_ACTION_FINAL = 0x0800;
Marc Blanka6b671d2012-05-25 12:52:02 -0700819 /**
820 * This folder is virtual, i.e. contains conversations potentially pulled from other
821 * folders, potentially even from different accounts. Examples might be a "starred"
822 * folder, or an "unread" folder (per account or provider-wide)
823 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700824 public static final int IS_VIRTUAL = 0x1000;
Paul Westbrook76b20622012-07-12 11:45:43 -0700825
826 /**
827 * For accounts that support report phishing, this will indicate that this folder supports
828 * the report phishing functionality.
829 */
Paul Westbrook6102c7d2012-08-19 13:20:24 -0700830 public static final int REPORT_PHISHING = 0x2000;
Rohan Shah6f95dd22013-02-08 10:13:52 -0800831
832 /**
833 * The flag indicates that the user has the ability to move conversations
834 * from this folder.
835 */
836 public static final int ALLOWS_REMOVE_CONVERSATION = 0x4000;
Scott Kennedye7e01632013-04-25 17:08:53 -0700837
838 /**
839 * The flag indicates that the user has the ability to move conversations to or from this
840 * Folder in the same operation as other Folder changes (usually through
Scott Kennedyd3728042013-04-25 20:23:10 -0700841 * {@link com.android.mail.ui.MultiFoldersSelectionDialog}).
Scott Kennedye7e01632013-04-25 17:08:53 -0700842 */
843 public static final int MULTI_MOVE = 0x8000;
Scott Kennedydd2ec682013-06-03 19:16:13 -0700844
845 /**
846 * This flag indicates that a conversation may be moved from this folder into the account's
847 * inbox.
848 */
849 public static final int ALLOWS_MOVE_TO_INBOX = 0x10000;
Mindy Pereira0973b202011-12-21 15:48:12 -0800850 }
851
Tony Mantler70147a92013-10-14 16:34:45 -0700852 public static final class FolderColumns implements BaseColumns {
Paul Westbrook0b63e8d2012-03-13 11:52:42 -0700853 /**
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800854 * This string column contains an id for the folder that is constant across devices, or
855 * null if there is no constant id.
856 */
857 public static final String PERSISTENT_ID = "persistentId";
858 /**
Paul Westbrook0b63e8d2012-03-13 11:52:42 -0700859 * This string column contains the uri of the folder.
860 */
Mindy Pereira77528642012-02-17 15:51:10 -0800861 public static final String URI = "folderUri";
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800862 /**
863 * This string column contains the human visible name for the folder.
864 */
865 public static final String NAME = "name";
866 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800867 * This int column represents the capabilities of the folder specified by
868 * FolderCapabilities flags.
869 */
Paul Westbrookb8911732013-04-28 11:54:49 -0700870 public static final String CAPABILITIES = "capabilities";
Mindy Pereira0973b202011-12-21 15:48:12 -0800871 /**
Mindy Pereirafc2277e2012-01-11 10:23:44 -0800872 * This int column represents whether or not this folder has any
Mindy Pereira750cc732011-12-21 13:32:29 -0800873 * child folders.
874 */
Paul Westbrookb8911732013-04-28 11:54:49 -0700875 public static final String HAS_CHILDREN = "hasChildren";
Mindy Pereira750cc732011-12-21 13:32:29 -0800876 /**
Mindy Pereira0973b202011-12-21 15:48:12 -0800877 * This int column represents how large the sync window is.
878 */
Paul Westbrookb8911732013-04-28 11:54:49 -0700879 public static final String SYNC_WINDOW = "syncWindow";
Mindy Pereira0973b202011-12-21 15:48:12 -0800880 /**
Mindy Pereira750cc732011-12-21 13:32:29 -0800881 * This string column contains the content provider uri to return the
882 * list of conversations for this folder.
Mindy Pereira3a565bf2011-12-21 11:26:21 -0800883 */
884 public static final String CONVERSATION_LIST_URI = "conversationListUri";
Mindy Pereira750cc732011-12-21 13:32:29 -0800885 /**
886 * This string column contains the content provider uri to return the
887 * list of child folders of this folder.
888 */
Mindy Pereira77528642012-02-17 15:51:10 -0800889 public static final String CHILD_FOLDERS_LIST_URI = "childFoldersListUri";
Scott Kennedy61bd0e82012-12-10 18:18:17 -0800890 /**
891 * This int column contains the current unseen count for the folder, if known.
892 */
893 public static final String UNSEEN_COUNT = "unseenCount";
894 /**
895 * This int column contains the current unread count for the folder.
896 */
Mindy Pereira77528642012-02-17 15:51:10 -0800897 public static final String UNREAD_COUNT = "unreadCount";
Mindy Pereirabd8f51c2012-01-06 13:41:48 -0800898
Mindy Pereira77528642012-02-17 15:51:10 -0800899 public static final String TOTAL_COUNT = "totalCount";
Mindy Pereira9c002102012-02-17 14:45:58 -0800900 /**
901 * This string column contains the content provider uri to force a
902 * refresh of this folder.
903 */
Mindy Pereira77528642012-02-17 15:51:10 -0800904 public static final String REFRESH_URI = "refreshUri";
905 /**
Marc Blank9ace18a2012-02-21 16:34:07 -0800906 * This int column contains current sync status of the folder; some combination of the
907 * SyncStatus bits defined above
Mindy Pereira77528642012-02-17 15:51:10 -0800908 */
Marc Blank9ace18a2012-02-21 16:34:07 -0800909 public static final String SYNC_STATUS = "syncStatus";
910 /**
911 * This int column contains the sync status of the last sync attempt; one of the
912 * LastSyncStatus values defined above
913 */
914 public static final String LAST_SYNC_RESULT = "lastSyncResult";
Mindy Pereira78664722012-03-05 13:53:07 -0800915 /**
Scott Kennedy61bd0e82012-12-10 18:18:17 -0800916 * This int column contains the icon res id for this folder, or 0 if there is none.
Mindy Pereira78664722012-03-05 13:53:07 -0800917 */
918 public static final String ICON_RES_ID = "iconResId";
919 /**
Scott Kennedy61bd0e82012-12-10 18:18:17 -0800920 * This int column contains the notification icon res id for this folder, or 0 if there is
921 * none.
922 */
923 public static final String NOTIFICATION_ICON_RES_ID = "notificationIconResId";
924 /**
Mindy Pereira78664722012-03-05 13:53:07 -0800925 * This int column contains the type of the folder. Zero is default.
926 */
927 public static final String TYPE = "type";
Mindy Pereira9275a062012-03-08 15:12:14 -0800928 /**
929 * String representing the integer background color associated with this
930 * folder, or null.
931 */
932 public static final String BG_COLOR = "bgColor";
933 /**
934 * String representing the integer of the foreground color associated
935 * with this folder, or null.
936 */
937 public static final String FG_COLOR = "fgColor";
Marc Blank48a4aed2012-03-10 14:07:00 -0800938 /**
939 * String with the content provider Uri used to request more items in the folder, or null.
940 */
941 public static final String LOAD_MORE_URI = "loadMoreUri";
Vikram Aggarwal27d89ad2012-06-12 13:38:40 -0700942
Mindy Pereirac1e87902012-06-26 11:51:41 -0700943 /**
944 * Possibly empty string that describes the full hierarchy of a folder
945 * along with its name.
946 */
947 public static final String HIERARCHICAL_DESC = "hierarchicalDesc";
948
Scott Kennedy7c8325d2013-02-28 10:46:10 -0800949 /**
950 * The timestamp of the last message received in this folder.
951 */
952 public static final String LAST_MESSAGE_TIMESTAMP = "lastMessageTimestamp";
953
Vikram Aggarwala3bbac02013-07-03 15:53:44 -0700954 /**
955 * The URI, possibly null, of the parent folder.
956 */
957 public static final String PARENT_URI = "parentUri";
958
Tony Mantler42fe4862013-10-23 11:39:19 -0700959 /**
960 * A string of unread senders sorted by date, so we don't have to fetch this in multiple
961 * queries
962 */
963 public static final String UNREAD_SENDERS = "unreadSenders";
964
Vikram Aggarwalff7d02a2012-01-11 16:37:45 -0800965 public FolderColumns() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -0800966 }
967
Mindy Pereiraa1406072011-12-22 10:54:06 -0800968 // We define a "folder" as anything that contains a list of conversations.
969 public static final String CONVERSATION_LIST_TYPE =
970 "vnd.android.cursor.dir/vnd.com.android.mail.conversation";
971 public static final String CONVERSATION_TYPE =
972 "vnd.android.cursor.item/vnd.com.android.mail.conversation";
973
Mindy Pereira9cdc4062012-02-02 14:18:08 -0800974
Mindy Pereiraa1406072011-12-22 10:54:06 -0800975 public static final String[] CONVERSATION_PROJECTION = {
976 BaseColumns._ID,
Mindy Pereira6349a042012-01-04 11:25:01 -0800977 ConversationColumns.URI,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800978 ConversationColumns.MESSAGE_LIST_URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -0800979 ConversationColumns.SUBJECT,
Mindy Pereiraf9573c52011-12-22 14:02:49 -0800980 ConversationColumns.SNIPPET,
Mindy Pereira648df3f2012-07-19 09:20:26 -0700981 ConversationColumns.CONVERSATION_INFO,
Mindy Pereiraf30cc092011-12-29 14:02:40 -0800982 ConversationColumns.DATE_RECEIVED_MS,
Mindy Pereira4db59c52012-01-12 09:45:13 -0800983 ConversationColumns.HAS_ATTACHMENTS,
984 ConversationColumns.NUM_MESSAGES,
985 ConversationColumns.NUM_DRAFTS,
986 ConversationColumns.SENDING_STATE,
Marc Blankc8a99422012-01-19 14:27:47 -0800987 ConversationColumns.PRIORITY,
988 ConversationColumns.READ,
Scott Kennedyd5edd2d2012-12-05 11:11:32 -0800989 ConversationColumns.SEEN,
Mindy Pereira36b6c8b2012-02-03 14:16:07 -0800990 ConversationColumns.STARRED,
Mindy Pereira22657522012-03-14 13:27:59 -0700991 ConversationColumns.RAW_FOLDERS,
992 ConversationColumns.FLAGS,
Mindy Pereira87d535f2012-03-23 11:15:56 -0700993 ConversationColumns.PERSONAL_LEVEL,
994 ConversationColumns.SPAM,
Paul Westbrook76b20622012-07-12 11:45:43 -0700995 ConversationColumns.PHISHING,
Marc Blank92939fc2012-04-30 14:58:40 -0700996 ConversationColumns.MUTED,
Marc Blanka6b671d2012-05-25 12:52:02 -0700997 ConversationColumns.COLOR,
Mindy Pereira648df3f2012-07-19 09:20:26 -0700998 ConversationColumns.ACCOUNT_URI,
Paul Westbrook41dca182012-08-07 10:43:42 -0700999 ConversationColumns.SENDER_INFO,
Andy Huangf98bc892012-08-07 18:22:09 -07001000 ConversationColumns.CONVERSATION_BASE_URI,
Mark Wei479505d2013-03-21 06:04:46 -07001001 ConversationColumns.REMOTE,
1002 ConversationColumns.ATTACHMENT_PREVIEW_URI0,
1003 ConversationColumns.ATTACHMENT_PREVIEW_URI1,
1004 ConversationColumns.ATTACHMENT_PREVIEW_STATES,
1005 ConversationColumns.ATTACHMENT_PREVIEWS_COUNT,
Mindy Pereiraa1406072011-12-22 10:54:06 -08001006 };
1007
Paul Westbrook5bb0f802013-06-06 10:01:15 -07001008 /**
1009 * This integer corresponds to the number of rows of queries that specify the
1010 * {@link UIProvider#CONVERSATION_PROJECTION} projection will fit in a single
1011 * {@link android.database.CursorWindow}
1012 */
Alice Yang25e67722013-08-28 13:01:53 -07001013 public static final int CONVERSATION_PROJECTION_QUERY_CURSOR_WINDOW_LIMT = 1500;
Paul Westbrook5bb0f802013-06-06 10:01:15 -07001014
Mindy Pereirafdd984b2011-12-29 09:43:45 -08001015 // These column indexes only work when the caller uses the
1016 // default CONVERSATION_PROJECTION defined above.
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -08001017 public static final int CONVERSATION_ID_COLUMN = 0;
Mindy Pereira3263fa92012-01-04 10:15:32 -08001018 public static final int CONVERSATION_URI_COLUMN = 1;
1019 public static final int CONVERSATION_MESSAGE_LIST_URI_COLUMN = 2;
1020 public static final int CONVERSATION_SUBJECT_COLUMN = 3;
1021 public static final int CONVERSATION_SNIPPET_COLUMN = 4;
Mindy Pereira648df3f2012-07-19 09:20:26 -07001022 public static final int CONVERSATION_INFO_COLUMN = 5;
Mindy Pereira3263fa92012-01-04 10:15:32 -08001023 public static final int CONVERSATION_DATE_RECEIVED_MS_COLUMN = 6;
1024 public static final int CONVERSATION_HAS_ATTACHMENTS_COLUMN = 7;
Mindy Pereira4db59c52012-01-12 09:45:13 -08001025 public static final int CONVERSATION_NUM_MESSAGES_COLUMN = 8;
1026 public static final int CONVERSATION_NUM_DRAFTS_COLUMN = 9;
1027 public static final int CONVERSATION_SENDING_STATE_COLUMN = 10;
1028 public static final int CONVERSATION_PRIORITY_COLUMN = 11;
Marc Blankc8a99422012-01-19 14:27:47 -08001029 public static final int CONVERSATION_READ_COLUMN = 12;
Scott Kennedyd5edd2d2012-12-05 11:11:32 -08001030 public static final int CONVERSATION_SEEN_COLUMN = 13;
1031 public static final int CONVERSATION_STARRED_COLUMN = 14;
1032 public static final int CONVERSATION_RAW_FOLDERS_COLUMN = 15;
1033 public static final int CONVERSATION_FLAGS_COLUMN = 16;
1034 public static final int CONVERSATION_PERSONAL_LEVEL_COLUMN = 17;
1035 public static final int CONVERSATION_IS_SPAM_COLUMN = 18;
1036 public static final int CONVERSATION_IS_PHISHING_COLUMN = 19;
1037 public static final int CONVERSATION_MUTED_COLUMN = 20;
1038 public static final int CONVERSATION_COLOR_COLUMN = 21;
1039 public static final int CONVERSATION_ACCOUNT_URI_COLUMN = 22;
1040 public static final int CONVERSATION_SENDER_INFO_COLUMN = 23;
1041 public static final int CONVERSATION_BASE_URI_COLUMN = 24;
1042 public static final int CONVERSATION_REMOTE_COLUMN = 25;
Mark Wei479505d2013-03-21 06:04:46 -07001043 public static final int CONVERSATION_ATTACHMENT_PREVIEW_URI0_COLUMN = 26;
1044 public static final int CONVERSATION_ATTACHMENT_PREVIEW_URI1_COLUMN = 27;
1045 public static final int CONVERSATION_ATTACHMENT_PREVIEW_STATES_COLUMN = 28;
1046 public static final int CONVERSATION_ATTACHMENT_PREVIEWS_COUNT_COLUMN = 29;
Mindy Pereira4db59c52012-01-12 09:45:13 -08001047
1048 public static final class ConversationSendingState {
Mindy Pereiraa4571372012-01-12 14:04:21 -08001049 public static final int OTHER = 0;
Paul Westbrook2c636302012-08-03 10:12:41 -07001050 public static final int QUEUED = 1;
1051 public static final int SENDING = 2;
1052 public static final int SENT = 3;
Mindy Pereira4db59c52012-01-12 09:45:13 -08001053 public static final int SEND_ERROR = -1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -08001054 }
Mindy Pereira4db59c52012-01-12 09:45:13 -08001055
1056 public static final class ConversationPriority {
Mindy Pereira22657522012-03-14 13:27:59 -07001057 public static final int DEFAULT = 0;
1058 public static final int IMPORTANT = 1;
Mindy Pereira4db59c52012-01-12 09:45:13 -08001059 public static final int LOW = 0;
1060 public static final int HIGH = 1;
Vikram Aggarwal859681b2012-02-03 10:02:24 -08001061 }
Mindy Pereirafa7ef6e2011-12-29 14:18:15 -08001062
Mindy Pereira22657522012-03-14 13:27:59 -07001063 public static final class ConversationPersonalLevel {
1064 public static final int NOT_TO_ME = 0;
1065 public static final int TO_ME_AND_OTHERS = 1;
1066 public static final int ONLY_TO_ME = 2;
1067 }
1068
Marc Blankc8a99422012-01-19 14:27:47 -08001069 public static final class ConversationFlags {
Marc Blankc8a99422012-01-19 14:27:47 -08001070 public static final int REPLIED = 1<<2;
1071 public static final int FORWARDED = 1<<3;
Mindy Pereirad69f5ad2012-03-14 13:20:24 -07001072 public static final int CALENDAR_INVITE = 1<<4;
Vikram Aggarwal859681b2012-02-03 10:02:24 -08001073 }
Marc Blankc8a99422012-01-19 14:27:47 -08001074
Paul Westbrook76b20622012-07-12 11:45:43 -07001075 public static final class ConversationPhishing {
1076 public static final int NOT_PHISHING = 0;
1077 public static final int PHISHING = 1;
1078 }
1079
Vikram Aggarwal531488e2012-05-29 16:36:52 -07001080 /**
1081 * Names of columns representing fields in a Conversation.
1082 */
Mindy Pereiraa1406072011-12-22 10:54:06 -08001083 public static final class ConversationColumns {
Mindy Pereira6349a042012-01-04 11:25:01 -08001084 public static final String URI = "conversationUri";
Mindy Pereiraa1406072011-12-22 10:54:06 -08001085 /**
Mindy Pereiraa1406072011-12-22 10:54:06 -08001086 * This string column contains the content provider uri to return the
1087 * list of messages for this conversation.
Paul Westbrook9cf43892012-03-15 15:43:47 -07001088 * The cursor returned by this query can return a {@link android.os.Bundle}
1089 * from a call to {@link android.database.Cursor#getExtras()}. This Bundle may have
1090 * values with keys listed in {@link CursorExtraKeys}
Mindy Pereiraa1406072011-12-22 10:54:06 -08001091 */
1092 public static final String MESSAGE_LIST_URI = "messageListUri";
Mindy Pereira27a0cf02011-12-22 13:16:32 -08001093 /**
1094 * This string column contains the subject string for a conversation.
1095 */
1096 public static final String SUBJECT = "subject";
1097 /**
1098 * This string column contains the snippet string for a conversation.
1099 */
1100 public static final String SNIPPET = "snippet";
1101 /**
Mindy Pereira648df3f2012-07-19 09:20:26 -07001102 * @deprecated
Mindy Pereira27a0cf02011-12-22 13:16:32 -08001103 */
Mark Weif6fac0a2013-02-11 20:58:17 -08001104 @Deprecated
Mindy Pereira27a0cf02011-12-22 13:16:32 -08001105 public static final String SENDER_INFO = "senderInfo";
1106 /**
Andy Huang351ad4e2012-12-06 16:04:58 -08001107 * This blob column contains the byte-array representation of the Parceled
1108 * ConversationInfo object for a conversation.
Andy Huang7f39bbd2013-05-20 20:36:38 -07001109 *
1110 * @deprecated providers should implement
1111 * {@link ConversationCursorCommand#COMMAND_GET_CONVERSATION_INFO} instead.
Mindy Pereira648df3f2012-07-19 09:20:26 -07001112 */
Andy Huang7f39bbd2013-05-20 20:36:38 -07001113 @Deprecated
Mindy Pereira648df3f2012-07-19 09:20:26 -07001114 public static final String CONVERSATION_INFO = "conversationInfo";
1115 /**
Mindy Pereira27a0cf02011-12-22 13:16:32 -08001116 * This long column contains the time in ms of the latest update to a
1117 * conversation.
1118 */
1119 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
1120
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001121 /**
1122 * This boolean column contains whether any messages in this conversation
1123 * have attachments.
1124 */
1125 public static final String HAS_ATTACHMENTS = "hasAttachments";
1126
Mindy Pereira4db59c52012-01-12 09:45:13 -08001127 /**
1128 * This int column contains the number of messages in this conversation.
1129 * For unthreaded, this will always be 1.
1130 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001131 public static final String NUM_MESSAGES = "numMessages";
Mindy Pereira4db59c52012-01-12 09:45:13 -08001132
1133 /**
1134 * This int column contains the number of drafts associated with this
1135 * conversation.
1136 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001137 public static final String NUM_DRAFTS = "numDrafts";
Mindy Pereira4db59c52012-01-12 09:45:13 -08001138
1139 /**
1140 * This int column contains the state of drafts and replies associated
1141 * with this conversation. Use ConversationSendingState to interpret
1142 * this field.
1143 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001144 public static final String SENDING_STATE = "sendingState";
Mindy Pereira4db59c52012-01-12 09:45:13 -08001145
1146 /**
1147 * This int column contains the priority of this conversation. Use
1148 * ConversationPriority to interpret this field.
1149 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001150 public static final String PRIORITY = "priority";
Mindy Pereira4db59c52012-01-12 09:45:13 -08001151
Marc Blankc8a99422012-01-19 14:27:47 -08001152 /**
Mindy Pereira87d535f2012-03-23 11:15:56 -07001153 * This int column indicates whether the conversation has been read
Marc Blankc8a99422012-01-19 14:27:47 -08001154 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001155 public static final String READ = "read";
Scott Kennedyd5edd2d2012-12-05 11:11:32 -08001156
1157 /**
1158 * This int column indicates whether the conversation has been seen
1159 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001160 public static final String SEEN = "seen";
Scott Kennedyd5edd2d2012-12-05 11:11:32 -08001161
Marc Blankc8a99422012-01-19 14:27:47 -08001162 /**
Mindy Pereira87d535f2012-03-23 11:15:56 -07001163 * This int column indicates whether the conversation has been starred
Marc Blankc8a99422012-01-19 14:27:47 -08001164 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001165 public static final String STARRED = "starred";
Marc Blankc8a99422012-01-19 14:27:47 -08001166
Mindy Pereira36b6c8b2012-02-03 14:16:07 -08001167 /**
Andy Huangb2033d82012-12-07 19:30:57 -08001168 * This blob column contains the marshalled form of a Parceled
1169 * {@FolderList} object. Ideally, only ever use this for
1170 * rendering the folder list for a conversation.
Andy Huang7f39bbd2013-05-20 20:36:38 -07001171 *
1172 * @deprecated providers should implement
1173 * {@link ConversationCursorCommand#COMMAND_GET_RAW_FOLDERS} instead.
Mindy Pereiracc8211d2012-03-12 10:35:37 -07001174 */
Andy Huang7f39bbd2013-05-20 20:36:38 -07001175 @Deprecated
Mindy Pereira183718b2012-03-12 11:00:14 -07001176 public static final String RAW_FOLDERS = "rawFolders";
Mindy Pereira22657522012-03-14 13:27:59 -07001177 public static final String FLAGS = "conversationFlags";
Andy Huang1284fd62012-07-12 16:48:06 -07001178 /**
1179 * This int column indicates the personal level of a conversation per
1180 * {@link ConversationPersonalLevel}.
1181 */
Mindy Pereira22657522012-03-14 13:27:59 -07001182 public static final String PERSONAL_LEVEL = "personalLevel";
Mindy Pereira87d535f2012-03-23 11:15:56 -07001183
1184 /**
1185 * This int column indicates whether the conversation is marked spam.
1186 */
1187 public static final String SPAM = "spam";
1188
1189 /**
Paul Westbrook76b20622012-07-12 11:45:43 -07001190 * This int column indicates whether the conversation is marked phishing.
1191 */
1192 public static final String PHISHING = "phishing";
1193
1194 /**
Mindy Pereira87d535f2012-03-23 11:15:56 -07001195 * This int column indicates whether the conversation was muted.
1196 */
1197 public static final String MUTED = "muted";
1198
Marc Blank92939fc2012-04-30 14:58:40 -07001199 /**
1200 * This int column contains a color for the conversation (used in Email only)
1201 */
1202 public static final String COLOR = "color";
1203
Marc Blanka6b671d2012-05-25 12:52:02 -07001204 /**
1205 * This String column contains the Uri for this conversation's account
1206 */
1207 public static final String ACCOUNT_URI = "accountUri";
Vikram Aggarwal66bc2aa2012-08-02 10:47:03 -07001208 /**
Andy Huangf98bc892012-08-07 18:22:09 -07001209 * This int column indicates whether a conversation is remote (non-local), and would require
1210 * a network fetch to load.
1211 */
1212 public static final String REMOTE = "remote";
1213 /**
Vikram Aggarwal66bc2aa2012-08-02 10:47:03 -07001214 * This int column indicates whether the conversation was displayed on the UI and the
1215 * user got a chance to read it. The UI does not read this value, it is meant only to
1216 * write the status back to the provider. As a result, it is not available in the
1217 * {@link Conversation} object.
1218 */
Andy Huangf98bc892012-08-07 18:22:09 -07001219 public static final String VIEWED = "viewed";
Paul Westbrook41dca182012-08-07 10:43:42 -07001220 /**
1221 * This String column contains the base uri for this conversation. This uri can be used
1222 * when handling relative urls in the message content
1223 */
1224 public static final String CONVERSATION_BASE_URI = "conversationBaseUri";
1225
Mark Wei479505d2013-03-21 06:04:46 -07001226 /**
1227 * This string column contains the uri of the first attachment preview of the first unread
1228 * message, denoted by UNREAD_MESSAGE_ID.
1229 */
1230 public static final String ATTACHMENT_PREVIEW_URI0 = "attachmentPreviewUri0";
1231
1232 /**
1233 * This string column contains the uri of the second attachment preview of the first unread
1234 * message, denoted by UNREAD_MESSAGE_ID.
1235 */
1236 public static final String ATTACHMENT_PREVIEW_URI1 = "attachmentPreviewUri1";
1237
1238 /**
1239 * This int column contains the states of the attachment previews of the first unread
1240 * message, the same message used for the snippet. The states is a packed int,
1241 * where the first and second bits represent the SIMPLE and BEST state of the first
1242 * attachment preview, while the third and fourth bits represent those states for the
1243 * second attachment preview. For each bit, a one means that rendition of that attachment
1244 * preview is downloaded.
1245 */
1246 public static final String ATTACHMENT_PREVIEW_STATES = "attachmentPreviewStates";
1247
1248 /**
1249 * This int column contains the total count of images in the first unread message. The
1250 * total count may be higher than the number of ATTACHMENT_PREVIEW_URI columns.
1251 */
1252 public static final String ATTACHMENT_PREVIEWS_COUNT = "attachmentPreviewsCount";
1253
Paul Westbrook334e64a2012-02-23 13:26:35 -08001254 private ConversationColumns() {
Andy Huang732600e2012-01-10 17:47:17 -08001255 }
Mindy Pereiraa1406072011-12-22 10:54:06 -08001256 }
1257
Andy Huangca854412012-04-20 19:55:38 -07001258 public static final class ConversationCursorCommand {
1259
1260 public static final String COMMAND_RESPONSE_OK = "ok";
1261 public static final String COMMAND_RESPONSE_FAILED = "failed";
1262
1263 /**
Andy Huangd521baf2013-05-21 18:08:08 -07001264 * Incoming bundles may include this key with an Integer bitfield value. See below for bit
1265 * values.
1266 */
1267 public static final String COMMAND_KEY_OPTIONS = "options";
1268
1269 /**
1270 * Clients must set this bit when the {@link Cursor#respond(Bundle)} call is being used to
1271 * fetch a {@link Parcelable}. It serves as a hint that this call requires the cursor
1272 * position to first safely be moved.
1273 */
1274 public static final int OPTION_MOVE_POSITION = 0x01;
1275
1276 /**
Paul Westbrook9f119c72012-04-24 16:10:59 -07001277 * This bundle key has a boolean value: true to indicate that this cursor has been shown
1278 * to the user.
Vikram Aggarwal69b5c302012-09-05 11:11:13 -07001279 * <p>
1280 * A provider that implements this command should include this key in its response with a
1281 * value of {@link #COMMAND_RESPONSE_OK} or {@link #COMMAND_RESPONSE_FAILED}.
Paul Westbrook9f119c72012-04-24 16:10:59 -07001282 */
1283 public static final String COMMAND_KEY_SET_VISIBILITY = "setVisibility";
1284
Vikram Aggarwal69b5c302012-09-05 11:11:13 -07001285 /**
1286 * This key has a boolean value: true to indicate that this folder list is shown to the user
1287 * either on first call (launcher/widget/notification) or after switching from an existing
1288 * folder: Inbox -> Folder. Repeated calls are sent when switching back to the folder. Inbox
1289 * -> Folder -> Spam -> Folder will generate two calls to respond() with the value true for
1290 * "Folder".
1291 * <p>
1292 * A provider that implements this command should include the
1293 * {@link #COMMAND_KEY_SET_VISIBILITY} key in its response with a value of
1294 * {@link #COMMAND_RESPONSE_OK} or {@link #COMMAND_RESPONSE_FAILED}. This is <b>always</b>
1295 * set with {@link #COMMAND_KEY_SET_VISIBILITY} because this is only set when the folder
1296 * list is made visible.
1297 */
1298 public static final String COMMAND_KEY_ENTERED_FOLDER = "enteredFolder";
1299
Paul Westbrook983a7232013-05-15 12:30:15 -07001300 /**
1301 * This key has an int value, indicating the position that the UI wants to notify the
1302 * provider that the data from a specified row is being shown to the user.
1303 * <p>
1304 * A provider that implements this command should include the
1305 * {@link #COMMAND_NOTIFY_CURSOR_UI_POSITION_CHANGE} key in its response with a value of
1306 * {@link #COMMAND_RESPONSE_OK} or {@link #COMMAND_RESPONSE_FAILED}.
1307 */
1308 public static final String COMMAND_NOTIFY_CURSOR_UI_POSITION_CHANGE = "uiPositionChange";
1309
Andy Huang7f39bbd2013-05-20 20:36:38 -07001310 /**
1311 * Rather than jamming a {@link ConversationInfo} into a byte-array blob to be read out of
1312 * a cursor, providers can optionally implement this command to directly return the object
1313 * in a Bundle.
1314 * <p>
Andy Huangfa225db2013-05-20 22:15:19 -07001315 * The requestor (UI code) will place a meaningless value in the request Bundle. The UI will
1316 * also move the cursor position to the desired place prior to calling respond(). Providers
1317 * should just use {@link Bundle#containsKey(String)} to check for this kind of request and
1318 * generate an object at the current cursor position.
Andy Huang7f39bbd2013-05-20 20:36:38 -07001319 * <p>
1320 * A provider that implements this command should include the
1321 * {@link #COMMAND_GET_CONVERSATION_INFO} key in its response with a
1322 * {@link ConversationInfo} Parcelable object as its value.
1323 */
Andy Huangf8b613c2013-05-24 15:20:44 -07001324 public static final String COMMAND_GET_CONVERSATION_INFO =
1325 ConversationColumns.CONVERSATION_INFO;
Andy Huang7f39bbd2013-05-20 20:36:38 -07001326
1327 /**
1328 * Rather than jamming a {@link FolderList} into a byte-array blob to be read out of
1329 * a cursor, providers can optionally implement this command to directly return the object
1330 * in a Bundle.
1331 * <p>
Andy Huangfa225db2013-05-20 22:15:19 -07001332 * The requestor (UI code) will place a meaningless value in the request Bundle. The UI will
1333 * also move the cursor position to the desired place prior to calling respond(). Providers
1334 * should just use {@link Bundle#containsKey(String)} to check for this kind of request and
1335 * generate an object at the current cursor position.
Andy Huang7f39bbd2013-05-20 20:36:38 -07001336 * <p>
1337 * A provider that implements this command should include the
1338 * {@link #COMMAND_GET_RAW_FOLDERS} key in its response with a
1339 * {@link FolderList} Parcelable object as its value.
1340 */
Andy Huangf8b613c2013-05-24 15:20:44 -07001341 public static final String COMMAND_GET_RAW_FOLDERS = ConversationColumns.RAW_FOLDERS;
Andy Huang7f39bbd2013-05-20 20:36:38 -07001342
Andy Huangca854412012-04-20 19:55:38 -07001343 private ConversationCursorCommand() {}
1344 }
1345
Mindy Pereira6f92de62011-12-19 11:31:48 -08001346 /**
Paul Westbrook334e64a2012-02-23 13:26:35 -08001347 * List of operations that can can be performed on a conversation. These operations are applied
1348 * with {@link ContentProvider#update(Uri, ContentValues, String, String[])}
1349 * where the conversation uri is specified, and the ContentValues specifies the operation to
1350 * be performed.
1351 * <p/>
1352 * The operation to be performed is specified in the ContentValues by
1353 * the {@link ConversationOperations#OPERATION_KEY}
1354 * <p/>
1355 * Note not all UI providers will support these operations. {@link AccountCapabilities} can
1356 * be used to determine which operations are supported.
Mindy Pereira6f92de62011-12-19 11:31:48 -08001357 */
Paul Westbrook334e64a2012-02-23 13:26:35 -08001358 public static final class ConversationOperations {
1359 /**
1360 * ContentValues key used to specify the operation to be performed
1361 */
1362 public static final String OPERATION_KEY = "operation";
1363
1364 /**
1365 * Archive operation
1366 */
1367 public static final String ARCHIVE = "archive";
1368
1369 /**
1370 * Mute operation
1371 */
1372 public static final String MUTE = "mute";
1373
1374 /**
1375 * Report spam operation
1376 */
1377 public static final String REPORT_SPAM = "report_spam";
1378
Paul Westbrook77eee622012-07-10 13:41:57 -07001379 /**
1380 * Report not spam operation
1381 */
1382 public static final String REPORT_NOT_SPAM = "report_not_spam";
1383
Paul Westbrook76b20622012-07-12 11:45:43 -07001384 /**
1385 * Report phishing operation
1386 */
1387 public static final String REPORT_PHISHING = "report_phishing";
1388
Paul Westbrookef362542012-08-27 14:53:32 -07001389 /**
1390 * Discard drafts operation
1391 */
1392 public static final String DISCARD_DRAFTS = "discard_drafts";
1393
mindypcb0b30e2012-11-30 10:16:35 -08001394 /**
1395 * Update conversation folder(s) operation. ContentValues passed as part
1396 * of this update will be of the format (FOLDERS_UPDATED, csv of updated
1397 * folders) where the comma separated values of the updated folders will
1398 * be of the format: folderuri/ADD_VALUE. ADD_VALUE will be true if the
1399 * folder was added, false if it was removed.
1400 */
1401 public static final String FOLDERS_UPDATED = "folders_updated";
1402 public static final String FOLDERS_UPDATED_SPLIT_PATTERN = ",";
Paul Westbrook5109c512012-11-05 11:00:30 -08001403
1404 public static final class Parameters {
1405 /**
1406 * Boolean indicating whether the undo for this operation should be suppressed
1407 */
1408 public static final String SUPPRESS_UNDO = "suppress_undo";
1409
1410 private Parameters() {}
1411 }
1412
Paul Westbrook334e64a2012-02-23 13:26:35 -08001413 private ConversationOperations() {
1414 }
1415 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001416
Paul Westbrook72e2ea82012-10-22 16:25:22 -07001417 /**
1418 * Methods that can be "called" using the account uri, through
Tony Mantlera7165dd2013-08-08 16:09:24 -07001419 * {@link android.content.ContentResolver#call(Uri,String,String,Bundle)}
1420 * Note, the arg parmateter of call should be the account uri.
Paul Westbrook72e2ea82012-10-22 16:25:22 -07001421 */
1422 public static final class AccountCallMethods {
1423 /**
1424 * Save message method. The Bundle for the call to
Tony Mantlera7165dd2013-08-08 16:09:24 -07001425 * {@link android.content.ContentResolver#call(Uri,String,String,Bundle)} should have the
1426 * columns specified in {@link MessageColumns}, and if this is a save for an existing
1427 * message, an entry for the {@link MessageColumns#URI} should reference the existing
1428 * message
Paul Westbrook72e2ea82012-10-22 16:25:22 -07001429 *
1430 * The Bundle returned will contain the message uri in the returned bundled with the
1431 * {@link MessageColumns#URI} key.
1432 */
1433 public static final String SAVE_MESSAGE = "save_message";
1434
1435 /**
1436 * Send message method. The Bundle for the call to
Tony Mantlera7165dd2013-08-08 16:09:24 -07001437 * {@link android.content.ContentResolver#call(Uri,String,String,Bundle)} should have the
1438 * columns specified in {@link MessageColumns}, and if this is a send of an existing
1439 * message, an entry for the {@link MessageColumns#URI} should reference the existing
1440 * message
Paul Westbrook72e2ea82012-10-22 16:25:22 -07001441 *
1442 * The Bundle returned will contain the message uri in the returned bundled with the
1443 * {@link MessageColumns#URI} key.
1444 */
1445 public static final String SEND_MESSAGE = "send_message";
1446
Scott Banachowski53a615d2012-12-19 15:31:20 -08001447 /**
1448 * Change account method. The Bundle for the call to
Tony Mantlera7165dd2013-08-08 16:09:24 -07001449 * {@link android.content.ContentResolver#call(Uri,String,String,Bundle)} should have the
1450 * columns specified in {@link SetCurrentAccountColumns}
Scott Banachowski53a615d2012-12-19 15:31:20 -08001451 *
1452 * The Bundle returned will be empty.
1453 */
1454 public static final String SET_CURRENT_ACCOUNT = "set_current_account";
1455
Paul Westbrook72e2ea82012-10-22 16:25:22 -07001456 private AccountCallMethods() {}
1457 }
1458
Paul Westbrook3c7f94d2012-10-23 14:13:00 -07001459 /**
1460 * Keys used for parameters to {@link AccountCallMethods#SEND_MESSAGE} or
1461 * {@link AccountCallMethods#SAVE_MESSAGE} methods.
1462 */
1463 public static final class SendOrSaveMethodParamKeys {
1464 /**
1465 * Bundle key used to store any opened file descriptors.
1466 * The keys of this Bundle are the contentUri for each attachment, and the
1467 * values are {@link android.os.ParcelFileDescriptor} objects.
1468 */
1469 public static final String OPENED_FD_MAP = "opened_fds";
1470
1471 private SendOrSaveMethodParamKeys() {}
1472 }
1473
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001474 public static final class DraftType {
Andy Huang97c25be2012-01-12 15:12:09 -08001475 public static final int NOT_A_DRAFT = 0;
1476 public static final int COMPOSE = 1;
1477 public static final int REPLY = 2;
1478 public static final int REPLY_ALL = 3;
1479 public static final int FORWARD = 4;
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001480
1481 private DraftType() {}
Mindy Pereira6f92de62011-12-19 11:31:48 -08001482 }
1483
Andrew Sapperstein3b08c512012-07-11 16:51:07 -07001484 /**
1485 * Class for the enum values to determine whether this
1486 * string should be displayed as a high priority warning
1487 * or a low priority warning. The current design has
1488 * high priority warnings in red while low priority warnings
1489 * are grey.
1490 */
1491 public static final class SpamWarningLevel {
1492 public static final int NO_WARNING = 0;
1493 public static final int LOW_WARNING = 1;
1494 public static final int HIGH_WARNING = 2;
1495
1496 private SpamWarningLevel() {}
1497 }
1498
1499 /**
1500 * Class for the enum values to determine which type
1501 * of link to show in the spam warning.
1502 */
1503 public static final class SpamWarningLinkType {
1504 public static final int NO_LINK = 0;
1505 public static final int IGNORE_WARNING = 1;
1506 public static final int REPORT_PHISHING = 2;
1507
1508 private SpamWarningLinkType() {}
1509 }
1510
Mindy Pereiraa1406072011-12-22 10:54:06 -08001511 public static final String[] MESSAGE_PROJECTION = {
1512 BaseColumns._ID,
Mindy Pereira326c6602012-01-04 15:32:42 -08001513 MessageColumns.SERVER_ID,
Mindy Pereiraa1406072011-12-22 10:54:06 -08001514 MessageColumns.URI,
Mindy Pereiraa1406072011-12-22 10:54:06 -08001515 MessageColumns.CONVERSATION_ID,
1516 MessageColumns.SUBJECT,
1517 MessageColumns.SNIPPET,
1518 MessageColumns.FROM,
1519 MessageColumns.TO,
1520 MessageColumns.CC,
1521 MessageColumns.BCC,
1522 MessageColumns.REPLY_TO,
1523 MessageColumns.DATE_RECEIVED_MS,
1524 MessageColumns.BODY_HTML,
1525 MessageColumns.BODY_TEXT,
1526 MessageColumns.EMBEDS_EXTERNAL_RESOURCES,
1527 MessageColumns.REF_MESSAGE_ID,
1528 MessageColumns.DRAFT_TYPE,
Mindy Pereira3ce64e72012-01-13 14:29:45 -08001529 MessageColumns.APPEND_REF_MESSAGE_CONTENT,
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001530 MessageColumns.HAS_ATTACHMENTS,
Mindy Pereira326c6602012-01-04 15:32:42 -08001531 MessageColumns.ATTACHMENT_LIST_URI,
Mindy Pereiraf944e962012-01-17 11:43:36 -08001532 MessageColumns.MESSAGE_FLAGS,
Mindy Pereirae8caf122012-03-20 15:23:31 -07001533 MessageColumns.ALWAYS_SHOW_IMAGES,
Andy Huangd8e249e2012-03-21 17:01:37 -07001534 MessageColumns.READ,
Scott Kennedyd5edd2d2012-12-05 11:11:32 -08001535 MessageColumns.SEEN,
Andy Huangd8e249e2012-03-21 17:01:37 -07001536 MessageColumns.STARRED,
Andy Huang5a929072012-03-23 20:17:10 -07001537 MessageColumns.QUOTE_START_POS,
Mindy Pereira92551d02012-04-05 11:31:12 -07001538 MessageColumns.ATTACHMENTS,
Mindy Pereira62de1b12012-04-06 12:17:56 -07001539 MessageColumns.CUSTOM_FROM_ADDRESS,
Marc Blank3842af92012-04-27 09:06:09 -07001540 MessageColumns.MESSAGE_ACCOUNT_URI,
Andrew Sapperstein3b08c512012-07-11 16:51:07 -07001541 MessageColumns.EVENT_INTENT_URI,
1542 MessageColumns.SPAM_WARNING_STRING,
1543 MessageColumns.SPAM_WARNING_LEVEL,
Andrew Sappersteind5b369b2012-07-13 12:38:46 -07001544 MessageColumns.SPAM_WARNING_LINK_TYPE,
Andy Huang47aa9c92012-07-31 15:37:21 -07001545 MessageColumns.VIA_DOMAIN,
1546 MessageColumns.IS_SENDING
Mindy Pereiraa1406072011-12-22 10:54:06 -08001547 };
1548
Mindy Pereiraf944e962012-01-17 11:43:36 -08001549 /** Separates attachment info parts in strings in a message. */
Andy Huang5c5fd572012-04-08 18:19:29 -07001550 @Deprecated
Mindy Pereiraf944e962012-01-17 11:43:36 -08001551 public static final String MESSAGE_ATTACHMENT_INFO_SEPARATOR = "\n";
Mindy Pereiraa1406072011-12-22 10:54:06 -08001552 public static final String MESSAGE_LIST_TYPE =
1553 "vnd.android.cursor.dir/vnd.com.android.mail.message";
1554 public static final String MESSAGE_TYPE =
1555 "vnd.android.cursor.item/vnd.com.android.mail.message";
Mindy Pereira6f92de62011-12-19 11:31:48 -08001556
Mindy Pereira6349a042012-01-04 11:25:01 -08001557 public static final int MESSAGE_ID_COLUMN = 0;
Mindy Pereira326c6602012-01-04 15:32:42 -08001558 public static final int MESSAGE_SERVER_ID_COLUMN = 1;
1559 public static final int MESSAGE_URI_COLUMN = 2;
Marc Blank26846d82012-03-22 18:12:54 -07001560 public static final int MESSAGE_CONVERSATION_URI_COLUMN = 3;
Mindy Pereira326c6602012-01-04 15:32:42 -08001561 public static final int MESSAGE_SUBJECT_COLUMN = 4;
1562 public static final int MESSAGE_SNIPPET_COLUMN = 5;
1563 public static final int MESSAGE_FROM_COLUMN = 6;
1564 public static final int MESSAGE_TO_COLUMN = 7;
1565 public static final int MESSAGE_CC_COLUMN = 8;
1566 public static final int MESSAGE_BCC_COLUMN = 9;
1567 public static final int MESSAGE_REPLY_TO_COLUMN = 10;
1568 public static final int MESSAGE_DATE_RECEIVED_MS_COLUMN = 11;
Mindy Pereira16668162012-01-11 16:11:19 -08001569 public static final int MESSAGE_BODY_HTML_COLUMN = 12;
1570 public static final int MESSAGE_BODY_TEXT_COLUMN = 13;
Mindy Pereira326c6602012-01-04 15:32:42 -08001571 public static final int MESSAGE_EMBEDS_EXTERNAL_RESOURCES_COLUMN = 14;
Alice Yanga990a712013-03-13 18:37:00 -07001572 public static final int MESSAGE_REF_MESSAGE_URI_COLUMN = 15;
Mindy Pereira326c6602012-01-04 15:32:42 -08001573 public static final int MESSAGE_DRAFT_TYPE_COLUMN = 16;
Mindy Pereira3ce64e72012-01-13 14:29:45 -08001574 public static final int MESSAGE_APPEND_REF_MESSAGE_CONTENT_COLUMN = 17;
1575 public static final int MESSAGE_HAS_ATTACHMENTS_COLUMN = 18;
1576 public static final int MESSAGE_ATTACHMENT_LIST_URI_COLUMN = 19;
1577 public static final int MESSAGE_FLAGS_COLUMN = 20;
Paul Westbrookccf81942013-02-22 17:18:44 -08001578 public static final int MESSAGE_ALWAYS_SHOW_IMAGES_COLUMN = 21;
1579 public static final int MESSAGE_READ_COLUMN = 22;
1580 public static final int MESSAGE_SEEN_COLUMN = 23;
1581 public static final int MESSAGE_STARRED_COLUMN = 24;
1582 public static final int QUOTED_TEXT_OFFSET_COLUMN = 25;
1583 public static final int MESSAGE_ATTACHMENTS_COLUMN = 26;
1584 public static final int MESSAGE_CUSTOM_FROM_ADDRESS_COLUMN = 27;
1585 public static final int MESSAGE_ACCOUNT_URI_COLUMN = 28;
1586 public static final int MESSAGE_EVENT_INTENT_COLUMN = 29;
1587 public static final int MESSAGE_SPAM_WARNING_STRING_ID_COLUMN = 30;
1588 public static final int MESSAGE_SPAM_WARNING_LEVEL_COLUMN = 31;
1589 public static final int MESSAGE_SPAM_WARNING_LINK_TYPE_COLUMN = 32;
1590 public static final int MESSAGE_VIA_DOMAIN_COLUMN = 33;
1591 public static final int MESSAGE_IS_SENDING_COLUMN = 34;
Paul Westbrook9cf43892012-03-15 15:43:47 -07001592
1593 public static final class CursorStatus {
1594 // The cursor is actively loading more data
1595 public static final int LOADING = 1 << 0;
1596
1597 // The cursor is currently not loading more data, but more data may be available
1598 public static final int LOADED = 1 << 1;
1599
1600 // An error occured while loading data
1601 public static final int ERROR = 1 << 2;
1602
1603 // The cursor is loaded, and there will be no more data
1604 public static final int COMPLETE = 1 << 3;
Paul Westbrook573b9e62012-08-02 14:56:17 -07001605
1606 public static boolean isWaitingForResults(int cursorStatus) {
1607 return 0 != (cursorStatus & LOADING);
1608 }
Paul Westbrook9cf43892012-03-15 15:43:47 -07001609 }
1610
1611
1612 public static final class CursorExtraKeys {
1613 /**
1614 * This integer column contains the staus of the message cursor. The value will be
1615 * one defined in {@link CursorStatus}.
1616 */
Paul Westbrook7a3e6572012-08-02 16:33:58 -07001617 public static final String EXTRA_STATUS = "cursor_status";
Paul Westbrook9cf43892012-03-15 15:43:47 -07001618
1619 /**
1620 * Used for finding the cause of an error.
1621 * TODO: define these values
1622 */
Paul Westbrook7a3e6572012-08-02 16:33:58 -07001623 public static final String EXTRA_ERROR = "cursor_error";
Paul Westbrook9cf43892012-03-15 15:43:47 -07001624
Yu Ping Hucbde5fa2013-03-04 21:57:04 -08001625
1626 /**
1627 * This integer column contains the total message count for this folder.
1628 */
1629 public static final String EXTRA_TOTAL_COUNT = "cursor_total_count";
Paul Westbrook9cf43892012-03-15 15:43:47 -07001630 }
1631
Paul Westbrook2388c5d2012-03-25 12:29:11 -07001632 public static final class AccountCursorExtraKeys {
1633 /**
1634 * This integer column contains the staus of the account cursor. The value will be
1635 * 1 if all accounts have been fully loaded or 0 if the account list hasn't been fully
1636 * initialized
1637 */
1638 public static final String ACCOUNTS_LOADED = "accounts_loaded";
1639 }
1640
Paul Westbrook9cf43892012-03-15 15:43:47 -07001641
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001642 public static final class MessageFlags {
Andy Huang47aa9c92012-07-31 15:37:21 -07001643 public static final int REPLIED = 1 << 2;
1644 public static final int FORWARDED = 1 << 3;
1645 public static final int CALENDAR_INVITE = 1 << 4;
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001646 }
1647
Mindy Pereira6f92de62011-12-19 11:31:48 -08001648 public static final class MessageColumns {
Andy Huangdb977472012-01-11 19:53:25 -08001649 /**
1650 * This string column contains a content provider URI that points to this single message.
1651 */
Mindy Pereira6349a042012-01-04 11:25:01 -08001652 public static final String URI = "messageUri";
Andy Huangdb977472012-01-11 19:53:25 -08001653 /**
1654 * This string column contains a server-assigned ID for this message.
1655 */
1656 public static final String SERVER_ID = "serverMessageId";
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001657 public static final String CONVERSATION_ID = "conversationId";
Andy Huangdb977472012-01-11 19:53:25 -08001658 /**
1659 * This string column contains the subject of a message.
1660 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001661 public static final String SUBJECT = "subject";
Andy Huangdb977472012-01-11 19:53:25 -08001662 /**
1663 * This string column contains a snippet of the message body.
1664 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001665 public static final String SNIPPET = "snippet";
Andy Huangdb977472012-01-11 19:53:25 -08001666 /**
1667 * This string column contains the single email address (and optionally name) of the sender.
1668 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001669 public static final String FROM = "fromAddress";
Andy Huangdb977472012-01-11 19:53:25 -08001670 /**
1671 * This string column contains a comma-delimited list of "To:" recipient email addresses.
1672 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001673 public static final String TO = "toAddresses";
Andy Huangdb977472012-01-11 19:53:25 -08001674 /**
1675 * This string column contains a comma-delimited list of "CC:" recipient email addresses.
1676 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001677 public static final String CC = "ccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -08001678 /**
1679 * This string column contains a comma-delimited list of "BCC:" recipient email addresses.
1680 * This value will be null for incoming messages.
1681 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001682 public static final String BCC = "bccAddresses";
Andy Huangdb977472012-01-11 19:53:25 -08001683 /**
1684 * This string column contains the single email address (and optionally name) of the
1685 * sender's reply-to address.
1686 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001687 public static final String REPLY_TO = "replyToAddress";
Andy Huangdb977472012-01-11 19:53:25 -08001688 /**
1689 * This long column contains the timestamp (in millis) of receipt of the message.
1690 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001691 public static final String DATE_RECEIVED_MS = "dateReceivedMs";
Andy Huangdb977472012-01-11 19:53:25 -08001692 /**
1693 * This string column contains the HTML form of the message body, if available. If not,
1694 * a provider must populate BODY_TEXT.
1695 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001696 public static final String BODY_HTML = "bodyHtml";
Andy Huangdb977472012-01-11 19:53:25 -08001697 /**
1698 * This string column contains the plaintext form of the message body, if HTML is not
1699 * otherwise available. If HTML is available, this value should be left empty (null).
1700 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001701 public static final String BODY_TEXT = "bodyText";
Mindy Pereira6f92de62011-12-19 11:31:48 -08001702 public static final String EMBEDS_EXTERNAL_RESOURCES = "bodyEmbedsExternalResources";
Mindy Pereira3ce64e72012-01-13 14:29:45 -08001703 /**
1704 * This string column contains an opaque string used by the sendMessage api.
1705 */
Mindy Pereira6f92de62011-12-19 11:31:48 -08001706 public static final String REF_MESSAGE_ID = "refMessageId";
Andy Huangdb977472012-01-11 19:53:25 -08001707 /**
Andy Huang97c25be2012-01-12 15:12:09 -08001708 * This integer column contains the type of this draft, or zero (0) if this message is not a
1709 * draft. See {@link DraftType} for possible values.
Andy Huangdb977472012-01-11 19:53:25 -08001710 */
Paul Westbrook82ea6da2011-12-15 11:03:51 -08001711 public static final String DRAFT_TYPE = "draftType";
Andy Huangdb977472012-01-11 19:53:25 -08001712 /**
1713 * This boolean column indicates whether an outgoing message should trigger special quoted
1714 * text processing upon send. The value should default to zero (0) for protocols that do
1715 * not support or require this flag, and for all incoming messages.
1716 */
Mindy Pereira3ce64e72012-01-13 14:29:45 -08001717 public static final String APPEND_REF_MESSAGE_CONTENT = "appendRefMessageContent";
Andy Huangdb977472012-01-11 19:53:25 -08001718 /**
1719 * This boolean column indicates whether a message has attachments. The list of attachments
1720 * can be retrieved using the URI in {@link MessageColumns#ATTACHMENT_LIST_URI}.
1721 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001722 public static final String HAS_ATTACHMENTS = "hasAttachments";
Andy Huangdb977472012-01-11 19:53:25 -08001723 /**
Mindy Pereira7ed1c112012-01-18 10:59:25 -08001724 * This string column contains the content provider URI for the list of
1725 * attachments associated with this message.
Andy Huangdb977472012-01-11 19:53:25 -08001726 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001727 public static final String ATTACHMENT_LIST_URI = "attachmentListUri";
Andy Huangdb977472012-01-11 19:53:25 -08001728 /**
1729 * This long column is a bit field of flags defined in {@link MessageFlags}.
1730 */
Andy Huang732600e2012-01-10 17:47:17 -08001731 public static final String MESSAGE_FLAGS = "messageFlags";
Mindy Pereiraf944e962012-01-17 11:43:36 -08001732 /**
Paul Westbrook104f7292012-02-28 16:07:07 -08001733 * This integer column represents whether the user has specified that images should always
1734 * be shown. The value of "1" indicates that the user has specified that images should be
1735 * shown, while the value of "0" indicates that the user should be prompted before loading
1736 * any external images.
1737 */
1738 public static final String ALWAYS_SHOW_IMAGES = "alwaysShowImages";
1739
Mindy Pereirae8caf122012-03-20 15:23:31 -07001740 /**
Andy Huangd8e249e2012-03-21 17:01:37 -07001741 * This boolean column indicates whether the message has been read
1742 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001743 public static final String READ = "read";
Andy Huangd8e249e2012-03-21 17:01:37 -07001744
1745 /**
Scott Kennedyd5edd2d2012-12-05 11:11:32 -08001746 * This boolean column indicates whether the message has been seen
1747 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001748 public static final String SEEN = "seen";
Scott Kennedyd5edd2d2012-12-05 11:11:32 -08001749
1750 /**
Andy Huangd8e249e2012-03-21 17:01:37 -07001751 * This boolean column indicates whether the message has been starred
1752 */
Paul Westbrookb8911732013-04-28 11:54:49 -07001753 public static final String STARRED = "starred";
Andy Huangd8e249e2012-03-21 17:01:37 -07001754
1755 /**
Mindy Pereirae8caf122012-03-20 15:23:31 -07001756 * This integer column represents the offset in the message of quoted
1757 * text. If include_quoted_text is zero, the value contained in this
1758 * column is invalid.
1759 */
1760 public static final String QUOTE_START_POS = "quotedTextStartPos";
1761
Andy Huang5a929072012-03-23 20:17:10 -07001762 /**
1763 * This string columns contains a JSON array of serialized {@link Attachment} objects.
1764 */
1765 public static final String ATTACHMENTS = "attachments";
Mindy Pereira92551d02012-04-05 11:31:12 -07001766 public static final String CUSTOM_FROM_ADDRESS = "customFrom";
Mindy Pereira62de1b12012-04-06 12:17:56 -07001767 /**
1768 * Uri of the account associated with this message. Except in the case
1769 * of showing a combined view, this column is almost always empty.
1770 */
1771 public static final String MESSAGE_ACCOUNT_URI = "messageAccountUri";
Marc Blank3842af92012-04-27 09:06:09 -07001772 /**
Andy Huange623a0f2012-07-12 15:01:23 -07001773 * Intent Uri to launch when the user wants to view an event in their calendar, or null.
Marc Blank3842af92012-04-27 09:06:09 -07001774 */
1775 public static final String EVENT_INTENT_URI = "eventIntentUri";
Andrew Sapperstein3b08c512012-07-11 16:51:07 -07001776 /**
Andrew Sappersteind5b369b2012-07-13 12:38:46 -07001777 * This string column contains the string for the spam
Andrew Sapperstein3b08c512012-07-11 16:51:07 -07001778 * warning of this message, or null if there is no spam warning for the message.
1779 */
1780 public static final String SPAM_WARNING_STRING = "spamWarningString";
1781 /**
1782 * This integer column contains the level of spam warning of this message,
1783 * or zero (0) if this message does not have a warning level.
1784 * See {@link SpamWarningLevel} for possible values.
1785 */
1786 public static final String SPAM_WARNING_LEVEL = "spamWarningLevel";
1787 /**
1788 * This integer column contains the type of link for the spam warning
1789 * of this message, or zero (0) if this message does not have a link type.
1790 * See {@link SpamWarningLinkType} for possible values.
1791 */
1792 public static final String SPAM_WARNING_LINK_TYPE = "spamWarningLinkType";
Andrew Sappersteind5b369b2012-07-13 12:38:46 -07001793 /**
1794 * This string column contains the string for the via domain
1795 * to be included if this message was sent via an alternate
1796 * domain. This column should be null if no via domain exists.
1797 */
1798 public static final String VIA_DOMAIN = "viaDomain";
Andy Huang47aa9c92012-07-31 15:37:21 -07001799 /**
1800 * This boolean column indicates whether the message is an outgoing message in the process
1801 * of being sent (will be zero for incoming messages and messages that are already sent).
1802 */
1803 public static final String IS_SENDING = "isSending";
Andrew Sapperstein3b08c512012-07-11 16:51:07 -07001804
Mindy Pereira6f92de62011-12-19 11:31:48 -08001805 private MessageColumns() {}
1806 }
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001807
Scott Banachowski53a615d2012-12-19 15:31:20 -08001808 public static final class SetCurrentAccountColumns {
1809 /**
1810 * This column contains the Account object Parcelable.
1811 */
1812 public static final String ACCOUNT = "account";
1813
1814 private SetCurrentAccountColumns() {}
1815 }
1816
Marc Blank922c3eb2012-04-24 08:41:53 -07001817 /**
1818 * List of operations that can can be performed on a message. These operations are applied
1819 * with {@link ContentProvider#update(Uri, ContentValues, String, String[])}
1820 * where the message uri is specified, and the ContentValues specifies the operation to
1821 * be performed, e.g. values.put(RESPOND_COLUMN, RESPOND_ACCEPT)
1822 * <p/>
1823 * Note not all UI providers will support these operations.
1824 */
1825 public static final class MessageOperations {
1826 /**
1827 * Respond to a calendar invitation
1828 */
1829 public static final String RESPOND_COLUMN = "respond";
1830
1831 public static final int RESPOND_ACCEPT = 1;
1832 public static final int RESPOND_TENTATIVE = 2;
1833 public static final int RESPOND_DECLINE = 3;
1834
1835 private MessageOperations() {
1836 }
1837 }
1838
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001839 public static final String ATTACHMENT_LIST_TYPE =
1840 "vnd.android.cursor.dir/vnd.com.android.mail.attachment";
1841 public static final String ATTACHMENT_TYPE =
1842 "vnd.android.cursor.item/vnd.com.android.mail.attachment";
1843
1844 public static final String[] ATTACHMENT_PROJECTION = {
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001845 AttachmentColumns.NAME,
1846 AttachmentColumns.SIZE,
Mindy Pereira7a07fb42012-01-11 10:32:48 -08001847 AttachmentColumns.URI,
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001848 AttachmentColumns.CONTENT_TYPE,
Andy Huange0b83b82012-03-06 19:57:04 -08001849 AttachmentColumns.STATE,
1850 AttachmentColumns.DESTINATION,
1851 AttachmentColumns.DOWNLOADED_SIZE,
1852 AttachmentColumns.CONTENT_URI,
1853 AttachmentColumns.THUMBNAIL_URI,
Mark Weibbe74ae2012-11-19 11:20:09 -08001854 AttachmentColumns.PREVIEW_INTENT_URI,
Andrew Sapperstein7434e802013-06-21 11:26:49 -07001855 AttachmentColumns.PROVIDER_DATA,
Mark Weibeaf1e42013-08-05 17:52:48 -07001856 AttachmentColumns.SUPPORTS_DOWNLOAD_AGAIN,
Martin Hibdon519c2182013-09-20 17:27:57 -07001857 AttachmentColumns.TYPE,
1858 AttachmentColumns.FLAGS
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001859 };
Andy Huang109369d2012-03-07 20:05:31 -08001860 public static final int ATTACHMENT_NAME_COLUMN = 0;
1861 public static final int ATTACHMENT_SIZE_COLUMN = 1;
1862 public static final int ATTACHMENT_URI_COLUMN = 2;
1863 public static final int ATTACHMENT_CONTENT_TYPE_COLUMN = 3;
1864 public static final int ATTACHMENT_STATE_COLUMN = 4;
1865 public static final int ATTACHMENT_DESTINATION_COLUMN = 5;
1866 public static final int ATTACHMENT_DOWNLOADED_SIZE_COLUMN = 6;
1867 public static final int ATTACHMENT_CONTENT_URI_COLUMN = 7;
1868 public static final int ATTACHMENT_THUMBNAIL_URI_COLUMN = 8;
1869 public static final int ATTACHMENT_PREVIEW_INTENT_COLUMN = 9;
Andrew Sapperstein7434e802013-06-21 11:26:49 -07001870 public static final int ATTACHMENT_SUPPORTS_DOWNLOAD_AGAIN_COLUMN = 10;
Mark Weibeaf1e42013-08-05 17:52:48 -07001871 public static final int ATTACHMENT_TYPE_COLUMN = 11;
Martin Hibdon519c2182013-09-20 17:27:57 -07001872 public static final int ATTACHMENT_FLAGS_COLUMN = 12;
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001873
Mark Wei479505d2013-03-21 06:04:46 -07001874 /** Separates attachment info parts in strings in the database. */
1875 public static final String ATTACHMENT_INFO_SEPARATOR = "\n"; // use to join
1876 public static final Pattern ATTACHMENT_INFO_SEPARATOR_PATTERN =
1877 Pattern.compile(ATTACHMENT_INFO_SEPARATOR); // use to split
1878 public static final String ATTACHMENT_INFO_DELIMITER = "|"; // use to join
1879 // use to split
1880 public static final Pattern ATTACHMENT_INFO_DELIMITER_PATTERN = Pattern.compile("\\|");
1881
Andy Huange0b83b82012-03-06 19:57:04 -08001882 /**
1883 * Valid states for the {@link AttachmentColumns#STATE} column.
1884 *
1885 */
1886 public static final class AttachmentState {
1887 /**
1888 * The full attachment is not present on device. When used as a command,
1889 * setting this state will tell the provider to cancel a download in
1890 * progress.
1891 * <p>
Mark Weif6fac0a2013-02-11 20:58:17 -08001892 * Valid next states: {@link #DOWNLOADING}, {@link #PAUSED}
Andy Huange0b83b82012-03-06 19:57:04 -08001893 */
1894 public static final int NOT_SAVED = 0;
1895 /**
1896 * The most recent attachment download attempt failed. The current UI
1897 * design does not require providers to persist this state, but
1898 * providers must return this state at least once after a download
1899 * failure occurs. This state may not be used as a command.
1900 * <p>
1901 * Valid next states: {@link #DOWNLOADING}
1902 */
1903 public static final int FAILED = 1;
1904 /**
1905 * The attachment is currently being downloaded by the provider.
1906 * {@link AttachmentColumns#DOWNLOADED_SIZE} should reflect the current
1907 * download progress while in this state. When used as a command,
1908 * setting this state will tell the provider to initiate a download to
1909 * the accompanying destination in {@link AttachmentColumns#DESTINATION}
1910 * .
1911 * <p>
1912 * Valid next states: {@link #NOT_SAVED}, {@link #FAILED},
1913 * {@link #SAVED}
1914 */
1915 public static final int DOWNLOADING = 2;
1916 /**
1917 * The attachment was successfully downloaded to the destination in
1918 * {@link AttachmentColumns#DESTINATION}. If a provider later detects
1919 * that a download is missing, it should reset the state to
1920 * {@link #NOT_SAVED}. This state may not be used as a command on its
1921 * own. To move a file from cache to external, update
1922 * {@link AttachmentColumns#DESTINATION}.
1923 * <p>
Mark Weif6fac0a2013-02-11 20:58:17 -08001924 * Valid next states: {@link #NOT_SAVED}, {@link #PAUSED}
Andy Huange0b83b82012-03-06 19:57:04 -08001925 */
1926 public static final int SAVED = 3;
Mark Wei47ca4e22012-10-17 16:20:15 -07001927 /**
1928 * This is only used as a command, not as a state. The attachment is
1929 * currently being redownloaded by the provider.
1930 * {@link AttachmentColumns#DOWNLOADED_SIZE} should reflect the current
1931 * download progress while in this state. When used as a command,
1932 * setting this state will tell the provider to initiate a download to
1933 * the accompanying destination in {@link AttachmentColumns#DESTINATION}
1934 * .
Mark Wei47ca4e22012-10-17 16:20:15 -07001935 */
1936 public static final int REDOWNLOADING = 4;
Mark Wei7bed4bc2013-01-22 22:56:22 -08001937 /**
1938 * The attachment is either pending or paused in the download manager.
1939 * {@link AttachmentColumns#DOWNLOADED_SIZE} should reflect the current
1940 * download progress while in this state. This state may not be used as
1941 * a command on its own.
1942 * <p>
1943 * Valid next states: {@link #DOWNLOADING}, {@link #FAILED}
1944 */
1945 public static final int PAUSED = 5;
Andy Huange0b83b82012-03-06 19:57:04 -08001946
1947 private AttachmentState() {}
1948 }
1949
1950 public static final class AttachmentDestination {
1951
1952 /**
1953 * The attachment will be or is already saved to the app-private cache partition.
1954 */
1955 public static final int CACHE = 0;
1956 /**
1957 * The attachment will be or is already saved to external shared device storage.
Mark Wei5b49ce32013-02-08 16:31:16 -08001958 * This value should be 1 since saveToSd is often used in a similar way
Andy Huange0b83b82012-03-06 19:57:04 -08001959 */
1960 public static final int EXTERNAL = 1;
1961
1962 private AttachmentDestination() {}
1963 }
1964
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001965 public static final class AttachmentColumns {
Andy Huange0b83b82012-03-06 19:57:04 -08001966 /**
1967 * This string column is the attachment's file name, intended for display in UI. It is not
1968 * the full path of the file.
1969 */
Paul Westbrookc97d8ac2012-03-23 15:21:48 -07001970 public static final String NAME = OpenableColumns.DISPLAY_NAME;
Andy Huange0b83b82012-03-06 19:57:04 -08001971 /**
1972 * This integer column is the file size of the attachment, in bytes.
1973 */
Paul Westbrookc97d8ac2012-03-23 15:21:48 -07001974 public static final String SIZE = OpenableColumns.SIZE;
Andy Huange0b83b82012-03-06 19:57:04 -08001975 /**
Mark Wei1aee17e2013-01-14 14:47:16 -08001976 * This column is a {@link android.net.Uri} that can be queried to
1977 * monitor download state and progress for this individual attachment
1978 * (resulting cursor has one single row for this attachment).
Andy Huange0b83b82012-03-06 19:57:04 -08001979 */
Mindy Pereira7a07fb42012-01-11 10:32:48 -08001980 public static final String URI = "uri";
Andy Huange0b83b82012-03-06 19:57:04 -08001981 /**
1982 * This string column is the MIME type of the attachment.
1983 */
Mindy Pereiraf30cc092011-12-29 14:02:40 -08001984 public static final String CONTENT_TYPE = "contentType";
Andy Huange0b83b82012-03-06 19:57:04 -08001985 /**
1986 * This integer column is the current downloading state of the
1987 * attachment as defined in {@link AttachmentState}.
1988 * <p>
Andy Huangd8e249e2012-03-21 17:01:37 -07001989 * Providers must accept updates to {@link #URI} with new values of
Andy Huange0b83b82012-03-06 19:57:04 -08001990 * this column to initiate or cancel downloads.
1991 */
1992 public static final String STATE = "state";
1993 /**
1994 * This integer column is the file destination for the current download
1995 * in progress (when {@link #STATE} is
1996 * {@link AttachmentState#DOWNLOADING}) or the resulting downloaded file
1997 * ( when {@link #STATE} is {@link AttachmentState#SAVED}), as defined
1998 * in {@link AttachmentDestination}. This value is undefined in any
1999 * other state.
2000 * <p>
Andy Huangd8e249e2012-03-21 17:01:37 -07002001 * Providers must accept updates to {@link #URI} with new values of
Andy Huange0b83b82012-03-06 19:57:04 -08002002 * this column to move an existing downloaded file.
2003 */
2004 public static final String DESTINATION = "destination";
2005 /**
2006 * This integer column is the current number of bytes downloaded when
2007 * {@link #STATE} is {@link AttachmentState#DOWNLOADING}. This value is
2008 * undefined in any other state.
2009 */
2010 public static final String DOWNLOADED_SIZE = "downloadedSize";
2011 /**
Mark Wei1aee17e2013-01-14 14:47:16 -08002012 * This column is a {@link android.net.Uri} that points to the
2013 * downloaded local file when {@link #STATE} is
2014 * {@link AttachmentState#SAVED}. This value is undefined in any other
2015 * state.
Andy Huange0b83b82012-03-06 19:57:04 -08002016 */
2017 public static final String CONTENT_URI = "contentUri";
2018 /**
Mark Wei1aee17e2013-01-14 14:47:16 -08002019 * This column is a {@link android.net.Uri} that points to a local
2020 * thumbnail file for the attachment. Providers that do not support
2021 * downloading attachment thumbnails may leave this null.
Andy Huange0b83b82012-03-06 19:57:04 -08002022 */
2023 public static final String THUMBNAIL_URI = "thumbnailUri";
2024 /**
Mark Wei1aee17e2013-01-14 14:47:16 -08002025 * This column is an {@link android.net.Uri} used in an
2026 * {@link android.content.Intent#ACTION_VIEW} Intent to launch a preview
2027 * activity that allows the user to efficiently view an attachment
2028 * without having to first download the entire file. Providers that do
2029 * not support previewing attachments may leave this null.
Andy Huange0b83b82012-03-06 19:57:04 -08002030 */
Paul Westbrookd49db8e2012-08-03 17:58:46 -07002031 public static final String PREVIEW_INTENT_URI = "previewIntentUri";
Mark Weibbe74ae2012-11-19 11:20:09 -08002032 /**
2033 * This column contains provider-specific private data as JSON string.
2034 */
2035 public static final String PROVIDER_DATA = "providerData";
Andy Huange0b83b82012-03-06 19:57:04 -08002036
Andrew Sapperstein7434e802013-06-21 11:26:49 -07002037 /**
Mark Weibeaf1e42013-08-05 17:52:48 -07002038 * This column represents whether this attachment supports the ability to be downloaded
2039 * again.
Andrew Sapperstein7434e802013-06-21 11:26:49 -07002040 */
2041 public static final String SUPPORTS_DOWNLOAD_AGAIN = "supportsDownloadAgain";
Mark Weibeaf1e42013-08-05 17:52:48 -07002042 /**
2043 * This column represents the visibility type of this attachment. One of the
2044 * {@link AttachmentType} constants.
2045 */
2046 public static final String TYPE = "type";
Andrew Sapperstein7434e802013-06-21 11:26:49 -07002047
Martin Hibdon519c2182013-09-20 17:27:57 -07002048 /**
2049 * This column holds various bitwise flags for status information.
2050 */
2051 public static final String FLAGS = "flags";
2052
Andy Huange0b83b82012-03-06 19:57:04 -08002053 private AttachmentColumns() {}
Mindy Pereiraf30cc092011-12-29 14:02:40 -08002054 }
Mindy Pereira013194c2012-01-06 15:09:33 -08002055
Mark Wei1aee17e2013-01-14 14:47:16 -08002056 public static final class AttachmentContentValueKeys {
2057 public static final String RENDITION = "rendition";
Mark Wei26745352013-01-17 21:40:34 -08002058 public static final String ADDITIONAL_PRIORITY = "additionalPriority";
2059 public static final String DELAY_DOWNLOAD = "delayDownload";
Mark Wei1aee17e2013-01-14 14:47:16 -08002060 }
2061
2062 /**
2063 * Indicates a version of an attachment.
2064 */
2065 public static final class AttachmentRendition {
2066
2067 /** A smaller or simpler version of the attachment, such as a scaled-down image or an HTML
2068 * version of a document. Not always available.
2069 */
2070 public static final int SIMPLE = 0;
2071 /**
2072 * The full version of an attachment if it can be handled on the device, otherwise the
2073 * preview.
2074 */
2075 public static final int BEST = 1;
2076
Mark Wei7df813e2013-03-12 15:11:17 -07002077 private static final String SIMPLE_STRING = "SIMPLE";
2078 private static final String BEST_STRING = "BEST";
2079
Mark Wei479505d2013-03-21 06:04:46 -07002080 /**
2081 * Prefer renditions in this order.
2082 */
2083 public static final int[] PREFERRED_RENDITIONS = new int[]{BEST, SIMPLE};
2084
Mark Wei1aee17e2013-01-14 14:47:16 -08002085 public static int parseRendition(String rendition) {
Mark Wei479505d2013-03-21 06:04:46 -07002086 if (TextUtils.equals(rendition, SIMPLE_STRING)) {
2087 return SIMPLE;
2088 } else if (TextUtils.equals(rendition, BEST_STRING)) {
2089 return BEST;
2090 }
2091
2092 throw new IllegalArgumentException(String.format("Unknown rendition %s", rendition));
Mark Wei1aee17e2013-01-14 14:47:16 -08002093 }
2094
2095 public static String toString(int rendition) {
Mark Wei479505d2013-03-21 06:04:46 -07002096 if (rendition == BEST) {
2097 return BEST_STRING;
2098 } else if (rendition == SIMPLE) {
2099 return SIMPLE_STRING;
2100 }
2101
2102 throw new IllegalArgumentException(String.format("Unknown rendition %d", rendition));
Mark Wei1aee17e2013-01-14 14:47:16 -08002103 }
2104 }
2105
Mark Weibeaf1e42013-08-05 17:52:48 -07002106 /**
2107 * Indicates the visibility type of an attachment.
2108 */
2109 public static final class AttachmentType {
2110 public static final int STANDARD = 0;
2111 public static final int INLINE_CURRENT_MESSAGE = 1;
2112 public static final int INLINE_QUOTED_MESSAGE = 2;
2113 }
2114
Marc Blankb31ab5a2012-02-01 12:28:29 -08002115 public static final String[] UNDO_PROJECTION = {
2116 ConversationColumns.MESSAGE_LIST_URI
2117 };
2118 public static final int UNDO_MESSAGE_LIST_COLUMN = 0;
Marc Blankdd10bc82012-02-01 19:10:46 -08002119
2120 // Parameter used to indicate the sequence number for an undoable operation
2121 public static final String SEQUENCE_QUERY_PARAMETER = "seq";
Paul Westbrook63eef792012-02-27 14:01:06 -08002122
Scott Kennedy1007e702012-12-20 11:18:45 -08002123 /**
2124 * Parameter used to force UI notifications in an operation involving
2125 * {@link ConversationOperations#OPERATION_KEY}.
2126 */
2127 public static final String FORCE_UI_NOTIFICATIONS_QUERY_PARAMETER = "forceUiNotifications";
2128
Scott Kennedydd2ec682013-06-03 19:16:13 -07002129 /**
2130 * Parameter used to allow returning hidden folders.
2131 */
2132 public static final String ALLOW_HIDDEN_FOLDERS_QUERY_PARAM = "allowHiddenFolders";
2133
Scott Kennedy0d0f8b02012-10-12 15:18:18 -07002134 public static final String AUTO_ADVANCE_MODE_OLDER = "older";
2135 public static final String AUTO_ADVANCE_MODE_NEWER = "newer";
2136 public static final String AUTO_ADVANCE_MODE_LIST = "list";
2137
Vikram Aggarwalc7694222012-04-23 13:37:01 -07002138 /**
2139 * Settings for auto advancing when the current conversation has been destroyed.
2140 */
Paul Westbrook63eef792012-02-27 14:01:06 -08002141 public static final class AutoAdvance {
Vikram Aggarwalc7694222012-04-23 13:37:01 -07002142 /** No setting specified. */
Paul Westbrook63eef792012-02-27 14:01:06 -08002143 public static final int UNSET = 0;
Vikram Aggarwalc7694222012-04-23 13:37:01 -07002144 /** Go to the older message (if available) */
Paul Westbrook63eef792012-02-27 14:01:06 -08002145 public static final int OLDER = 1;
Vikram Aggarwalc7694222012-04-23 13:37:01 -07002146 /** Go to the newer message (if available) */
Paul Westbrook63eef792012-02-27 14:01:06 -08002147 public static final int NEWER = 2;
Vikram Aggarwalc7694222012-04-23 13:37:01 -07002148 /** Go back to conversation list*/
Paul Westbrook63eef792012-02-27 14:01:06 -08002149 public static final int LIST = 3;
Vikram Aggarwal82d37502013-01-10 16:18:49 -08002150 /** The default option is to go to the list */
2151 public static final int DEFAULT = LIST;
Scott Kennedy0d0f8b02012-10-12 15:18:18 -07002152
2153 /**
2154 * Gets the int value for the given auto advance setting.
2155 *
2156 * @param autoAdvanceSetting The string setting, such as "newer", "older", "list"
2157 */
2158 public static int getAutoAdvanceInt(final String autoAdvanceSetting) {
2159 final int autoAdvance;
2160
2161 if (AUTO_ADVANCE_MODE_NEWER.equals(autoAdvanceSetting)) {
2162 autoAdvance = UIProvider.AutoAdvance.NEWER;
2163 } else if (AUTO_ADVANCE_MODE_OLDER.equals(autoAdvanceSetting)) {
2164 autoAdvance = UIProvider.AutoAdvance.OLDER;
2165 } else if (AUTO_ADVANCE_MODE_LIST.equals(autoAdvanceSetting)) {
2166 autoAdvance = UIProvider.AutoAdvance.LIST;
2167 } else {
2168 autoAdvance = UIProvider.AutoAdvance.UNSET;
2169 }
2170
2171 return autoAdvance;
2172 }
Paul Westbrook63eef792012-02-27 14:01:06 -08002173 }
2174
Mindy Pereira71a8f5e2012-07-25 14:33:18 -07002175 /**
2176 * Settings for what swipe should do.
2177 */
2178 public static final class Swipe {
2179 /** Archive or remove label, if available. */
2180 public static final int ARCHIVE = 0;
2181 /** Delete */
2182 public static final int DELETE = 1;
2183 /** No swipe */
2184 public static final int DISABLED = 2;
Mindy Pereirae58222b2012-07-25 14:33:18 -07002185 /** Default is delete */
Mindy Pereira1c605fe2012-07-25 16:17:15 -07002186 public static final int DEFAULT = ARCHIVE;
Mindy Pereira71a8f5e2012-07-25 14:33:18 -07002187 }
2188
Paul Westbrookfa255c02012-10-13 14:32:52 -07002189 /**
2190 * Settings for Conversation view mode.
2191 */
2192 public static final class ConversationViewMode {
2193 /**
2194 * The user hasn't specified a mode.
2195 */
2196 public static final int UNDEFINED = -1;
2197 /**
2198 * Default to fit the conversation to screen view
2199 */
2200 public static final int OVERVIEW = 0;
2201 /**
2202 * Conversation text size should be the device default, and wide conversations may
2203 * require panning
2204 */
2205 public static final int READING = 1;
Andy Huangccf67802013-03-15 14:31:57 -07002206 public static final int DEFAULT = OVERVIEW;
Paul Westbrookfa255c02012-10-13 14:32:52 -07002207 }
2208
Paul Westbrook63eef792012-02-27 14:01:06 -08002209 public static final class SnapHeaderValue {
2210 public static final int ALWAYS = 0;
2211 public static final int PORTRAIT_ONLY = 1;
2212 public static final int NEVER = 2;
2213 }
2214
2215 public static final class MessageTextSize {
2216 public static final int TINY = -2;
2217 public static final int SMALL = -1;
2218 public static final int NORMAL = 0;
2219 public static final int LARGE = 1;
2220 public static final int HUGE = 2;
2221 }
2222
2223 public static final class DefaultReplyBehavior {
2224 public static final int REPLY = 0;
2225 public static final int REPLY_ALL = 1;
2226 }
2227
Paul Westbrookee0fda72012-03-19 10:13:36 -07002228 /**
Alice Yang4758e982013-04-24 20:31:34 -07002229 * Setting for whether to show sender images in conversation list.
Alice Yang64273142013-04-10 18:26:56 -07002230 */
2231 public static final class ConversationListIcon {
Alice Yang64273142013-04-10 18:26:56 -07002232 public static final int SENDER_IMAGE = 1;
2233 public static final int NONE = 2;
Alice Yangf5ffaee2013-04-23 16:23:10 -07002234 public static final int DEFAULT = 1; // Default to show sender image
Alice Yang64273142013-04-10 18:26:56 -07002235 }
2236
2237 /**
Marc Blankbc6ba052012-03-19 10:46:07 -07002238 * Action for an intent used to update/create new notifications. The mime type of this
Paul Westbrookee0fda72012-03-19 10:13:36 -07002239 * intent should be set to the mimeType of the account that is generating this notification.
2240 * An intent of this action is required to have the following extras:
Andy Huangd8e249e2012-03-21 17:01:37 -07002241 * {@link UpdateNotificationExtras#EXTRA_FOLDER} {@link UpdateNotificationExtras#EXTRA_ACCOUNT}
Paul Westbrookee0fda72012-03-19 10:13:36 -07002242 */
2243 public static final String ACTION_UPDATE_NOTIFICATION =
2244 "com.android.mail.action.update_notification";
2245
Marc Blankbc6ba052012-03-19 10:46:07 -07002246 public static final class UpdateNotificationExtras {
2247 /**
Paul Westbrook6ead20d2012-03-19 14:48:14 -07002248 * Parcelable extra containing a {@link Uri} to a {@link Folder}
Marc Blankbc6ba052012-03-19 10:46:07 -07002249 */
2250 public static final String EXTRA_FOLDER = "notification_extra_folder";
Paul Westbrookee0fda72012-03-19 10:13:36 -07002251
Marc Blankbc6ba052012-03-19 10:46:07 -07002252 /**
Paul Westbrook6ead20d2012-03-19 14:48:14 -07002253 * Parcelable extra containing a {@link Uri} to an {@link Account}
Marc Blankbc6ba052012-03-19 10:46:07 -07002254 */
2255 public static final String EXTRA_ACCOUNT = "notification_extra_account";
Paul Westbrook6ead20d2012-03-19 14:48:14 -07002256
2257 /**
2258 * Integer extra containing the update unread count for the account/folder.
2259 * If this value is 0, the UI will not block the intent to allow code to clear notifications
2260 * to run.
2261 */
2262 public static final String EXTRA_UPDATED_UNREAD_COUNT = "notification_updated_unread_count";
Tony Mantler81d00562013-11-21 12:26:01 -08002263
2264 /**
2265 * Integer extra containing the update unseen count for the account/folder.
2266 */
2267 public static final String EXTRA_UPDATED_UNSEEN_COUNT = "notification_updated_unseen_count";
Marc Blankbc6ba052012-03-19 10:46:07 -07002268 }
Paul Westbrooke5503552012-03-28 00:35:57 -07002269
2270 public static final class EditSettingsExtras {
2271 /**
2272 * Parcelable extra containing account for which the user wants to
2273 * modify settings
2274 */
2275 public static final String EXTRA_ACCOUNT = "extra_account";
2276
2277 /**
2278 * Parcelable extra containing folder for which the user wants to
2279 * modify settings
2280 */
2281 public static final String EXTRA_FOLDER = "extra_folder";
Paul Westbrook18babd22012-04-09 22:17:08 -07002282
2283 /**
2284 * Boolean extra which is set true if the user wants to "manage folders"
2285 */
2286 public static final String EXTRA_MANAGE_FOLDERS = "extra_manage_folders";
Paul Westbrooke5503552012-03-28 00:35:57 -07002287 }
Paul Westbrook17beb0b2012-08-20 13:34:37 -07002288
2289 public static final class SendFeedbackExtras {
2290 /**
2291 * Optional boolean extras which indicates that the user is reporting a problem.
2292 */
2293 public static final String EXTRA_REPORTING_PROBLEM = "reporting_problem";
Paul Westbrook83e6b572013-02-05 16:22:42 -08002294 /**
2295 * Optional Parcelable extra containing the screenshot of the screen where the user
2296 * is reporting a problem.
2297 */
2298 public static final String EXTRA_SCREEN_SHOT = "screen_shot";
Paul Westbrook17beb0b2012-08-20 13:34:37 -07002299 }
Mark Wei9982fdb2012-08-30 18:27:46 -07002300
2301 public static final class ViewProxyExtras {
2302 /**
2303 * Uri extra passed to the proxy which indicates the original Uri that was intended to be
2304 * viewed.
2305 */
2306 public static final String EXTRA_ORIGINAL_URI = "original_uri";
2307 /**
2308 * Parcelable extra passed to the proxy which indicates the account being viewed from.
2309 */
2310 public static final String EXTRA_ACCOUNT = "account";
2311 /**
2312 * String extra passed from the proxy which indicates the salt used to generate the digest.
2313 */
2314 public static final String EXTRA_SALT = "salt";
2315 /**
2316 * Byte[] extra passed from the proxy which indicates the digest of the salted account name.
2317 */
2318 public static final String EXTRA_ACCOUNT_DIGEST = "digest";
2319 }
Paul Westbrook82ea6da2011-12-15 11:03:51 -08002320}