blob: c167ea18f0c5013941761cdd9f3ed74d57540376 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.provider;
18
yuemingw369f96d2018-12-05 22:07:04 +000019import android.annotation.NonNull;
RoboErik36726962011-06-14 14:01:15 -070020import android.annotation.SdkConstant;
21import android.annotation.SdkConstant.SdkConstantType;
Mathew Inwood6750f2e2018-08-10 09:29:25 +010022import android.annotation.UnsupportedAppUsage;
Michael Chan37960c72012-04-19 00:18:13 -070023import android.app.Activity;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.app.AlarmManager;
25import android.app.PendingIntent;
yuemingwb714ba02018-10-26 18:54:44 +010026import android.app.admin.DevicePolicyManager;
27import android.content.ComponentName;
Marc Blank64a556d2010-02-25 12:53:16 -080028import android.content.ContentProviderClient;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.ContentResolver;
30import android.content.ContentUris;
31import android.content.ContentValues;
32import android.content.Context;
Fred Quintana328c0e72009-12-07 14:52:28 -080033import android.content.CursorEntityIterator;
34import android.content.Entity;
Marc Blank64a556d2010-02-25 12:53:16 -080035import android.content.EntityIterator;
36import android.content.Intent;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.database.Cursor;
Fred Quintana328c0e72009-12-07 14:52:28 -080038import android.database.DatabaseUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.net.Uri;
Michael Chancdaeafd2009-10-29 00:11:58 -070040import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.text.format.DateUtils;
42import android.text.format.Time;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
yuemingw369f96d2018-12-05 22:07:04 +000045import com.android.internal.util.Preconditions;
46
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047/**
RoboErik260598d2011-06-13 17:12:12 -070048 * <p>
49 * The contract between the calendar provider and applications. Contains
50 * definitions for the supported URIs and data columns.
51 * </p>
52 * <h3>Overview</h3>
53 * <p>
54 * CalendarContract defines the data model of calendar and event related
55 * information. This data is stored in a number of tables:
56 * </p>
57 * <ul>
58 * <li>The {@link Calendars} table holds the calendar specific information. Each
59 * row in this table contains the details for a single calendar, such as the
60 * name, color, sync info, etc.</li>
61 * <li>The {@link Events} table holds the event specific information. Each row
62 * in this table has the info for a single event. It contains information such
63 * as event title, location, start time, end time, etc. The event can occur
64 * one-time or can recur multiple times. Attendees, reminders, and extended
65 * properties are stored on separate tables and reference the {@link Events#_ID}
66 * to link them with the event.</li>
67 * <li>The {@link Instances} table holds the start and end time for occurrences
68 * of an event. Each row in this table represents a single occurrence. For
69 * one-time events there will be a 1:1 mapping of instances to events. For
70 * recurring events, multiple rows will automatically be generated which
71 * correspond to multiple occurrences of that event.</li>
72 * <li>The {@link Attendees} table holds the event attendee or guest
73 * information. Each row represents a single guest of an event. It specifies the
74 * type of guest they are and their attendance response for the event.</li>
75 * <li>The {@link Reminders} table holds the alert/notification data. Each row
76 * represents a single alert for an event. An event can have multiple reminders.
77 * The number of reminders per event is specified in
78 * {@link Calendars#MAX_REMINDERS} which is set by the Sync Adapter that owns
79 * the given calendar. Reminders are specified in minutes before the event and
80 * have a type.</li>
Michael Chan73bddfc2011-10-19 18:21:49 -070081 * <li>The {@link ExtendedProperties} table holds opaque data fields used by the
RoboErik260598d2011-06-13 17:12:12 -070082 * sync adapter. The provider takes no action with items in this table except to
83 * delete them when their related events are deleted.</li>
84 * </ul>
85 * <p>
86 * Other tables include:
87 * </p>
88 * <ul>
89 * <li>
90 * {@link SyncState}, which contains free-form data maintained by the sync
91 * adapters</li>
92 * </ul>
RoboErikbec6c362011-06-14 11:06:01 -070093 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 */
RoboErikbec6c362011-06-14 11:06:01 -070095public final class CalendarContract {
RoboErikc2d53302011-06-03 09:37:58 -070096 private static final String TAG = "Calendar";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097
98 /**
RoboErikc2d53302011-06-03 09:37:58 -070099 * Broadcast Action: This is the intent that gets fired when an alarm
100 * notification needs to be posted for a reminder.
RoboErik083cd2d2011-06-30 11:53:05 -0700101 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 */
RoboErik36726962011-06-14 14:01:15 -0700103 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
RoboErike00d5892011-06-23 15:16:55 -0700104 public static final String ACTION_EVENT_REMINDER = "android.intent.action.EVENT_REMINDER";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105
106 /**
Michael Chan37960c72012-04-19 00:18:13 -0700107 * Activity Action: Display the event to the user in the custom app as
108 * specified in {@link EventsColumns#CUSTOM_APP_PACKAGE}. The custom app
109 * will be started via {@link Activity#startActivityForResult(Intent, int)}
110 * and it should call {@link Activity#setResult(int)} with
111 * {@link Activity#RESULT_OK} or {@link Activity#RESULT_CANCELED} to
112 * acknowledge whether the action was handled or not.
Michael Chan9a9001f2012-05-14 18:27:27 -0700113 *
kmccormicke4ce5022013-04-03 14:00:19 -0700114 * The custom app should have an intent filter like the following:
Michael Chan9a9001f2012-05-14 18:27:27 -0700115 * <pre>
kmccormicke4ce5022013-04-03 14:00:19 -0700116 * &lt;intent-filter&gt;
117 * &lt;action android:name="android.provider.calendar.action.HANDLE_CUSTOM_EVENT" /&gt;
118 * &lt;category android:name="android.intent.category.DEFAULT" /&gt;
119 * &lt;data android:mimeType="vnd.android.cursor.item/event" /&gt;
120 * &lt;/intent-filter&gt;</pre>
Michael Chan37960c72012-04-19 00:18:13 -0700121 * <p>
122 * Input: {@link Intent#getData} has the event URI. The extra
123 * {@link #EXTRA_EVENT_BEGIN_TIME} has the start time of the instance. The
124 * extra {@link #EXTRA_CUSTOM_APP_URI} will have the
125 * {@link EventsColumns#CUSTOM_APP_URI}.
126 * <p>
127 * Output: {@link Activity#RESULT_OK} if this was handled; otherwise
kmccormicke4ce5022013-04-03 14:00:19 -0700128 * {@link Activity#RESULT_CANCELED}.
Michael Chan37960c72012-04-19 00:18:13 -0700129 */
130 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
131 public static final String ACTION_HANDLE_CUSTOM_EVENT =
132 "android.provider.calendar.action.HANDLE_CUSTOM_EVENT";
133
134 /**
yuemingw369f96d2018-12-05 22:07:04 +0000135 * Action used to help apps show calendar events in the managed profile.
136 */
137 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
138 public static final String ACTION_VIEW_WORK_CALENDAR_EVENT =
139 "android.provider.calendar.action.VIEW_WORK_CALENDAR_EVENT";
140
141 /**
Michael Chan37960c72012-04-19 00:18:13 -0700142 * Intent Extras key: {@link EventsColumns#CUSTOM_APP_URI} for the event in
143 * the {@link #ACTION_HANDLE_CUSTOM_EVENT} intent
144 */
Michael Chanf0c4c652012-04-19 16:27:46 -0700145 public static final String EXTRA_CUSTOM_APP_URI = "customAppUri";
Michael Chan37960c72012-04-19 00:18:13 -0700146
147 /**
RoboErikc2d53302011-06-03 09:37:58 -0700148 * Intent Extras key: The start time of an event or an instance of a
149 * recurring event. (milliseconds since epoch)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800150 */
RoboErike00d5892011-06-23 15:16:55 -0700151 public static final String EXTRA_EVENT_BEGIN_TIME = "beginTime";
RoboErikc2d53302011-06-03 09:37:58 -0700152
153 /**
154 * Intent Extras key: The end time of an event or an instance of a recurring
155 * event. (milliseconds since epoch)
156 */
RoboErike00d5892011-06-23 15:16:55 -0700157 public static final String EXTRA_EVENT_END_TIME = "endTime";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158
Erike9b734d2011-02-14 13:32:19 -0800159 /**
Michael Chan7420f132011-08-25 00:54:25 -0700160 * Intent Extras key: When creating an event, set this to true to create an
161 * all-day event by default
162 */
163 public static final String EXTRA_EVENT_ALL_DAY = "allDay";
164
165 /**
yuemingw369f96d2018-12-05 22:07:04 +0000166 * Intent Extras key: The id of an event.
167 */
168 public static final String EXTRA_EVENT_ID = "id";
169
170 /**
RoboErikc2d53302011-06-03 09:37:58 -0700171 * This authority is used for writing to or querying from the calendar
172 * provider. Note: This is set at first run and cannot be changed without
173 * breaking apps that access the provider.
Erike9b734d2011-02-14 13:32:19 -0800174 */
Ken Shirriff1790c132010-01-22 13:45:31 -0800175 public static final String AUTHORITY = "com.android.calendar";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800176
177 /**
178 * The content:// style URL for the top-level calendar authority
179 */
RoboErik083cd2d2011-06-30 11:53:05 -0700180 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800181
182 /**
Ken Shirriff5b387e12009-10-23 09:50:41 -0700183 * An optional insert, update or delete URI parameter that allows the caller
RoboErikc2d53302011-06-03 09:37:58 -0700184 * to specify that it is a sync adapter. The default value is false. If set
185 * to true, the modified row is not marked as "dirty" (needs to be synced)
186 * and when the provider calls
187 * {@link ContentResolver#notifyChange(android.net.Uri, android.database.ContentObserver, boolean)}
188 * , the third parameter "syncToNetwork" is set to false. Furthermore, if
189 * set to true, the caller must also include
Andy McFadden6f5b4552011-06-09 15:43:59 -0700190 * {@link Calendars#ACCOUNT_NAME} and {@link Calendars#ACCOUNT_TYPE} as
RoboErikc2d53302011-06-03 09:37:58 -0700191 * query parameters.
192 *
Andy McFadden6f5b4552011-06-09 15:43:59 -0700193 * @see Uri.Builder#appendQueryParameter(java.lang.String, java.lang.String)
Ken Shirriff5b387e12009-10-23 09:50:41 -0700194 */
195 public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
196
RoboErikc2d53302011-06-03 09:37:58 -0700197 /**
198 * A special account type for calendars not associated with any account.
199 * Normally calendars that do not match an account on the device will be
200 * removed. Setting the account_type on a calendar to this will prevent it
201 * from being wiped if it does not match an existing account.
202 *
203 * @see SyncColumns#ACCOUNT_TYPE
204 */
205 public static final String ACCOUNT_TYPE_LOCAL = "LOCAL";
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700206
207 /**
RoboErik36726962011-06-14 14:01:15 -0700208 * This utility class cannot be instantiated
209 */
210 private CalendarContract() {}
211
212 /**
yuemingw369f96d2018-12-05 22:07:04 +0000213 * Starts an activity to view calendar events in the managed profile.
214 *
215 * When this API is called, the system will attempt to start an activity
216 * in the managed profile with an intent targeting the same caller package.
217 * The intent will have its action set to
218 * {@link CalendarContract#ACTION_VIEW_WORK_CALENDAR_EVENT} and contain extras
219 * corresponding to the API's arguments. A calendar app intending to support
220 * cross profile events viewing should handle this intent, parse the arguments
221 * and show the appropriate UI.
222 *
223 * @param context the context.
224 * @param eventId the id of the event to be viewed. Will be put into {@link #EXTRA_EVENT_ID}
225 * field of the intent.
226 * @param start the start time of the event. Will be put into {@link #EXTRA_EVENT_BEGIN_TIME}
227 * field of the intent.
228 * @param end the end time of the event. Will be put into {@link #EXTRA_EVENT_END_TIME} field
229 * of the intent.
230 * @param allDay if the event is an all-day event. Will be put into
231 * {@link #EXTRA_EVENT_ALL_DAY} field of the intent.
232 * @param flags flags to be set on the intent via {@link Intent#setFlags}
233 * @return {@code true} if the activity is started successfully. {@code false} otherwise.
234 *
235 * @see #EXTRA_EVENT_ID
236 * @see #EXTRA_EVENT_BEGIN_TIME
237 * @see #EXTRA_EVENT_END_TIME
238 * @see #EXTRA_EVENT_ALL_DAY
239 */
240 public static boolean startViewCalendarEventInManagedProfile(@NonNull Context context,
241 long eventId, long start, long end, boolean allDay, int flags) {
242 Preconditions.checkNotNull(context, "Context is null");
243 final DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
244 Context.DEVICE_POLICY_SERVICE);
245 return dpm.startViewCalendarEventInManagedProfile(eventId, start,
246 end, allDay, flags);
247 }
248
249 /**
RoboErikc2d53302011-06-03 09:37:58 -0700250 * Generic columns for use by sync adapters. The specific functions of these
251 * columns are private to the sync adapter. Other clients of the API should
252 * not attempt to either read or write this column. These columns are
253 * editable as part of the Calendars Uri, but can only be read if accessed
254 * through any other Uri.
Fabrice Di Meglio36f77842010-06-29 19:33:45 -0700255 */
RoboErikc2d53302011-06-03 09:37:58 -0700256 protected interface CalendarSyncColumns {
Fabrice Di Meglio36f77842010-06-29 19:33:45 -0700257
RoboErik9734df52011-06-09 14:11:25 -0700258
259 /**
260 * Generic column for use by sync adapters. Column name.
261 * <P>Type: TEXT</P>
262 */
RoboErikbe010392011-05-26 12:28:38 -0700263 public static final String CAL_SYNC1 = "cal_sync1";
RoboErik9734df52011-06-09 14:11:25 -0700264
265 /**
266 * Generic column for use by sync adapters. Column name.
267 * <P>Type: TEXT</P>
268 */
RoboErikbe010392011-05-26 12:28:38 -0700269 public static final String CAL_SYNC2 = "cal_sync2";
RoboErik9734df52011-06-09 14:11:25 -0700270
271 /**
272 * Generic column for use by sync adapters. Column name.
273 * <P>Type: TEXT</P>
274 */
RoboErikbe010392011-05-26 12:28:38 -0700275 public static final String CAL_SYNC3 = "cal_sync3";
RoboErik9734df52011-06-09 14:11:25 -0700276
277 /**
278 * Generic column for use by sync adapters. Column name.
279 * <P>Type: TEXT</P>
280 */
RoboErikbe010392011-05-26 12:28:38 -0700281 public static final String CAL_SYNC4 = "cal_sync4";
RoboErik9734df52011-06-09 14:11:25 -0700282
283 /**
284 * Generic column for use by sync adapters. Column name.
285 * <P>Type: TEXT</P>
286 */
RoboErikbe010392011-05-26 12:28:38 -0700287 public static final String CAL_SYNC5 = "cal_sync5";
RoboErik9734df52011-06-09 14:11:25 -0700288
289 /**
290 * Generic column for use by sync adapters. Column name.
291 * <P>Type: TEXT</P>
292 */
RoboErikbe010392011-05-26 12:28:38 -0700293 public static final String CAL_SYNC6 = "cal_sync6";
RoboErik9734df52011-06-09 14:11:25 -0700294
295 /**
296 * Generic column for use by sync adapters. Column name.
297 * <P>Type: TEXT</P>
298 */
299 public static final String CAL_SYNC7 = "cal_sync7";
300
301 /**
302 * Generic column for use by sync adapters. Column name.
303 * <P>Type: TEXT</P>
304 */
305 public static final String CAL_SYNC8 = "cal_sync8";
306
307 /**
308 * Generic column for use by sync adapters. Column name.
309 * <P>Type: TEXT</P>
310 */
311 public static final String CAL_SYNC9 = "cal_sync9";
312
313 /**
314 * Generic column for use by sync adapters. Column name.
315 * <P>Type: TEXT</P>
316 */
317 public static final String CAL_SYNC10 = "cal_sync10";
Fabrice Di Meglio36f77842010-06-29 19:33:45 -0700318 }
319
320 /**
RoboErikc2d53302011-06-03 09:37:58 -0700321 * Columns for Sync information used by Calendars and Events tables. These
322 * have specific uses which are expected to be consistent by the app and
323 * sync adapter.
324 *
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700325 */
RoboErik00258602011-06-13 13:47:59 -0700326 protected interface SyncColumns extends CalendarSyncColumns {
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700327 /**
RoboErikc2d53302011-06-03 09:37:58 -0700328 * The account that was used to sync the entry to the device. If the
329 * account_type is not {@link #ACCOUNT_TYPE_LOCAL} then the name and
330 * type must match an account on the device or the calendar will be
331 * deleted.
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700332 * <P>Type: TEXT</P>
333 */
RoboErik651c02e2011-05-05 15:14:31 -0700334 public static final String ACCOUNT_NAME = "account_name";
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700335
336 /**
RoboErikc2d53302011-06-03 09:37:58 -0700337 * The type of the account that was used to sync the entry to the
338 * device. A type of {@link #ACCOUNT_TYPE_LOCAL} will keep this event
339 * form being deleted if there are no matching accounts on the device.
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700340 * <P>Type: TEXT</P>
341 */
RoboErik651c02e2011-05-05 15:14:31 -0700342 public static final String ACCOUNT_TYPE = "account_type";
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700343
344 /**
RoboErikc2d53302011-06-03 09:37:58 -0700345 * The unique ID for a row assigned by the sync source. NULL if the row
346 * has never been synced. This is used as a reference id for exceptions
347 * along with {@link BaseColumns#_ID}.
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700348 * <P>Type: TEXT</P>
349 */
350 public static final String _SYNC_ID = "_sync_id";
351
352 /**
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700353 * Used to indicate that local, unsynced, changes are present.
354 * <P>Type: INTEGER (long)</P>
355 */
Alon Albert8ac6a632012-12-17 17:21:18 -0800356
RoboErik651c02e2011-05-05 15:14:31 -0700357 public static final String DIRTY = "dirty";
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700358
Alon Albert866f40a2011-06-06 14:04:00 -0700359 /**
Alon Albert8ac6a632012-12-17 17:21:18 -0800360 * Used in conjunction with {@link #DIRTY} to indicate what packages wrote local changes.
361 * <P>Type: TEXT</P>
362 */
363 public static final String MUTATORS = "mutators";
364
365 /**
RoboErik9734df52011-06-09 14:11:25 -0700366 * Whether the row has been deleted but not synced to the server. A
367 * deleted row should be ignored.
368 * <P>
369 * Type: INTEGER (boolean)
370 * </P>
371 */
372 public static final String DELETED = "deleted";
373
374 /**
Alon Albert866f40a2011-06-06 14:04:00 -0700375 * If set to 1 this causes events on this calendar to be duplicated with
RoboErik00258602011-06-13 13:47:59 -0700376 * {@link Events#LAST_SYNCED} set to 1 whenever the event
RoboErik9734df52011-06-09 14:11:25 -0700377 * transitions from non-dirty to dirty. The duplicated event will not be
378 * expanded in the instances table and will only show up in sync adapter
379 * queries of the events table. It will also be deleted when the
Alon Albert866f40a2011-06-06 14:04:00 -0700380 * originating event has its dirty flag cleared by the sync adapter.
381 * <P>Type: INTEGER (boolean)</P>
382 */
383 public static final String CAN_PARTIALLY_UPDATE = "canPartiallyUpdate";
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700384 }
385
386 /**
RoboErikc2d53302011-06-03 09:37:58 -0700387 * Columns specific to the Calendars Uri that other Uris can query.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800388 */
RoboErike00d5892011-06-23 15:16:55 -0700389 protected interface CalendarColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 /**
RoboErik4f520612011-09-19 17:47:53 -0700391 * The color of the calendar. This should only be updated by the sync
392 * adapter, not other apps, as changing a calendar's color can adversely
393 * affect its display.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 * <P>Type: INTEGER (color value)</P>
395 */
RoboErik651c02e2011-05-05 15:14:31 -0700396 public static final String CALENDAR_COLOR = "calendar_color";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397
398 /**
RoboErik4172d952011-10-25 13:59:13 -0700399 * A key for looking up a color from the {@link Colors} table. NULL or
400 * an empty string are reserved for indicating that the calendar does
401 * not use a key for looking up the color. The provider will update
402 * {@link #CALENDAR_COLOR} automatically when a valid key is written to
403 * this column. The key must reference an existing row of the
RoboErik8a8eebc2011-10-20 16:57:18 -0700404 * {@link Colors} table. @see Colors
RoboErikf8143c52011-09-28 15:16:00 -0700405 * <P>
406 * Type: TEXT
407 * </P>
RoboErikf8143c52011-09-28 15:16:00 -0700408 */
RoboErik4172d952011-10-25 13:59:13 -0700409 public static final String CALENDAR_COLOR_KEY = "calendar_color_index";
RoboErikf8143c52011-09-28 15:16:00 -0700410
411 /**
RoboErik9734df52011-06-09 14:11:25 -0700412 * The display name of the calendar. Column name.
RoboErikf8143c52011-09-28 15:16:00 -0700413 * <P>
414 * Type: TEXT
415 * </P>
RoboErik9734df52011-06-09 14:11:25 -0700416 */
417 public static final String CALENDAR_DISPLAY_NAME = "calendar_displayName";
418
419 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 * The level of access that the user has for the calendar
421 * <P>Type: INTEGER (one of the values below)</P>
422 */
RoboErik9734df52011-06-09 14:11:25 -0700423 public static final String CALENDAR_ACCESS_LEVEL = "calendar_access_level";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424
425 /** Cannot access the calendar */
RoboErik9734df52011-06-09 14:11:25 -0700426 public static final int CAL_ACCESS_NONE = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 /** Can only see free/busy information about the calendar */
RoboErik9734df52011-06-09 14:11:25 -0700428 public static final int CAL_ACCESS_FREEBUSY = 100;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 /** Can read all event details */
RoboErik9734df52011-06-09 14:11:25 -0700430 public static final int CAL_ACCESS_READ = 200;
RoboErikc2d53302011-06-03 09:37:58 -0700431 /** Can reply yes/no/maybe to an event */
RoboErik9734df52011-06-09 14:11:25 -0700432 public static final int CAL_ACCESS_RESPOND = 300;
RoboErikc2d53302011-06-03 09:37:58 -0700433 /** not used */
RoboErik9734df52011-06-09 14:11:25 -0700434 public static final int CAL_ACCESS_OVERRIDE = 400;
RoboErikc2d53302011-06-03 09:37:58 -0700435 /** Full access to modify the calendar, but not the access control
436 * settings
437 */
RoboErik9734df52011-06-09 14:11:25 -0700438 public static final int CAL_ACCESS_CONTRIBUTOR = 500;
RoboErikc2d53302011-06-03 09:37:58 -0700439 /** Full access to modify the calendar, but not the access control
440 * settings
441 */
RoboErik9734df52011-06-09 14:11:25 -0700442 public static final int CAL_ACCESS_EDITOR = 600;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 /** Full access to the calendar */
RoboErik9734df52011-06-09 14:11:25 -0700444 public static final int CAL_ACCESS_OWNER = 700;
Debajit Ghosh2dcaafd2009-09-18 18:29:37 -0700445 /** Domain admin */
RoboErik9734df52011-06-09 14:11:25 -0700446 public static final int CAL_ACCESS_ROOT = 800;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447
448 /**
449 * Is the calendar selected to be displayed?
RoboErikc2d53302011-06-03 09:37:58 -0700450 * 0 - do not show events associated with this calendar.
451 * 1 - show events associated with this calendar
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 * <P>Type: INTEGER (boolean)</P>
453 */
Andy McFaddendf2e2c82011-04-19 15:08:37 -0700454 public static final String VISIBLE = "visible";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455
456 /**
RoboErikc2d53302011-06-03 09:37:58 -0700457 * The time zone the calendar is associated with.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 * <P>Type: TEXT</P>
459 */
RoboErik9734df52011-06-09 14:11:25 -0700460 public static final String CALENDAR_TIME_ZONE = "calendar_timezone";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461
462 /**
RoboErikc2d53302011-06-03 09:37:58 -0700463 * Is this calendar synced and are its events stored on the device?
464 * 0 - Do not sync this calendar or store events for this calendar.
465 * 1 - Sync down events for this calendar.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800466 * <p>Type: INTEGER (boolean)</p>
467 */
468 public static final String SYNC_EVENTS = "sync_events";
Ken Shirriff1d6442f2009-07-09 13:50:17 -0700469
470 /**
RoboErik9734df52011-06-09 14:11:25 -0700471 * The owner account for this calendar, based on the calendar feed.
472 * This will be different from the _SYNC_ACCOUNT for delegated calendars.
473 * Column name.
474 * <P>Type: String</P>
Ken Shirriff1d6442f2009-07-09 13:50:17 -0700475 */
RoboErik9734df52011-06-09 14:11:25 -0700476 public static final String OWNER_ACCOUNT = "ownerAccount";
Fred Quintana328c0e72009-12-07 14:52:28 -0800477
478 /**
RoboErik9734df52011-06-09 14:11:25 -0700479 * Can the organizer respond to the event? If no, the status of the
480 * organizer should not be shown by the UI. Defaults to 1. Column name.
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700481 * <P>Type: INTEGER (boolean)</P>
Fred Quintana328c0e72009-12-07 14:52:28 -0800482 */
RoboErik9734df52011-06-09 14:11:25 -0700483 public static final String CAN_ORGANIZER_RESPOND = "canOrganizerRespond";
484
485 /**
486 * Can the organizer modify the time zone of the event? Column name.
487 * <P>Type: INTEGER (boolean)</P>
488 */
489 public static final String CAN_MODIFY_TIME_ZONE = "canModifyTimeZone";
490
491 /**
492 * The maximum number of reminders allowed for an event. Column name.
493 * <P>Type: INTEGER</P>
494 */
495 public static final String MAX_REMINDERS = "maxReminders";
496
497 /**
498 * A comma separated list of reminder methods supported for this
499 * calendar in the format "#,#,#". Valid types are
500 * {@link Reminders#METHOD_DEFAULT}, {@link Reminders#METHOD_ALERT},
Alon Albertbd251612012-02-23 10:30:51 -0800501 * {@link Reminders#METHOD_EMAIL}, {@link Reminders#METHOD_SMS},
502 * {@link Reminders#METHOD_ALARM}. Column name.
RoboErik9734df52011-06-09 14:11:25 -0700503 * <P>Type: TEXT</P>
504 */
505 public static final String ALLOWED_REMINDERS = "allowedReminders";
RoboErikf8143c52011-09-28 15:16:00 -0700506
507 /**
508 * A comma separated list of availability types supported for this
509 * calendar in the format "#,#,#". Valid types are
510 * {@link Events#AVAILABILITY_BUSY}, {@link Events#AVAILABILITY_FREE},
511 * {@link Events#AVAILABILITY_TENTATIVE}. Setting this field to only
512 * {@link Events#AVAILABILITY_BUSY} should be used to indicate that
513 * changing the availability is not supported.
514 *
RoboErikf8143c52011-09-28 15:16:00 -0700515 */
516 public static final String ALLOWED_AVAILABILITY = "allowedAvailability";
517
518 /**
519 * A comma separated list of attendee types supported for this calendar
520 * in the format "#,#,#". Valid types are {@link Attendees#TYPE_NONE},
521 * {@link Attendees#TYPE_OPTIONAL}, {@link Attendees#TYPE_REQUIRED},
522 * {@link Attendees#TYPE_RESOURCE}. Setting this field to only
523 * {@link Attendees#TYPE_NONE} should be used to indicate that changing
524 * the attendee type is not supported.
525 *
RoboErikf8143c52011-09-28 15:16:00 -0700526 */
527 public static final String ALLOWED_ATTENDEE_TYPES = "allowedAttendeeTypes";
Alon Albert0a9a2192012-09-18 11:10:49 -0700528
529 /**
530 * Is this the primary calendar for this account. If this column is not explicitly set, the
531 * provider will return 1 if {@link Calendars#ACCOUNT_NAME} is equal to
532 * {@link Calendars#OWNER_ACCOUNT}.
533 */
534 public static final String IS_PRIMARY = "isPrimary";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 }
536
537 /**
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700538 * Class that represents a Calendar Entity. There is one entry per calendar.
RoboErikc2d53302011-06-03 09:37:58 -0700539 * This is a helper class to make batch operations easier.
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700540 */
RoboErik36726962011-06-14 14:01:15 -0700541 public static final class CalendarEntity implements BaseColumns, SyncColumns, CalendarColumns {
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700542
RoboErikc2d53302011-06-03 09:37:58 -0700543 /**
544 * The default Uri used when creating a new calendar EntityIterator.
545 */
546 @SuppressWarnings("hiding")
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700547 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY +
548 "/calendar_entities");
549
RoboErikc2d53302011-06-03 09:37:58 -0700550 /**
RoboErik36726962011-06-14 14:01:15 -0700551 * This utility class cannot be instantiated
552 */
553 private CalendarEntity() {}
554
555 /**
RoboErikc2d53302011-06-03 09:37:58 -0700556 * Creates an entity iterator for the given cursor. It assumes the
557 * cursor contains a calendars query.
558 *
559 * @param cursor query on {@link #CONTENT_URI}
560 * @return an EntityIterator of calendars
561 */
562 public static EntityIterator newEntityIterator(Cursor cursor) {
563 return new EntityIteratorImpl(cursor);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700564 }
565
566 private static class EntityIteratorImpl extends CursorEntityIterator {
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700567
RoboErikc2d53302011-06-03 09:37:58 -0700568 public EntityIteratorImpl(Cursor cursor) {
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700569 super(cursor);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700570 }
571
572 @Override
573 public Entity getEntityAndIncrementCursor(Cursor cursor) throws RemoteException {
574 // we expect the cursor is already at the row we need to read from
575 final long calendarId = cursor.getLong(cursor.getColumnIndexOrThrow(_ID));
576
577 // Create the content value
578 ContentValues cv = new ContentValues();
579 cv.put(_ID, calendarId);
580
RoboErik651c02e2011-05-05 15:14:31 -0700581 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ACCOUNT_NAME);
582 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ACCOUNT_TYPE);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700583
584 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_ID);
RoboErik651c02e2011-05-05 15:14:31 -0700585 DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY);
Alon Albert8ac6a632012-12-17 17:21:18 -0800586 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, MUTATORS);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700587
RoboErik9734df52011-06-09 14:11:25 -0700588 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC1);
589 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC2);
590 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC3);
591 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC4);
592 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC5);
593 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC6);
594 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC7);
595 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC8);
596 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC9);
597 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC10);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700598
599 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.NAME);
600 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
RoboErik9734df52011-06-09 14:11:25 -0700601 Calendars.CALENDAR_DISPLAY_NAME);
Alon Albert866f40a2011-06-06 14:04:00 -0700602 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv,
603 Calendars.CALENDAR_COLOR);
Alon Albert01141122013-02-07 11:50:27 -0800604 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
605 Calendars.CALENDAR_COLOR_KEY);
RoboErik9734df52011-06-09 14:11:25 -0700606 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, CALENDAR_ACCESS_LEVEL);
Andy McFaddendf2e2c82011-04-19 15:08:37 -0700607 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, VISIBLE);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700608 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, SYNC_EVENTS);
RoboErik651c02e2011-05-05 15:14:31 -0700609 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
610 Calendars.CALENDAR_LOCATION);
RoboErik9734df52011-06-09 14:11:25 -0700611 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CALENDAR_TIME_ZONE);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700612 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
613 Calendars.OWNER_ACCOUNT);
614 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv,
Andy McFaddendf2e2c82011-04-19 15:08:37 -0700615 Calendars.CAN_ORGANIZER_RESPOND);
616 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv,
617 Calendars.CAN_MODIFY_TIME_ZONE);
618 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv,
619 Calendars.MAX_REMINDERS);
Alon Albert866f40a2011-06-06 14:04:00 -0700620 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv,
621 Calendars.CAN_PARTIALLY_UPDATE);
RoboErik9734df52011-06-09 14:11:25 -0700622 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
623 Calendars.ALLOWED_REMINDERS);
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700624
625 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, DELETED);
626
627 // Create the Entity from the ContentValue
628 Entity entity = new Entity(cv);
629
630 // Set cursor to next row
631 cursor.moveToNext();
632
633 // Return the created Entity
634 return entity;
635 }
636 }
637 }
638
639 /**
RoboErikf4010c52011-06-17 11:04:26 -0700640 * Constants and helpers for the Calendars table, which contains details for
641 * individual calendars. <h3>Operations</h3> All operations can be done
642 * either as an app or as a sync adapter. To perform an operation as a sync
643 * adapter {@link #CALLER_IS_SYNCADAPTER} should be set to true and
644 * {@link #ACCOUNT_NAME} and {@link #ACCOUNT_TYPE} must be set in the Uri
645 * parameters. See
646 * {@link Uri.Builder#appendQueryParameter(java.lang.String, java.lang.String)}
647 * for details on adding parameters. Sync adapters have write access to more
648 * columns but are restricted to a single account at a time. Calendars are
649 * designed to be primarily managed by a sync adapter and inserting new
650 * calendars should be done as a sync adapter. For the most part, apps
651 * should only update calendars (such as changing the color or display
652 * name). If a local calendar is required an app can do so by inserting as a
653 * sync adapter and using an {@link #ACCOUNT_TYPE} of
654 * {@link #ACCOUNT_TYPE_LOCAL} .
655 * <dl>
656 * <dt><b>Insert</b></dt>
657 * <dd>When inserting a new calendar the following fields must be included:
658 * <ul>
659 * <li>{@link #ACCOUNT_NAME}</li>
660 * <li>{@link #ACCOUNT_TYPE}</li>
661 * <li>{@link #NAME}</li>
662 * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
663 * <li>{@link #CALENDAR_COLOR}</li>
664 * <li>{@link #CALENDAR_ACCESS_LEVEL}</li>
665 * <li>{@link #OWNER_ACCOUNT}</li>
666 * </ul>
667 * The following fields are not required when inserting a Calendar but are
668 * generally a good idea to include:
669 * <ul>
670 * <li>{@link #SYNC_EVENTS} set to 1</li>
RoboErikf92ccfb2011-06-17 15:24:02 -0700671 * <li>{@link #CALENDAR_TIME_ZONE}</li>
RoboErikf4010c52011-06-17 11:04:26 -0700672 * <li>{@link #ALLOWED_REMINDERS}</li>
RoboErik4172d952011-10-25 13:59:13 -0700673 * <li>{@link #ALLOWED_AVAILABILITY}</li>
674 * <li>{@link #ALLOWED_ATTENDEE_TYPES}</li>
RoboErikf4010c52011-06-17 11:04:26 -0700675 * </ul>
676 * <dt><b>Update</b></dt>
677 * <dd>To perform an update on a calendar the {@link #_ID} of the calendar
678 * should be provided either as an appended id to the Uri (
679 * {@link ContentUris#withAppendedId}) or as the first selection item--the
680 * selection should start with "_id=?" and the first selectionArg should be
681 * the _id of the calendar. Calendars may also be updated using a selection
682 * without the id. In general, the {@link #ACCOUNT_NAME} and
683 * {@link #ACCOUNT_TYPE} should not be changed after a calendar is created
684 * as this can cause issues for sync adapters.
685 * <dt><b>Delete</b></dt>
686 * <dd>Calendars can be deleted either by the {@link #_ID} as an appended id
687 * on the Uri or using any standard selection. Deleting a calendar should
688 * generally be handled by a sync adapter as it will remove the calendar
689 * from the database and all associated data (aka events).</dd>
690 * <dt><b>Query</b></dt>
691 * <dd>Querying the Calendars table will get you all information about a set
692 * of calendars. There will be one row returned for each calendar that
693 * matches the query selection, or at most a single row if the {@link #_ID}
694 * is appended to the Uri.</dd>
695 * </dl>
696 * <h3>Calendar Columns</h3> The following Calendar columns are writable by
697 * both an app and a sync adapter.
698 * <ul>
699 * <li>{@link #NAME}</li>
700 * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
RoboErikf4010c52011-06-17 11:04:26 -0700701 * <li>{@link #VISIBLE}</li>
702 * <li>{@link #SYNC_EVENTS}</li>
703 * </ul>
704 * The following Calendars columns are writable only by a sync adapter
705 * <ul>
706 * <li>{@link #ACCOUNT_NAME}</li>
707 * <li>{@link #ACCOUNT_TYPE}</li>
RoboErik4f520612011-09-19 17:47:53 -0700708 * <li>{@link #CALENDAR_COLOR}</li>
RoboErikf4010c52011-06-17 11:04:26 -0700709 * <li>{@link #_SYNC_ID}</li>
710 * <li>{@link #DIRTY}</li>
Alon Albert8ac6a632012-12-17 17:21:18 -0800711 * <li>{@link #MUTATORS}</li>
RoboErikf4010c52011-06-17 11:04:26 -0700712 * <li>{@link #OWNER_ACCOUNT}</li>
713 * <li>{@link #MAX_REMINDERS}</li>
714 * <li>{@link #ALLOWED_REMINDERS}</li>
RoboErik4172d952011-10-25 13:59:13 -0700715 * <li>{@link #ALLOWED_AVAILABILITY}</li>
716 * <li>{@link #ALLOWED_ATTENDEE_TYPES}</li>
RoboErikf4010c52011-06-17 11:04:26 -0700717 * <li>{@link #CAN_MODIFY_TIME_ZONE}</li>
718 * <li>{@link #CAN_ORGANIZER_RESPOND}</li>
719 * <li>{@link #CAN_PARTIALLY_UPDATE}</li>
720 * <li>{@link #CALENDAR_LOCATION}</li>
721 * <li>{@link #CALENDAR_TIME_ZONE}</li>
722 * <li>{@link #CALENDAR_ACCESS_LEVEL}</li>
723 * <li>{@link #DELETED}</li>
724 * <li>{@link #CAL_SYNC1}</li>
725 * <li>{@link #CAL_SYNC2}</li>
726 * <li>{@link #CAL_SYNC3}</li>
727 * <li>{@link #CAL_SYNC4}</li>
728 * <li>{@link #CAL_SYNC5}</li>
729 * <li>{@link #CAL_SYNC6}</li>
730 * <li>{@link #CAL_SYNC7}</li>
731 * <li>{@link #CAL_SYNC8}</li>
732 * <li>{@link #CAL_SYNC9}</li>
733 * <li>{@link #CAL_SYNC10}</li>
734 * </ul>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800735 */
RoboErik36726962011-06-14 14:01:15 -0700736 public static final class Calendars implements BaseColumns, SyncColumns, CalendarColumns {
737
738 /**
739 * This utility class cannot be instantiated
740 */
741 private Calendars() {}
742
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800743 /**
RoboErikc2d53302011-06-03 09:37:58 -0700744 * The content:// style URL for accessing Calendars
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 */
RoboErikc2d53302011-06-03 09:37:58 -0700746 @SuppressWarnings("hiding")
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -0800747 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/calendars");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800749 /**
yuemingw369f96d2018-12-05 22:07:04 +0000750 * The content:// style URL for querying Calendars table in the managed profile. Appending a
yuemingwb714ba02018-10-26 18:54:44 +0100751 * calendar id using {@link ContentUris#withAppendedId(Uri, long)} will
752 * specify a single calendar.
753 *
754 * <p>The following columns are allowed to be queried via this uri:
755 * <ul>
756 * <li>{@link #_ID}</li>
757 * <li>{@link #NAME}</li>
758 * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
759 * <li>{@link #CALENDAR_COLOR}</li>
760 * <li>{@link #VISIBLE}</li>
761 * <li>{@link #CALENDAR_LOCATION}</li>
762 * <li>{@link #CALENDAR_TIME_ZONE}</li>
763 * <li>{@link #IS_PRIMARY}</li>
764 * </ul>
765 *
766 * <p>{@link IllegalArgumentException} will be thrown if there exist columns in the
767 * projection of the query to this uri that are not contained in the above list.
768 *
769 * <p>This uri will return an empty cursor if the calling user is not a parent profile
yuemingw369f96d2018-12-05 22:07:04 +0000770 * of a managed profile, or cross profile calendar is disabled in Settings, or this uri is
771 * queried from a package that is not whitelisted by profile owner of the managed profile
772 * via {@link DevicePolicyManager#addCrossProfileCalendarPackage(ComponentName, String)}.
yuemingwb714ba02018-10-26 18:54:44 +0100773 *
774 * @see DevicePolicyManager#getCrossProfileCalendarPackages(ComponentName)
775 * @see Settings.Secure#CROSS_PROFILE_CALENDAR_ENABLED
776 */
777 public static final Uri ENTERPRISE_CONTENT_URI =
778 Uri.parse("content://" + AUTHORITY + "/enterprise/calendars");
779
780 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800781 * The default sort order for this table
782 */
Michael Chane5e02502011-09-01 10:46:14 -0700783 public static final String DEFAULT_SORT_ORDER = CALENDAR_DISPLAY_NAME;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784
785 /**
RoboErikc2d53302011-06-03 09:37:58 -0700786 * The name of the calendar. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 * <P>Type: TEXT</P>
788 */
789 public static final String NAME = "name";
790
791 /**
RoboErikc2d53302011-06-03 09:37:58 -0700792 * The default location for the calendar. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800793 * <P>Type: TEXT</P>
794 */
RoboErik651c02e2011-05-05 15:14:31 -0700795 public static final String CALENDAR_LOCATION = "calendar_location";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796
797 /**
RoboErik6efb30f2011-05-05 10:11:47 -0700798 * These fields are only writable by a sync adapter. To modify them the
RoboErikc2d53302011-06-03 09:37:58 -0700799 * caller must include {@link #CALLER_IS_SYNCADAPTER},
RoboErik9734df52011-06-09 14:11:25 -0700800 * {@link #ACCOUNT_NAME}, and {@link #ACCOUNT_TYPE} in the Uri's query
RoboErik083cd2d2011-06-30 11:53:05 -0700801 * parameters. TODO move to provider
802 *
803 * @hide
RoboErik6efb30f2011-05-05 10:11:47 -0700804 */
805 public static final String[] SYNC_WRITABLE_COLUMNS = new String[] {
RoboErik651c02e2011-05-05 15:14:31 -0700806 ACCOUNT_NAME,
807 ACCOUNT_TYPE,
RoboErik6efb30f2011-05-05 10:11:47 -0700808 _SYNC_ID,
RoboErik651c02e2011-05-05 15:14:31 -0700809 DIRTY,
Alon Albert8ac6a632012-12-17 17:21:18 -0800810 MUTATORS,
RoboErik6efb30f2011-05-05 10:11:47 -0700811 OWNER_ACCOUNT,
812 MAX_REMINDERS,
RoboErikf4010c52011-06-17 11:04:26 -0700813 ALLOWED_REMINDERS,
RoboErik6efb30f2011-05-05 10:11:47 -0700814 CAN_MODIFY_TIME_ZONE,
815 CAN_ORGANIZER_RESPOND,
Alon Albert866f40a2011-06-06 14:04:00 -0700816 CAN_PARTIALLY_UPDATE,
RoboErik651c02e2011-05-05 15:14:31 -0700817 CALENDAR_LOCATION,
RoboErik9734df52011-06-09 14:11:25 -0700818 CALENDAR_TIME_ZONE,
819 CALENDAR_ACCESS_LEVEL,
RoboErik6efb30f2011-05-05 10:11:47 -0700820 DELETED,
RoboErikbe010392011-05-26 12:28:38 -0700821 CAL_SYNC1,
822 CAL_SYNC2,
823 CAL_SYNC3,
824 CAL_SYNC4,
RoboErikc2d53302011-06-03 09:37:58 -0700825 CAL_SYNC5,
826 CAL_SYNC6,
RoboErik9734df52011-06-09 14:11:25 -0700827 CAL_SYNC7,
828 CAL_SYNC8,
829 CAL_SYNC9,
830 CAL_SYNC10,
RoboErik6efb30f2011-05-05 10:11:47 -0700831 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800832 }
833
Fabrice Di Meglioc3cc1332010-05-21 20:01:52 -0700834 /**
835 * Columns from the Attendees table that other tables join into themselves.
836 */
RoboErikb2c75602011-06-13 12:53:48 -0700837 protected interface AttendeesColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800838
839 /**
RoboErikc2d53302011-06-03 09:37:58 -0700840 * The id of the event. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 * <P>Type: INTEGER</P>
842 */
843 public static final String EVENT_ID = "event_id";
844
845 /**
RoboErikc2d53302011-06-03 09:37:58 -0700846 * The name of the attendee. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 * <P>Type: STRING</P>
848 */
849 public static final String ATTENDEE_NAME = "attendeeName";
850
851 /**
RoboErikc2d53302011-06-03 09:37:58 -0700852 * The email address of the attendee. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800853 * <P>Type: STRING</P>
854 */
855 public static final String ATTENDEE_EMAIL = "attendeeEmail";
856
857 /**
RoboErikc2d53302011-06-03 09:37:58 -0700858 * The relationship of the attendee to the user. Column name.
859 * <P>Type: INTEGER (one of {@link #RELATIONSHIP_ATTENDEE}, ...}.</P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 */
861 public static final String ATTENDEE_RELATIONSHIP = "attendeeRelationship";
862
863 public static final int RELATIONSHIP_NONE = 0;
864 public static final int RELATIONSHIP_ATTENDEE = 1;
865 public static final int RELATIONSHIP_ORGANIZER = 2;
866 public static final int RELATIONSHIP_PERFORMER = 3;
867 public static final int RELATIONSHIP_SPEAKER = 4;
868
869 /**
RoboErikc2d53302011-06-03 09:37:58 -0700870 * The type of attendee. Column name.
RoboErikf8143c52011-09-28 15:16:00 -0700871 * <P>
RoboErik4172d952011-10-25 13:59:13 -0700872 * Type: Integer (one of {@link #TYPE_NONE}, {@link #TYPE_REQUIRED},
873 * {@link #TYPE_OPTIONAL}, {@link #TYPE_RESOURCE})
RoboErikf8143c52011-09-28 15:16:00 -0700874 * </P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 */
876 public static final String ATTENDEE_TYPE = "attendeeType";
877
878 public static final int TYPE_NONE = 0;
879 public static final int TYPE_REQUIRED = 1;
880 public static final int TYPE_OPTIONAL = 2;
RoboErikf8143c52011-09-28 15:16:00 -0700881 /**
RoboErik4172d952011-10-25 13:59:13 -0700882 * This specifies that an attendee is a resource, like a room, a
883 * cabbage, or something and not an actual person.
RoboErikf8143c52011-09-28 15:16:00 -0700884 */
885 public static final int TYPE_RESOURCE = 3;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886
887 /**
RoboErikc2d53302011-06-03 09:37:58 -0700888 * The attendance status of the attendee. Column name.
889 * <P>Type: Integer (one of {@link #ATTENDEE_STATUS_ACCEPTED}, ...).</P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 */
891 public static final String ATTENDEE_STATUS = "attendeeStatus";
892
893 public static final int ATTENDEE_STATUS_NONE = 0;
894 public static final int ATTENDEE_STATUS_ACCEPTED = 1;
895 public static final int ATTENDEE_STATUS_DECLINED = 2;
896 public static final int ATTENDEE_STATUS_INVITED = 3;
897 public static final int ATTENDEE_STATUS_TENTATIVE = 4;
Michael Chan48ec6222012-04-17 15:58:28 -0700898
899 /**
900 * The identity of the attendee as referenced in
901 * {@link ContactsContract.CommonDataKinds.Identity#IDENTITY}.
Michael Chan37f1d292012-04-17 18:40:51 -0700902 * This is required only if {@link #ATTENDEE_ID_NAMESPACE} is present. Column name.
Michael Chan48ec6222012-04-17 15:58:28 -0700903 * <P>Type: STRING</P>
Michael Chan48ec6222012-04-17 15:58:28 -0700904 */
905 public static final String ATTENDEE_IDENTITY = "attendeeIdentity";
906
907 /**
908 * The identity name space of the attendee as referenced in
909 * {@link ContactsContract.CommonDataKinds.Identity#NAMESPACE}.
Michael Chan37f1d292012-04-17 18:40:51 -0700910 * This is required only if {@link #ATTENDEE_IDENTITY} is present. Column name.
Michael Chan48ec6222012-04-17 15:58:28 -0700911 * <P>Type: STRING</P>
Michael Chan48ec6222012-04-17 15:58:28 -0700912 */
913 public static final String ATTENDEE_ID_NAMESPACE = "attendeeIdNamespace";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800914 }
915
RoboErikc2d53302011-06-03 09:37:58 -0700916 /**
RoboErik3771fcb2011-06-16 15:41:31 -0700917 * Fields and helpers for interacting with Attendees. Each row of this table
918 * represents a single attendee or guest of an event. Calling
RoboErik58644022011-07-08 13:39:05 -0700919 * {@link #query(ContentResolver, long, String[])} will return a list of attendees for
RoboErik3771fcb2011-06-16 15:41:31 -0700920 * the event with the given eventId. Both apps and sync adapters may write
921 * to this table. There are six writable fields and all of them except
922 * {@link #ATTENDEE_NAME} must be included when inserting a new attendee.
923 * They are:
924 * <ul>
925 * <li>{@link #EVENT_ID}</li>
926 * <li>{@link #ATTENDEE_NAME}</li>
927 * <li>{@link #ATTENDEE_EMAIL}</li>
928 * <li>{@link #ATTENDEE_RELATIONSHIP}</li>
929 * <li>{@link #ATTENDEE_TYPE}</li>
930 * <li>{@link #ATTENDEE_STATUS}</li>
Michael Chan48ec6222012-04-17 15:58:28 -0700931 * <li>{@link #ATTENDEE_IDENTITY}</li>
932 * <li>{@link #ATTENDEE_ID_NAMESPACE}</li>
RoboErik3771fcb2011-06-16 15:41:31 -0700933 * </ul>
RoboErikc2d53302011-06-03 09:37:58 -0700934 */
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -0800935 public static final class Attendees implements BaseColumns, AttendeesColumns, EventsColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936
RoboErikc2d53302011-06-03 09:37:58 -0700937 /**
938 * The content:// style URL for accessing Attendees data
939 */
940 @SuppressWarnings("hiding")
941 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/attendees");
RoboErikc2d53302011-06-03 09:37:58 -0700942 private static final String ATTENDEES_WHERE = Attendees.EVENT_ID + "=?";
943
944 /**
RoboErik36726962011-06-14 14:01:15 -0700945 * This utility class cannot be instantiated
946 */
947 private Attendees() {}
948
949 /**
RoboErikc2d53302011-06-03 09:37:58 -0700950 * Queries all attendees associated with the given event. This is a
951 * blocking call and should not be done on the UI thread.
RoboErik36726962011-06-14 14:01:15 -0700952 *
RoboErikc2d53302011-06-03 09:37:58 -0700953 * @param cr The content resolver to use for the query
954 * @param eventId The id of the event to retrieve attendees for
RoboErik58644022011-07-08 13:39:05 -0700955 * @param projection the columns to return in the cursor
RoboErikc2d53302011-06-03 09:37:58 -0700956 * @return A Cursor containing all attendees for the event
957 */
RoboErik58644022011-07-08 13:39:05 -0700958 public static final Cursor query(ContentResolver cr, long eventId, String[] projection) {
RoboErikc2d53302011-06-03 09:37:58 -0700959 String[] attArgs = {Long.toString(eventId)};
RoboErik58644022011-07-08 13:39:05 -0700960 return cr.query(CONTENT_URI, projection, ATTENDEES_WHERE, attArgs /* selection args */,
RoboErikc2d53302011-06-03 09:37:58 -0700961 null /* sort order */);
962 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800963 }
964
965 /**
966 * Columns from the Events table that other tables join into themselves.
967 */
RoboErikb2c75602011-06-13 12:53:48 -0700968 protected interface EventsColumns {
Andy McFaddendf2e2c82011-04-19 15:08:37 -0700969
970 /**
RoboErikc2d53302011-06-03 09:37:58 -0700971 * The {@link Calendars#_ID} of the calendar the event belongs to.
972 * Column name.
973 * <P>Type: INTEGER</P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800974 */
975 public static final String CALENDAR_ID = "calendar_id";
976
977 /**
RoboErikc2d53302011-06-03 09:37:58 -0700978 * The title of the event. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 * <P>Type: TEXT</P>
980 */
981 public static final String TITLE = "title";
982
983 /**
RoboErikc2d53302011-06-03 09:37:58 -0700984 * The description of the event. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 * <P>Type: TEXT</P>
986 */
987 public static final String DESCRIPTION = "description";
988
989 /**
RoboErikc2d53302011-06-03 09:37:58 -0700990 * Where the event takes place. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800991 * <P>Type: TEXT</P>
992 */
993 public static final String EVENT_LOCATION = "eventLocation";
994
995 /**
RoboErikf8143c52011-09-28 15:16:00 -0700996 * A secondary color for the individual event. This should only be
997 * updated by the sync adapter for a given account.
RoboErik9734df52011-06-09 14:11:25 -0700998 * <P>Type: INTEGER</P>
999 */
1000 public static final String EVENT_COLOR = "eventColor";
1001
1002 /**
RoboErik4172d952011-10-25 13:59:13 -07001003 * A secondary color key for the individual event. NULL or an empty
1004 * string are reserved for indicating that the event does not use a key
1005 * for looking up the color. The provider will update
1006 * {@link #EVENT_COLOR} automatically when a valid key is written to
1007 * this column. The key must reference an existing row of the
RoboErik8a8eebc2011-10-20 16:57:18 -07001008 * {@link Colors} table. @see Colors
1009 * <P>
1010 * Type: TEXT
1011 * </P>
RoboErikf8143c52011-09-28 15:16:00 -07001012 */
RoboErik4172d952011-10-25 13:59:13 -07001013 public static final String EVENT_COLOR_KEY = "eventColor_index";
RoboErikf8143c52011-09-28 15:16:00 -07001014
1015 /**
Alon Albertdc927302012-03-01 16:05:55 -08001016 * This will be {@link #EVENT_COLOR} if it is not null; otherwise, this will be
1017 * {@link Calendars#CALENDAR_COLOR}.
1018 * Read-only value. To modify, write to {@link #EVENT_COLOR} or
1019 * {@link Calendars#CALENDAR_COLOR} directly.
1020 *<P>
1021 * Type: INTEGER
1022 *</P>
1023 */
1024 public static final String DISPLAY_COLOR = "displayColor";
1025
1026 /**
RoboErikc2d53302011-06-03 09:37:58 -07001027 * The event status. Column name.
1028 * <P>Type: INTEGER (one of {@link #STATUS_TENTATIVE}...)</P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 */
1030 public static final String STATUS = "eventStatus";
1031
1032 public static final int STATUS_TENTATIVE = 0;
1033 public static final int STATUS_CONFIRMED = 1;
1034 public static final int STATUS_CANCELED = 2;
1035
1036 /**
1037 * This is a copy of the attendee status for the owner of this event.
1038 * This field is copied here so that we can efficiently filter out
1039 * events that are declined without having to look in the Attendees
RoboErikc2d53302011-06-03 09:37:58 -07001040 * table. Column name.
Ken Shirriff5b387e12009-10-23 09:50:41 -07001041 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001042 * <P>Type: INTEGER (int)</P>
1043 */
1044 public static final String SELF_ATTENDEE_STATUS = "selfAttendeeStatus";
Ken Shirriff5b387e12009-10-23 09:50:41 -07001045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001046 /**
RoboErikc2d53302011-06-03 09:37:58 -07001047 * This column is available for use by sync adapters. Column name.
Marc Blank64a556d2010-02-25 12:53:16 -08001048 * <P>Type: TEXT</P>
1049 */
RoboErik651c02e2011-05-05 15:14:31 -07001050 public static final String SYNC_DATA1 = "sync_data1";
Marc Blank64a556d2010-02-25 12:53:16 -08001051
1052 /**
RoboErik9734df52011-06-09 14:11:25 -07001053 * This column is available for use by sync adapters. Column name.
1054 * <P>Type: TEXT</P>
1055 */
1056 public static final String SYNC_DATA2 = "sync_data2";
1057
1058 /**
1059 * This column is available for use by sync adapters. Column name.
1060 * <P>Type: TEXT</P>
1061 */
1062 public static final String SYNC_DATA3 = "sync_data3";
1063
1064 /**
1065 * This column is available for use by sync adapters. Column name.
1066 * <P>Type: TEXT</P>
1067 */
1068 public static final String SYNC_DATA4 = "sync_data4";
1069
1070 /**
1071 * This column is available for use by sync adapters. Column name.
1072 * <P>Type: TEXT</P>
1073 */
1074 public static final String SYNC_DATA5 = "sync_data5";
1075
1076 /**
1077 * This column is available for use by sync adapters. Column name.
1078 * <P>Type: TEXT</P>
1079 */
1080 public static final String SYNC_DATA6 = "sync_data6";
1081
1082 /**
1083 * This column is available for use by sync adapters. Column name.
Alon Albert866f40a2011-06-06 14:04:00 -07001084 * <P>Type: TEXT</P>
1085 */
1086 public static final String SYNC_DATA7 = "sync_data7";
1087
1088 /**
RoboErik9734df52011-06-09 14:11:25 -07001089 * This column is available for use by sync adapters. Column name.
1090 * <P>Type: TEXT</P>
1091 */
1092 public static final String SYNC_DATA8 = "sync_data8";
1093
1094 /**
1095 * This column is available for use by sync adapters. Column name.
1096 * <P>Type: TEXT</P>
1097 */
1098 public static final String SYNC_DATA9 = "sync_data9";
1099
1100 /**
1101 * This column is available for use by sync adapters. Column name.
1102 * <P>Type: TEXT</P>
1103 */
1104 public static final String SYNC_DATA10 = "sync_data10";
1105
1106 /**
Alon Albert866f40a2011-06-06 14:04:00 -07001107 * Used to indicate that a row is not a real event but an original copy of a locally
1108 * modified event. A copy is made when an event changes from non-dirty to dirty and the
1109 * event is on a calendar with {@link Calendars#CAN_PARTIALLY_UPDATE} set to 1. This copy
1110 * does not get expanded in the instances table and is only visible in queries made by a
1111 * sync adapter. The copy gets removed when the event is changed back to non-dirty by a
1112 * sync adapter.
1113 * <P>Type: INTEGER (boolean)</P>
1114 */
1115 public static final String LAST_SYNCED = "lastSynced";
1116
1117 /**
RoboErikc2d53302011-06-03 09:37:58 -07001118 * The time the event starts in UTC millis since epoch. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001119 * <P>Type: INTEGER (long; millis since epoch)</P>
1120 */
1121 public static final String DTSTART = "dtstart";
1122
1123 /**
RoboErikc2d53302011-06-03 09:37:58 -07001124 * The time the event ends in UTC millis since epoch. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 * <P>Type: INTEGER (long; millis since epoch)</P>
1126 */
1127 public static final String DTEND = "dtend";
1128
1129 /**
RoboErikc2d53302011-06-03 09:37:58 -07001130 * The duration of the event in RFC2445 format. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 * <P>Type: TEXT (duration in RFC2445 format)</P>
1132 */
1133 public static final String DURATION = "duration";
1134
1135 /**
RoboErikc2d53302011-06-03 09:37:58 -07001136 * The timezone for the event. Column name.
1137 * <P>Type: TEXT</P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 */
1139 public static final String EVENT_TIMEZONE = "eventTimezone";
1140
1141 /**
RoboErikc2d53302011-06-03 09:37:58 -07001142 * The timezone for the end time of the event. Column name.
1143 * <P>Type: TEXT</P>
Erikc07b06f2010-05-03 11:37:31 -07001144 */
RoboErik651c02e2011-05-05 15:14:31 -07001145 public static final String EVENT_END_TIMEZONE = "eventEndTimezone";
Erikc07b06f2010-05-03 11:37:31 -07001146
1147 /**
RoboErikc2d53302011-06-03 09:37:58 -07001148 * Is the event all day (time zone independent). Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 * <P>Type: INTEGER (boolean)</P>
1150 */
1151 public static final String ALL_DAY = "allDay";
1152
1153 /**
RoboErik651c02e2011-05-05 15:14:31 -07001154 * Defines how the event shows up for others when the calendar is
RoboErikc2d53302011-06-03 09:37:58 -07001155 * shared. Column name.
1156 * <P>Type: INTEGER (One of {@link #ACCESS_DEFAULT}, ...)</P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 */
RoboErik651c02e2011-05-05 15:14:31 -07001158 public static final String ACCESS_LEVEL = "accessLevel";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159
1160 /**
RoboErik651c02e2011-05-05 15:14:31 -07001161 * Default access is controlled by the server and will be treated as
1162 * public on the device.
1163 */
1164 public static final int ACCESS_DEFAULT = 0;
1165 /**
1166 * Confidential is not used by the app.
1167 */
1168 public static final int ACCESS_CONFIDENTIAL = 1;
1169 /**
RoboErikc2d53302011-06-03 09:37:58 -07001170 * Private shares the event as a free/busy slot with no details.
RoboErik651c02e2011-05-05 15:14:31 -07001171 */
1172 public static final int ACCESS_PRIVATE = 2;
1173 /**
RoboErikc2d53302011-06-03 09:37:58 -07001174 * Public makes the contents visible to anyone with access to the
RoboErik651c02e2011-05-05 15:14:31 -07001175 * calendar.
1176 */
1177 public static final int ACCESS_PUBLIC = 3;
1178
1179 /**
1180 * If this event counts as busy time or is still free time that can be
RoboErikc2d53302011-06-03 09:37:58 -07001181 * scheduled over. Column name.
RoboErik4172d952011-10-25 13:59:13 -07001182 * <P>
1183 * Type: INTEGER (One of {@link #AVAILABILITY_BUSY},
1184 * {@link #AVAILABILITY_FREE}, {@link #AVAILABILITY_TENTATIVE})
1185 * </P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 */
RoboErik651c02e2011-05-05 15:14:31 -07001187 public static final String AVAILABILITY = "availability";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188
RoboErik651c02e2011-05-05 15:14:31 -07001189 /**
1190 * Indicates that this event takes up time and will conflict with other
1191 * events.
1192 */
1193 public static final int AVAILABILITY_BUSY = 0;
1194 /**
1195 * Indicates that this event is free time and will not conflict with
1196 * other events.
1197 */
1198 public static final int AVAILABILITY_FREE = 1;
RoboErikf8143c52011-09-28 15:16:00 -07001199 /**
1200 * Indicates that the owner's availability may change, but should be
1201 * considered busy time that will conflict.
RoboErikf8143c52011-09-28 15:16:00 -07001202 */
1203 public static final int AVAILABILITY_TENTATIVE = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204
1205 /**
RoboErikc2d53302011-06-03 09:37:58 -07001206 * Whether the event has an alarm or not. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001207 * <P>Type: INTEGER (boolean)</P>
1208 */
1209 public static final String HAS_ALARM = "hasAlarm";
1210
1211 /**
RoboErikc2d53302011-06-03 09:37:58 -07001212 * Whether the event has extended properties or not. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 * <P>Type: INTEGER (boolean)</P>
1214 */
1215 public static final String HAS_EXTENDED_PROPERTIES = "hasExtendedProperties";
1216
1217 /**
RoboErikc2d53302011-06-03 09:37:58 -07001218 * The recurrence rule for the event. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 * <P>Type: TEXT</P>
1220 */
1221 public static final String RRULE = "rrule";
1222
1223 /**
RoboErikc2d53302011-06-03 09:37:58 -07001224 * The recurrence dates for the event. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001225 * <P>Type: TEXT</P>
1226 */
1227 public static final String RDATE = "rdate";
1228
1229 /**
RoboErikc2d53302011-06-03 09:37:58 -07001230 * The recurrence exception rule for the event. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 * <P>Type: TEXT</P>
1232 */
1233 public static final String EXRULE = "exrule";
1234
1235 /**
RoboErikc2d53302011-06-03 09:37:58 -07001236 * The recurrence exception dates for the event. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 * <P>Type: TEXT</P>
1238 */
1239 public static final String EXDATE = "exdate";
1240
1241 /**
RoboErikc2d53302011-06-03 09:37:58 -07001242 * The {@link Events#_ID} of the original recurring event for which this
1243 * event is an exception. Column name.
RoboErikc0bd9bc2011-05-13 17:54:24 -07001244 * <P>Type: TEXT</P>
1245 */
1246 public static final String ORIGINAL_ID = "original_id";
1247
1248 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 * The _sync_id of the original recurring event for which this event is
RoboErikc0bd9bc2011-05-13 17:54:24 -07001250 * an exception. The provider should keep the original_id in sync when
RoboErikc2d53302011-06-03 09:37:58 -07001251 * this is updated. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001252 * <P>Type: TEXT</P>
1253 */
RoboErik651c02e2011-05-05 15:14:31 -07001254 public static final String ORIGINAL_SYNC_ID = "original_sync_id";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255
1256 /**
1257 * The original instance time of the recurring event for which this
RoboErikc2d53302011-06-03 09:37:58 -07001258 * event is an exception. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 * <P>Type: INTEGER (long; millis since epoch)</P>
1260 */
1261 public static final String ORIGINAL_INSTANCE_TIME = "originalInstanceTime";
1262
1263 /**
1264 * The allDay status (true or false) of the original recurring event
RoboErikc2d53302011-06-03 09:37:58 -07001265 * for which this event is an exception. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 * <P>Type: INTEGER (boolean)</P>
1267 */
1268 public static final String ORIGINAL_ALL_DAY = "originalAllDay";
1269
1270 /**
RoboErikc2d53302011-06-03 09:37:58 -07001271 * The last date this event repeats on, or NULL if it never ends. Column
1272 * name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 * <P>Type: INTEGER (long; millis since epoch)</P>
1274 */
1275 public static final String LAST_DATE = "lastDate";
Ken Shirriff79f0c562009-08-05 13:29:42 -07001276
1277 /**
1278 * Whether the event has attendee information. True if the event
1279 * has full attendee data, false if the event has information about
RoboErikc2d53302011-06-03 09:37:58 -07001280 * self only. Column name.
Ken Shirriff79f0c562009-08-05 13:29:42 -07001281 * <P>Type: INTEGER (boolean)</P>
1282 */
1283 public static final String HAS_ATTENDEE_DATA = "hasAttendeeData";
Ken Shirriff3d037072009-08-17 15:43:21 -07001284
1285 /**
RoboErikc2d53302011-06-03 09:37:58 -07001286 * Whether guests can modify the event. Column name.
Ken Shirriff3d037072009-08-17 15:43:21 -07001287 * <P>Type: INTEGER (boolean)</P>
1288 */
1289 public static final String GUESTS_CAN_MODIFY = "guestsCanModify";
1290
1291 /**
RoboErikc2d53302011-06-03 09:37:58 -07001292 * Whether guests can invite other guests. Column name.
Ken Shirriff3d037072009-08-17 15:43:21 -07001293 * <P>Type: INTEGER (boolean)</P>
1294 */
1295 public static final String GUESTS_CAN_INVITE_OTHERS = "guestsCanInviteOthers";
1296
1297 /**
RoboErikc2d53302011-06-03 09:37:58 -07001298 * Whether guests can see the list of attendees. Column name.
Ken Shirriff3d037072009-08-17 15:43:21 -07001299 * <P>Type: INTEGER (boolean)</P>
1300 */
1301 public static final String GUESTS_CAN_SEE_GUESTS = "guestsCanSeeGuests";
1302
1303 /**
RoboErikc2d53302011-06-03 09:37:58 -07001304 * Email of the organizer (owner) of the event. Column name.
Ken Shirriff3d037072009-08-17 15:43:21 -07001305 * <P>Type: STRING</P>
1306 */
1307 public static final String ORGANIZER = "organizer";
1308
1309 /**
Alon Albert0a9a2192012-09-18 11:10:49 -07001310 * Are we the organizer of this event. If this column is not explicitly set, the provider
1311 * will return 1 if {@link #ORGANIZER} is equal to {@link Calendars#OWNER_ACCOUNT}.
1312 * Column name.
1313 * <P>Type: STRING</P>
1314 */
1315 public static final String IS_ORGANIZER = "isOrganizer";
1316
1317 /**
RoboErikc2d53302011-06-03 09:37:58 -07001318 * Whether the user can invite others to the event. The
1319 * GUESTS_CAN_INVITE_OTHERS is a setting that applies to an arbitrary
1320 * guest, while CAN_INVITE_OTHERS indicates if the user can invite
1321 * others (either through GUESTS_CAN_INVITE_OTHERS or because the user
1322 * has modify access to the event). Column name.
Ken Shirriff3d037072009-08-17 15:43:21 -07001323 * <P>Type: INTEGER (boolean, readonly)</P>
1324 */
1325 public static final String CAN_INVITE_OTHERS = "canInviteOthers";
Michael Chan37960c72012-04-19 00:18:13 -07001326
1327 /**
1328 * The package name of the custom app that can provide a richer
1329 * experience for the event. See the ACTION TYPE
1330 * {@link CalendarContract#ACTION_HANDLE_CUSTOM_EVENT} for details.
1331 * Column name.
1332 * <P> Type: TEXT </P>
1333 */
1334 public static final String CUSTOM_APP_PACKAGE = "customAppPackage";
1335
1336 /**
1337 * The URI used by the custom app for the event. Column name.
1338 * <P>Type: TEXT</P>
1339 */
1340 public static final String CUSTOM_APP_URI = "customAppUri";
1341
Sara Ting4d6f90e2012-09-17 11:17:15 -07001342 /**
1343 * The UID for events added from the RFC 2445 iCalendar format.
1344 * Column name.
1345 * <P>Type: TEXT</P>
1346 */
1347 public static final String UID_2445 = "uid2445";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348 }
1349
1350 /**
RoboErikc2d53302011-06-03 09:37:58 -07001351 * Class that represents an Event Entity. There is one entry per event.
1352 * Recurring events show up as a single entry. This is a helper class to
1353 * make batch operations easier. A {@link ContentResolver} or
1354 * {@link ContentProviderClient} is required as the helper does additional
1355 * queries to add reminders and attendees to each entry.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001356 */
RoboErik651c02e2011-05-05 15:14:31 -07001357 public static final class EventsEntity implements BaseColumns, SyncColumns, EventsColumns {
Fred Quintana328c0e72009-12-07 14:52:28 -08001358 /**
1359 * The content:// style URL for this table
1360 */
Ken Shirriffa69a23b2010-01-21 17:32:39 -08001361 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY +
1362 "/event_entities");
Fred Quintana328c0e72009-12-07 14:52:28 -08001363
RoboErikc2d53302011-06-03 09:37:58 -07001364 /**
RoboErik36726962011-06-14 14:01:15 -07001365 * This utility class cannot be instantiated
1366 */
1367 private EventsEntity() {}
1368
1369 /**
RoboErikc2d53302011-06-03 09:37:58 -07001370 * Creates a new iterator for events
1371 *
1372 * @param cursor An event query
1373 * @param resolver For performing additional queries
1374 * @return an EntityIterator containing one entity per event in the
1375 * cursor
1376 */
Fred Quintana328c0e72009-12-07 14:52:28 -08001377 public static EntityIterator newEntityIterator(Cursor cursor, ContentResolver resolver) {
1378 return new EntityIteratorImpl(cursor, resolver);
1379 }
1380
RoboErikc2d53302011-06-03 09:37:58 -07001381 /**
1382 * Creates a new iterator for events
1383 *
1384 * @param cursor An event query
1385 * @param provider For performing additional queries
1386 * @return an EntityIterator containing one entity per event in the
1387 * cursor
1388 */
Fred Quintana328c0e72009-12-07 14:52:28 -08001389 public static EntityIterator newEntityIterator(Cursor cursor,
1390 ContentProviderClient provider) {
1391 return new EntityIteratorImpl(cursor, provider);
1392 }
1393
1394 private static class EntityIteratorImpl extends CursorEntityIterator {
1395 private final ContentResolver mResolver;
1396 private final ContentProviderClient mProvider;
1397
1398 private static final String[] REMINDERS_PROJECTION = new String[] {
1399 Reminders.MINUTES,
1400 Reminders.METHOD,
1401 };
1402 private static final int COLUMN_MINUTES = 0;
1403 private static final int COLUMN_METHOD = 1;
1404
1405 private static final String[] ATTENDEES_PROJECTION = new String[] {
1406 Attendees.ATTENDEE_NAME,
1407 Attendees.ATTENDEE_EMAIL,
1408 Attendees.ATTENDEE_RELATIONSHIP,
1409 Attendees.ATTENDEE_TYPE,
1410 Attendees.ATTENDEE_STATUS,
Michael Chan48ec6222012-04-17 15:58:28 -07001411 Attendees.ATTENDEE_IDENTITY,
1412 Attendees.ATTENDEE_ID_NAMESPACE
Fred Quintana328c0e72009-12-07 14:52:28 -08001413 };
1414 private static final int COLUMN_ATTENDEE_NAME = 0;
1415 private static final int COLUMN_ATTENDEE_EMAIL = 1;
1416 private static final int COLUMN_ATTENDEE_RELATIONSHIP = 2;
1417 private static final int COLUMN_ATTENDEE_TYPE = 3;
1418 private static final int COLUMN_ATTENDEE_STATUS = 4;
Michael Chan48ec6222012-04-17 15:58:28 -07001419 private static final int COLUMN_ATTENDEE_IDENTITY = 5;
1420 private static final int COLUMN_ATTENDEE_ID_NAMESPACE = 6;
1421
Fred Quintana328c0e72009-12-07 14:52:28 -08001422 private static final String[] EXTENDED_PROJECTION = new String[] {
Marc Blank8f643c12010-04-29 14:16:48 -07001423 ExtendedProperties._ID,
Fred Quintana328c0e72009-12-07 14:52:28 -08001424 ExtendedProperties.NAME,
Marc Blank8f643c12010-04-29 14:16:48 -07001425 ExtendedProperties.VALUE
Fred Quintana328c0e72009-12-07 14:52:28 -08001426 };
Marc Blank8f643c12010-04-29 14:16:48 -07001427 private static final int COLUMN_ID = 0;
1428 private static final int COLUMN_NAME = 1;
1429 private static final int COLUMN_VALUE = 2;
Fred Quintana328c0e72009-12-07 14:52:28 -08001430
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001431 private static final String WHERE_EVENT_ID = "event_id=?";
1432
Fred Quintana328c0e72009-12-07 14:52:28 -08001433 public EntityIteratorImpl(Cursor cursor, ContentResolver resolver) {
1434 super(cursor);
1435 mResolver = resolver;
1436 mProvider = null;
1437 }
1438
1439 public EntityIteratorImpl(Cursor cursor, ContentProviderClient provider) {
1440 super(cursor);
1441 mResolver = null;
1442 mProvider = provider;
1443 }
1444
Marc Blank64a556d2010-02-25 12:53:16 -08001445 @Override
Fred Quintana328c0e72009-12-07 14:52:28 -08001446 public Entity getEntityAndIncrementCursor(Cursor cursor) throws RemoteException {
1447 // we expect the cursor is already at the row we need to read from
1448 final long eventId = cursor.getLong(cursor.getColumnIndexOrThrow(Events._ID));
1449 ContentValues cv = new ContentValues();
1450 cv.put(Events._ID, eventId);
1451 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, CALENDAR_ID);
Fred Quintana328c0e72009-12-07 14:52:28 -08001452 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, TITLE);
1453 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, DESCRIPTION);
1454 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, EVENT_LOCATION);
1455 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, STATUS);
1456 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, SELF_ATTENDEE_STATUS);
Fred Quintana328c0e72009-12-07 14:52:28 -08001457 DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DTSTART);
1458 DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DTEND);
1459 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, DURATION);
1460 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, EVENT_TIMEZONE);
RoboErikc0bd9bc2011-05-13 17:54:24 -07001461 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, EVENT_END_TIMEZONE);
Fred Quintana328c0e72009-12-07 14:52:28 -08001462 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ALL_DAY);
RoboErik651c02e2011-05-05 15:14:31 -07001463 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, ACCESS_LEVEL);
1464 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, AVAILABILITY);
Alon Albert971c28b2013-02-04 13:49:50 -08001465 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, EVENT_COLOR);
Alon Albert0a35dd52013-02-05 11:07:56 -08001466 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, EVENT_COLOR_KEY);
Fred Quintana328c0e72009-12-07 14:52:28 -08001467 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, HAS_ALARM);
1468 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
1469 HAS_EXTENDED_PROPERTIES);
1470 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, RRULE);
1471 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, RDATE);
1472 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, EXRULE);
1473 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, EXDATE);
RoboErik651c02e2011-05-05 15:14:31 -07001474 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ORIGINAL_SYNC_ID);
RoboErikc0bd9bc2011-05-13 17:54:24 -07001475 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ORIGINAL_ID);
Fred Quintana328c0e72009-12-07 14:52:28 -08001476 DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv,
1477 ORIGINAL_INSTANCE_TIME);
1478 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, ORIGINAL_ALL_DAY);
1479 DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, LAST_DATE);
1480 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, HAS_ATTENDEE_DATA);
1481 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv,
1482 GUESTS_CAN_INVITE_OTHERS);
1483 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, GUESTS_CAN_MODIFY);
1484 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, GUESTS_CAN_SEE_GUESTS);
Michael Chanbb9fd4a2012-04-24 17:32:03 -07001485 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CUSTOM_APP_PACKAGE);
1486 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CUSTOM_APP_URI);
Sara Ting4d6f90e2012-09-17 11:17:15 -07001487 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, UID_2445);
Fred Quintana328c0e72009-12-07 14:52:28 -08001488 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ORGANIZER);
Alon Albert0a9a2192012-09-18 11:10:49 -07001489 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, IS_ORGANIZER);
Fred Quintana328c0e72009-12-07 14:52:28 -08001490 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_ID);
RoboErik651c02e2011-05-05 15:14:31 -07001491 DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY);
Alon Albert8ac6a632012-12-17 17:21:18 -08001492 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, MUTATORS);
Alon Albert866f40a2011-06-06 14:04:00 -07001493 DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, LAST_SYNCED);
RoboErikc2d53302011-06-03 09:37:58 -07001494 DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, DELETED);
RoboErik9734df52011-06-09 14:11:25 -07001495 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA1);
1496 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA2);
1497 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA3);
1498 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA4);
1499 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA5);
1500 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA6);
1501 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA7);
1502 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA8);
1503 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA9);
1504 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA10);
RoboErikbe010392011-05-26 12:28:38 -07001505 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC1);
1506 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC2);
1507 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC3);
1508 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC4);
1509 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC5);
1510 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC6);
RoboErik9734df52011-06-09 14:11:25 -07001511 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC7);
1512 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC8);
1513 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC9);
1514 DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC10);
Fred Quintana328c0e72009-12-07 14:52:28 -08001515
1516 Entity entity = new Entity(cv);
1517 Cursor subCursor;
1518 if (mResolver != null) {
1519 subCursor = mResolver.query(Reminders.CONTENT_URI, REMINDERS_PROJECTION,
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001520 WHERE_EVENT_ID,
1521 new String[] { Long.toString(eventId) } /* selectionArgs */,
1522 null /* sortOrder */);
Fred Quintana328c0e72009-12-07 14:52:28 -08001523 } else {
1524 subCursor = mProvider.query(Reminders.CONTENT_URI, REMINDERS_PROJECTION,
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001525 WHERE_EVENT_ID,
1526 new String[] { Long.toString(eventId) } /* selectionArgs */,
1527 null /* sortOrder */);
Fred Quintana328c0e72009-12-07 14:52:28 -08001528 }
1529 try {
1530 while (subCursor.moveToNext()) {
1531 ContentValues reminderValues = new ContentValues();
1532 reminderValues.put(Reminders.MINUTES, subCursor.getInt(COLUMN_MINUTES));
1533 reminderValues.put(Reminders.METHOD, subCursor.getInt(COLUMN_METHOD));
1534 entity.addSubValue(Reminders.CONTENT_URI, reminderValues);
1535 }
1536 } finally {
1537 subCursor.close();
1538 }
1539
1540 if (mResolver != null) {
1541 subCursor = mResolver.query(Attendees.CONTENT_URI, ATTENDEES_PROJECTION,
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001542 WHERE_EVENT_ID,
1543 new String[] { Long.toString(eventId) } /* selectionArgs */,
1544 null /* sortOrder */);
Fred Quintana328c0e72009-12-07 14:52:28 -08001545 } else {
1546 subCursor = mProvider.query(Attendees.CONTENT_URI, ATTENDEES_PROJECTION,
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001547 WHERE_EVENT_ID,
1548 new String[] { Long.toString(eventId) } /* selectionArgs */,
1549 null /* sortOrder */);
Fred Quintana328c0e72009-12-07 14:52:28 -08001550 }
1551 try {
1552 while (subCursor.moveToNext()) {
1553 ContentValues attendeeValues = new ContentValues();
1554 attendeeValues.put(Attendees.ATTENDEE_NAME,
1555 subCursor.getString(COLUMN_ATTENDEE_NAME));
1556 attendeeValues.put(Attendees.ATTENDEE_EMAIL,
1557 subCursor.getString(COLUMN_ATTENDEE_EMAIL));
1558 attendeeValues.put(Attendees.ATTENDEE_RELATIONSHIP,
1559 subCursor.getInt(COLUMN_ATTENDEE_RELATIONSHIP));
1560 attendeeValues.put(Attendees.ATTENDEE_TYPE,
1561 subCursor.getInt(COLUMN_ATTENDEE_TYPE));
1562 attendeeValues.put(Attendees.ATTENDEE_STATUS,
1563 subCursor.getInt(COLUMN_ATTENDEE_STATUS));
Michael Chan48ec6222012-04-17 15:58:28 -07001564 attendeeValues.put(Attendees.ATTENDEE_IDENTITY,
Michael Chana07ea5d2012-07-13 14:10:40 -07001565 subCursor.getString(COLUMN_ATTENDEE_IDENTITY));
Michael Chan48ec6222012-04-17 15:58:28 -07001566 attendeeValues.put(Attendees.ATTENDEE_ID_NAMESPACE,
Michael Chana07ea5d2012-07-13 14:10:40 -07001567 subCursor.getString(COLUMN_ATTENDEE_ID_NAMESPACE));
Fred Quintana328c0e72009-12-07 14:52:28 -08001568 entity.addSubValue(Attendees.CONTENT_URI, attendeeValues);
1569 }
1570 } finally {
1571 subCursor.close();
1572 }
1573
1574 if (mResolver != null) {
1575 subCursor = mResolver.query(ExtendedProperties.CONTENT_URI, EXTENDED_PROJECTION,
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001576 WHERE_EVENT_ID,
1577 new String[] { Long.toString(eventId) } /* selectionArgs */,
1578 null /* sortOrder */);
Fred Quintana328c0e72009-12-07 14:52:28 -08001579 } else {
1580 subCursor = mProvider.query(ExtendedProperties.CONTENT_URI, EXTENDED_PROJECTION,
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001581 WHERE_EVENT_ID,
1582 new String[] { Long.toString(eventId) } /* selectionArgs */,
1583 null /* sortOrder */);
Fred Quintana328c0e72009-12-07 14:52:28 -08001584 }
1585 try {
1586 while (subCursor.moveToNext()) {
1587 ContentValues extendedValues = new ContentValues();
Marc Blank8f643c12010-04-29 14:16:48 -07001588 extendedValues.put(ExtendedProperties._ID,
1589 subCursor.getString(COLUMN_ID));
Ken Shirriff3b168922010-01-27 12:27:28 -08001590 extendedValues.put(ExtendedProperties.NAME,
1591 subCursor.getString(COLUMN_NAME));
Fred Quintana328c0e72009-12-07 14:52:28 -08001592 extendedValues.put(ExtendedProperties.VALUE,
Ken Shirriff3b168922010-01-27 12:27:28 -08001593 subCursor.getString(COLUMN_VALUE));
Fred Quintana328c0e72009-12-07 14:52:28 -08001594 entity.addSubValue(ExtendedProperties.CONTENT_URI, extendedValues);
1595 }
1596 } finally {
1597 subCursor.close();
1598 }
1599
1600 cursor.moveToNext();
1601 return entity;
1602 }
1603 }
1604 }
1605
1606 /**
RoboErikf4010c52011-06-17 11:04:26 -07001607 * Constants and helpers for the Events table, which contains details for
1608 * individual events. <h3>Operations</h3> All operations can be done either
1609 * as an app or as a sync adapter. To perform an operation as a sync adapter
1610 * {@link #CALLER_IS_SYNCADAPTER} should be set to true and
1611 * {@link #ACCOUNT_NAME} and {@link #ACCOUNT_TYPE} must be set in the Uri
1612 * parameters. See
1613 * {@link Uri.Builder#appendQueryParameter(java.lang.String, java.lang.String)}
1614 * for details on adding parameters. Sync adapters have write access to more
1615 * columns but are restricted to a single account at a time.
RoboErikfe37b492011-06-16 12:31:56 -07001616 * <dl>
1617 * <dt><b>Insert</b></dt>
1618 * <dd>When inserting a new event the following fields must be included:
1619 * <ul>
1620 * <li>dtstart</li>
Michael Chane6fbf652011-10-18 14:43:11 -07001621 * <li>dtend if the event is non-recurring</li>
1622 * <li>duration if the event is recurring</li>
1623 * <li>rrule or rdate if the event is recurring</li>
RoboErik4172d952011-10-25 13:59:13 -07001624 * <li>eventTimezone</li>
RoboErikfe37b492011-06-16 12:31:56 -07001625 * <li>a calendar_id</li>
1626 * </ul>
1627 * There are also further requirements when inserting or updating an event.
1628 * See the section on Writing to Events.</dd>
1629 * <dt><b>Update</b></dt>
RoboErikf4010c52011-06-17 11:04:26 -07001630 * <dd>To perform an update of an Event the {@link Events#_ID} of the event
1631 * should be provided either as an appended id to the Uri (
RoboErikfe37b492011-06-16 12:31:56 -07001632 * {@link ContentUris#withAppendedId}) or as the first selection item--the
1633 * selection should start with "_id=?" and the first selectionArg should be
RoboErikf4010c52011-06-17 11:04:26 -07001634 * the _id of the event. Updates may also be done using a selection and no
1635 * id. Updating an event must respect the same rules as inserting and is
1636 * further restricted in the fields that can be written. See the section on
1637 * Writing to Events.</dd>
RoboErikfe37b492011-06-16 12:31:56 -07001638 * <dt><b>Delete</b></dt>
1639 * <dd>Events can be deleted either by the {@link Events#_ID} as an appended
1640 * id on the Uri or using any standard selection. If an appended id is used
1641 * a selection is not allowed. There are two versions of delete: as an app
1642 * and as a sync adapter. An app delete will set the deleted column on an
1643 * event and remove all instances of that event. A sync adapter delete will
1644 * remove the event from the database and all associated data.</dd>
1645 * <dt><b>Query</b></dt>
1646 * <dd>Querying the Events table will get you all information about a set of
1647 * events except their reminders, attendees, and extended properties. There
1648 * will be one row returned for each event that matches the query selection,
1649 * or at most a single row if the {@link Events#_ID} is appended to the Uri.
1650 * Recurring events will only return a single row regardless of the number
1651 * of times that event repeats.</dd>
1652 * </dl>
1653 * <h3>Writing to Events</h3> There are further restrictions on all Updates
1654 * and Inserts in the Events table:
1655 * <ul>
1656 * <li>If allDay is set to 1 eventTimezone must be {@link Time#TIMEZONE_UTC}
1657 * and the time must correspond to a midnight boundary.</li>
1658 * <li>Exceptions are not allowed to recur. If rrule or rdate is not empty,
1659 * original_id and original_sync_id must be empty.</li>
1660 * <li>In general a calendar_id should not be modified after insertion. This
1661 * is not explicitly forbidden but many sync adapters will not behave in an
1662 * expected way if the calendar_id is modified.</li>
1663 * </ul>
1664 * The following Events columns are writable by both an app and a sync
1665 * adapter.
1666 * <ul>
1667 * <li>{@link #CALENDAR_ID}</li>
1668 * <li>{@link #ORGANIZER}</li>
1669 * <li>{@link #TITLE}</li>
1670 * <li>{@link #EVENT_LOCATION}</li>
1671 * <li>{@link #DESCRIPTION}</li>
1672 * <li>{@link #EVENT_COLOR}</li>
1673 * <li>{@link #DTSTART}</li>
1674 * <li>{@link #DTEND}</li>
1675 * <li>{@link #EVENT_TIMEZONE}</li>
1676 * <li>{@link #EVENT_END_TIMEZONE}</li>
1677 * <li>{@link #DURATION}</li>
1678 * <li>{@link #ALL_DAY}</li>
1679 * <li>{@link #RRULE}</li>
1680 * <li>{@link #RDATE}</li>
1681 * <li>{@link #EXRULE}</li>
1682 * <li>{@link #EXDATE}</li>
1683 * <li>{@link #ORIGINAL_ID}</li>
1684 * <li>{@link #ORIGINAL_SYNC_ID}</li>
1685 * <li>{@link #ORIGINAL_INSTANCE_TIME}</li>
1686 * <li>{@link #ORIGINAL_ALL_DAY}</li>
1687 * <li>{@link #ACCESS_LEVEL}</li>
1688 * <li>{@link #AVAILABILITY}</li>
1689 * <li>{@link #GUESTS_CAN_MODIFY}</li>
1690 * <li>{@link #GUESTS_CAN_INVITE_OTHERS}</li>
1691 * <li>{@link #GUESTS_CAN_SEE_GUESTS}</li>
Michael Chanbb9fd4a2012-04-24 17:32:03 -07001692 * <li>{@link #CUSTOM_APP_PACKAGE}</li>
1693 * <li>{@link #CUSTOM_APP_URI}</li>
Sara Ting4d6f90e2012-09-17 11:17:15 -07001694 * <li>{@link #UID_2445}</li>
RoboErikfe37b492011-06-16 12:31:56 -07001695 * </ul>
1696 * The following Events columns are writable only by a sync adapter
1697 * <ul>
1698 * <li>{@link #DIRTY}</li>
Alon Albert8ac6a632012-12-17 17:21:18 -08001699 * <li>{@link #MUTATORS}</li>
RoboErikfe37b492011-06-16 12:31:56 -07001700 * <li>{@link #_SYNC_ID}</li>
1701 * <li>{@link #SYNC_DATA1}</li>
1702 * <li>{@link #SYNC_DATA2}</li>
1703 * <li>{@link #SYNC_DATA3}</li>
1704 * <li>{@link #SYNC_DATA4}</li>
1705 * <li>{@link #SYNC_DATA5}</li>
1706 * <li>{@link #SYNC_DATA6}</li>
1707 * <li>{@link #SYNC_DATA7}</li>
1708 * <li>{@link #SYNC_DATA8}</li>
1709 * <li>{@link #SYNC_DATA9}</li>
1710 * <li>{@link #SYNC_DATA10}</li>
1711 * </ul>
1712 * The remaining columns are either updated by the provider only or are
1713 * views into other tables and cannot be changed through the Events table.
Fred Quintana328c0e72009-12-07 14:52:28 -08001714 */
RoboErik9734df52011-06-09 14:11:25 -07001715 public static final class Events implements BaseColumns, SyncColumns, EventsColumns,
RoboErike00d5892011-06-23 15:16:55 -07001716 CalendarColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001717
RoboErikc2d53302011-06-03 09:37:58 -07001718 /**
RoboErikc2d53302011-06-03 09:37:58 -07001719 * The content:// style URL for interacting with events. Appending an
1720 * event id using {@link ContentUris#withAppendedId(Uri, long)} will
1721 * specify a single event.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001722 */
RoboErikc2d53302011-06-03 09:37:58 -07001723 @SuppressWarnings("hiding")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001724 public static final Uri CONTENT_URI =
Ken Shirriffa69a23b2010-01-21 17:32:39 -08001725 Uri.parse("content://" + AUTHORITY + "/events");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001727 /**
yuemingw369f96d2018-12-05 22:07:04 +00001728 * The content:// style URL for querying Events table in the managed profile. Appending an
yuemingwb714ba02018-10-26 18:54:44 +01001729 * event id using {@link ContentUris#withAppendedId(Uri, long)} will
1730 * specify a single event.
1731 *
1732 * <p>The following columns are allowed to be queried via this uri:
1733 * <ul>
1734 * <li>{@link #_ID}</li>
1735 * <li>{@link #CALENDAR_ID}</li>
1736 * <li>{@link #TITLE}</li>
1737 * <li>{@link #EVENT_LOCATION}</li>
1738 * <li>{@link #EVENT_COLOR}</li>
1739 * <li>{@link #STATUS}</li>
1740 * <li>{@link #DTSTART}</li>
1741 * <li>{@link #DTEND}</li>
1742 * <li>{@link #EVENT_TIMEZONE}</li>
1743 * <li>{@link #EVENT_END_TIMEZONE}</li>
1744 * <li>{@link #DURATION}</li>
1745 * <li>{@link #ALL_DAY}</li>
1746 * <li>{@link #AVAILABILITY}</li>
1747 * <li>{@link #RRULE}</li>
1748 * <li>{@link #RDATE}</li>
1749 * <li>{@link #EXRULE}</li>
1750 * <li>{@link #EXDATE}</li>
1751 * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
1752 * <li>{@link #CALENDAR_COLOR}</li>
1753 * <li>{@link #VISIBLE}</li>
1754 * <li>{@link #CALENDAR_TIME_ZONE}</li>
1755 * </ul>
1756 *
1757 * <p>{@link IllegalArgumentException} will be thrown if there exist columns in the
1758 * projection of the query to this uri that are not contained in the above list.
1759 *
1760 * <p>This uri will return an empty cursor if the calling user is not a parent profile
yuemingw369f96d2018-12-05 22:07:04 +00001761 * of a managed profile, or cross profile calendar is disabled in Settings, or this uri is
1762 * queried from a package that is not whitelisted by profile owner of the managed profile
1763 * via {@link DevicePolicyManager#addCrossProfileCalendarPackage(ComponentName, String)}.
yuemingwb714ba02018-10-26 18:54:44 +01001764 *
1765 * @see DevicePolicyManager#getCrossProfileCalendarPackages(ComponentName)
1766 * @see Settings.Secure#CROSS_PROFILE_CALENDAR_ENABLED
1767 */
1768 public static final Uri ENTERPRISE_CONTENT_URI =
1769 Uri.parse("content://" + AUTHORITY + "/enterprise/events");
1770
1771 /**
Andy McFadden4a8c4782011-05-24 13:00:29 -07001772 * The content:// style URI for recurring event exceptions. Insertions require an
1773 * appended event ID. Deletion of exceptions requires both the original event ID and
1774 * the exception event ID (see {@link Uri.Builder#appendPath}).
1775 */
RoboErik083cd2d2011-06-30 11:53:05 -07001776 public static final Uri CONTENT_EXCEPTION_URI =
Andy McFadden4a8c4782011-05-24 13:00:29 -07001777 Uri.parse("content://" + AUTHORITY + "/exception");
1778
1779 /**
RoboErik36726962011-06-14 14:01:15 -07001780 * This utility class cannot be instantiated
1781 */
1782 private Events() {}
1783
1784 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001785 * The default sort order for this table
1786 */
RoboErikc2d53302011-06-03 09:37:58 -07001787 private static final String DEFAULT_SORT_ORDER = "";
RoboErik651c02e2011-05-05 15:14:31 -07001788
1789 /**
1790 * These are columns that should only ever be updated by the provider,
1791 * either because they are views mapped to another table or because they
RoboErik083cd2d2011-06-30 11:53:05 -07001792 * are used for provider only functionality. TODO move to provider
1793 *
1794 * @hide
RoboErik651c02e2011-05-05 15:14:31 -07001795 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01001796 @UnsupportedAppUsage
RoboErik651c02e2011-05-05 15:14:31 -07001797 public static String[] PROVIDER_WRITABLE_COLUMNS = new String[] {
1798 ACCOUNT_NAME,
RoboErikc2d53302011-06-03 09:37:58 -07001799 ACCOUNT_TYPE,
1800 CAL_SYNC1,
1801 CAL_SYNC2,
1802 CAL_SYNC3,
1803 CAL_SYNC4,
1804 CAL_SYNC5,
Alon Albert866f40a2011-06-06 14:04:00 -07001805 CAL_SYNC6,
RoboErik9734df52011-06-09 14:11:25 -07001806 CAL_SYNC7,
1807 CAL_SYNC8,
1808 CAL_SYNC9,
1809 CAL_SYNC10,
1810 ALLOWED_REMINDERS,
RoboErikc7ef9392011-10-27 14:11:44 -07001811 ALLOWED_ATTENDEE_TYPES,
1812 ALLOWED_AVAILABILITY,
RoboErik9734df52011-06-09 14:11:25 -07001813 CALENDAR_ACCESS_LEVEL,
1814 CALENDAR_COLOR,
1815 CALENDAR_TIME_ZONE,
1816 CAN_MODIFY_TIME_ZONE,
1817 CAN_ORGANIZER_RESPOND,
1818 CALENDAR_DISPLAY_NAME,
Alon Albert866f40a2011-06-06 14:04:00 -07001819 CAN_PARTIALLY_UPDATE,
RoboErik9734df52011-06-09 14:11:25 -07001820 SYNC_EVENTS,
1821 VISIBLE,
RoboErik651c02e2011-05-05 15:14:31 -07001822 };
1823
1824 /**
1825 * These fields are only writable by a sync adapter. To modify them the
1826 * caller must include CALLER_IS_SYNCADAPTER, _SYNC_ACCOUNT, and
RoboErik083cd2d2011-06-30 11:53:05 -07001827 * _SYNC_ACCOUNT_TYPE in the query parameters. TODO move to provider.
1828 *
1829 * @hide
RoboErik651c02e2011-05-05 15:14:31 -07001830 */
1831 public static final String[] SYNC_WRITABLE_COLUMNS = new String[] {
1832 _SYNC_ID,
RoboErik651c02e2011-05-05 15:14:31 -07001833 DIRTY,
Alon Albert8ac6a632012-12-17 17:21:18 -08001834 MUTATORS,
RoboErik9734df52011-06-09 14:11:25 -07001835 SYNC_DATA1,
1836 SYNC_DATA2,
1837 SYNC_DATA3,
1838 SYNC_DATA4,
1839 SYNC_DATA5,
1840 SYNC_DATA6,
1841 SYNC_DATA7,
1842 SYNC_DATA8,
1843 SYNC_DATA9,
1844 SYNC_DATA10,
RoboErik651c02e2011-05-05 15:14:31 -07001845 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001846 }
1847
1848 /**
RoboErikc2d53302011-06-03 09:37:58 -07001849 * Fields and helpers for interacting with Instances. An instance is a
1850 * single occurrence of an event including time zone specific start and end
RoboErik3771fcb2011-06-16 15:41:31 -07001851 * days and minutes. The instances table is not writable and only provides a
1852 * way to query event occurrences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001853 */
RoboErike00d5892011-06-23 15:16:55 -07001854 public static final class Instances implements BaseColumns, EventsColumns, CalendarColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001855
RoboErike00d5892011-06-23 15:16:55 -07001856 private static final String WHERE_CALENDARS_SELECTED = Calendars.VISIBLE + "=?";
1857 private static final String[] WHERE_CALENDARS_ARGS = {
1858 "1"
1859 };
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001860
RoboErikc2d53302011-06-03 09:37:58 -07001861 /**
RoboErik36726962011-06-14 14:01:15 -07001862 * This utility class cannot be instantiated
1863 */
1864 private Instances() {}
1865
1866 /**
RoboErikc2d53302011-06-03 09:37:58 -07001867 * Performs a query to return all visible instances in the given range.
1868 * This is a blocking function and should not be done on the UI thread.
1869 * This will cause an expansion of recurring events to fill this time
1870 * range if they are not already expanded and will slow down for larger
1871 * time ranges with many recurring events.
1872 *
1873 * @param cr The ContentResolver to use for the query
1874 * @param projection The columns to return
1875 * @param begin The start of the time range to query in UTC millis since
1876 * epoch
1877 * @param end The end of the time range to query in UTC millis since
1878 * epoch
1879 * @return A Cursor containing all instances in the given range
1880 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001881 public static final Cursor query(ContentResolver cr, String[] projection,
1882 long begin, long end) {
1883 Uri.Builder builder = CONTENT_URI.buildUpon();
1884 ContentUris.appendId(builder, begin);
1885 ContentUris.appendId(builder, end);
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08001886 return cr.query(builder.build(), projection, WHERE_CALENDARS_SELECTED,
RoboErike00d5892011-06-23 15:16:55 -07001887 WHERE_CALENDARS_ARGS, DEFAULT_SORT_ORDER);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001888 }
1889
RoboErikc2d53302011-06-03 09:37:58 -07001890 /**
1891 * Performs a query to return all visible instances in the given range
1892 * that match the given query. This is a blocking function and should
1893 * not be done on the UI thread. This will cause an expansion of
1894 * recurring events to fill this time range if they are not already
1895 * expanded and will slow down for larger time ranges with many
1896 * recurring events.
1897 *
1898 * @param cr The ContentResolver to use for the query
1899 * @param projection The columns to return
1900 * @param begin The start of the time range to query in UTC millis since
1901 * epoch
1902 * @param end The end of the time range to query in UTC millis since
1903 * epoch
1904 * @param searchQuery A string of space separated search terms. Segments
1905 * enclosed by double quotes will be treated as a single
1906 * term.
1907 * @return A Cursor of instances matching the search terms in the given
1908 * time range
1909 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001910 public static final Cursor query(ContentResolver cr, String[] projection,
Mason Tang19f84582010-07-08 18:01:41 -07001911 long begin, long end, String searchQuery) {
1912 Uri.Builder builder = CONTENT_SEARCH_URI.buildUpon();
1913 ContentUris.appendId(builder, begin);
1914 ContentUris.appendId(builder, end);
RoboErikc2d53302011-06-03 09:37:58 -07001915 builder = builder.appendPath(searchQuery);
RoboErike00d5892011-06-23 15:16:55 -07001916 return cr.query(builder.build(), projection, WHERE_CALENDARS_SELECTED,
1917 WHERE_CALENDARS_ARGS, DEFAULT_SORT_ORDER);
RoboErikc2d53302011-06-03 09:37:58 -07001918 }
1919
1920 /**
1921 * The content:// style URL for querying an instance range. The begin
1922 * and end of the range to query should be added as path segments if
1923 * this is used directly.
1924 */
1925 @SuppressWarnings("hiding")
Ken Shirriffa69a23b2010-01-21 17:32:39 -08001926 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY +
1927 "/instances/when");
RoboErikc2d53302011-06-03 09:37:58 -07001928 /**
1929 * The content:// style URL for querying an instance range by Julian
1930 * Day. The start and end day should be added as path segments if this
1931 * is used directly.
1932 */
Michael Chan2cfb0d12009-06-30 18:11:23 -07001933 public static final Uri CONTENT_BY_DAY_URI =
Ken Shirriffa69a23b2010-01-21 17:32:39 -08001934 Uri.parse("content://" + AUTHORITY + "/instances/whenbyday");
RoboErikc2d53302011-06-03 09:37:58 -07001935 /**
1936 * The content:// style URL for querying an instance range with a search
1937 * term. The begin, end, and search string should be appended as path
1938 * segments if this is used directly.
1939 */
Mason Tang19f84582010-07-08 18:01:41 -07001940 public static final Uri CONTENT_SEARCH_URI = Uri.parse("content://" + AUTHORITY +
1941 "/instances/search");
RoboErikc2d53302011-06-03 09:37:58 -07001942 /**
1943 * The content:// style URL for querying an instance range with a search
1944 * term. The start day, end day, and search string should be appended as
1945 * path segments if this is used directly.
1946 */
Mason Tang19f84582010-07-08 18:01:41 -07001947 public static final Uri CONTENT_SEARCH_BY_DAY_URI =
1948 Uri.parse("content://" + AUTHORITY + "/instances/searchbyday");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001949
1950 /**
yuemingw369f96d2018-12-05 22:07:04 +00001951 * The content:// style URL for querying an instance range in the managed profile.
yuemingwb714ba02018-10-26 18:54:44 +01001952 * It supports similar semantics as {@link #CONTENT_URI}.
1953 *
1954 * <p>The following columns plus the columns that are whitelisted by
1955 * {@link Events#ENTERPRISE_CONTENT_URI} are allowed to be queried via this uri:
1956 * <ul>
1957 * <li>{@link #_ID}</li>
1958 * <li>{@link #EVENT_ID}</li>
1959 * <li>{@link #BEGIN}</li>
1960 * <li>{@link #END}</li>
1961 * <li>{@link #START_DAY}</li>
1962 * <li>{@link #END_DAY}</li>
1963 * <li>{@link #START_MINUTE}</li>
1964 * <li>{@link #END_MINUTE}</li>
1965 * </ul>
1966 *
1967 * <p>{@link IllegalArgumentException} will be thrown if there exist columns in the
1968 * projection of the query to this uri that are not contained in the above list.
1969 *
1970 * <p>This uri will return an empty cursor if the calling user is not a parent profile
yuemingw369f96d2018-12-05 22:07:04 +00001971 * of a managed profile, or cross profile calendar for the managed profile is disabled in
yuemingwb714ba02018-10-26 18:54:44 +01001972 * Settings, or this uri is queried from a package that is not whitelisted by
yuemingw369f96d2018-12-05 22:07:04 +00001973 * profile owner of the managed profile via
Tor Norbye3332cd52018-12-09 09:28:46 -08001974 * {@link DevicePolicyManager#addCrossProfileCalendarPackage(ComponentName, String)}.
yuemingwb714ba02018-10-26 18:54:44 +01001975 *
1976 * @see DevicePolicyManager#getCrossProfileCalendarPackages(ComponentName)
1977 * @see Settings.Secure#CROSS_PROFILE_CALENDAR_ENABLED
1978 */
1979 public static final Uri ENTERPRISE_CONTENT_URI =
1980 Uri.parse("content://" + AUTHORITY + "/enterprise/instances/when");
1981
1982 /**
1983 * The content:// style URL for querying an instance range by Julian
yuemingw369f96d2018-12-05 22:07:04 +00001984 * Day in the managed profile. It supports similar semantics as {@link #CONTENT_BY_DAY_URI}
yuemingwb714ba02018-10-26 18:54:44 +01001985 * and performs similar checks as {@link #ENTERPRISE_CONTENT_URI}.
1986 */
1987 public static final Uri ENTERPRISE_CONTENT_BY_DAY_URI =
1988 Uri.parse("content://" + AUTHORITY + "/enterprise/instances/whenbyday");
1989
1990 /**
1991 * The content:// style URL for querying an instance range with a search
yuemingw369f96d2018-12-05 22:07:04 +00001992 * term in the managed profile. It supports similar semantics as {@link #CONTENT_SEARCH_URI}
yuemingwb714ba02018-10-26 18:54:44 +01001993 * and performs similar checks as {@link #ENTERPRISE_CONTENT_URI}.
1994 */
1995 public static final Uri ENTERPRISE_CONTENT_SEARCH_URI =
1996 Uri.parse("content://" + AUTHORITY + "/enterprise/instances/search");
1997
1998 /**
1999 * The content:// style URL for querying an instance range with a search
yuemingw369f96d2018-12-05 22:07:04 +00002000 * term in the managed profile. It supports similar semantics as
yuemingwb714ba02018-10-26 18:54:44 +01002001 * {@link #CONTENT_SEARCH_BY_DAY_URI} and performs similar checks as
2002 * {@link #ENTERPRISE_CONTENT_URI}.
2003 */
2004 public static final Uri ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI =
2005 Uri.parse("content://" + AUTHORITY + "/enterprise/instances/searchbyday");
2006
2007 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002008 * The default sort order for this table.
2009 */
RoboErikc2d53302011-06-03 09:37:58 -07002010 private static final String DEFAULT_SORT_ORDER = "begin ASC";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002011
2012 /**
RoboErikc2d53302011-06-03 09:37:58 -07002013 * The beginning time of the instance, in UTC milliseconds. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002014 * <P>Type: INTEGER (long; millis since epoch)</P>
2015 */
2016 public static final String BEGIN = "begin";
2017
2018 /**
RoboErikc2d53302011-06-03 09:37:58 -07002019 * The ending time of the instance, in UTC milliseconds. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002020 * <P>Type: INTEGER (long; millis since epoch)</P>
2021 */
2022 public static final String END = "end";
2023
2024 /**
RoboErikc2d53302011-06-03 09:37:58 -07002025 * The _id of the event for this instance. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002026 * <P>Type: INTEGER (long, foreign key to the Events table)</P>
2027 */
2028 public static final String EVENT_ID = "event_id";
2029
2030 /**
RoboErikc2d53302011-06-03 09:37:58 -07002031 * The Julian start day of the instance, relative to the local time
2032 * zone. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002033 * <P>Type: INTEGER (int)</P>
2034 */
2035 public static final String START_DAY = "startDay";
2036
2037 /**
RoboErikc2d53302011-06-03 09:37:58 -07002038 * The Julian end day of the instance, relative to the local time
2039 * zone. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002040 * <P>Type: INTEGER (int)</P>
2041 */
2042 public static final String END_DAY = "endDay";
2043
2044 /**
2045 * The start minute of the instance measured from midnight in the
RoboErikc2d53302011-06-03 09:37:58 -07002046 * local time zone. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002047 * <P>Type: INTEGER (int)</P>
2048 */
2049 public static final String START_MINUTE = "startMinute";
2050
2051 /**
2052 * The end minute of the instance measured from midnight in the
RoboErikc2d53302011-06-03 09:37:58 -07002053 * local time zone. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002054 * <P>Type: INTEGER (int)</P>
2055 */
2056 public static final String END_MINUTE = "endMinute";
2057 }
2058
RoboErikb2c75602011-06-13 12:53:48 -07002059 protected interface CalendarCacheColumns {
Erik71ad58c2010-09-13 16:41:35 -07002060 /**
RoboErikc2d53302011-06-03 09:37:58 -07002061 * The key for the setting. Keys are defined in {@link CalendarCache}.
Erik71ad58c2010-09-13 16:41:35 -07002062 */
2063 public static final String KEY = "key";
2064
2065 /**
2066 * The value of the given setting.
2067 */
2068 public static final String VALUE = "value";
2069 }
2070
RoboErik083cd2d2011-06-30 11:53:05 -07002071 /**
2072 * CalendarCache stores some settings for calendar including the current
2073 * time zone for the instances. These settings are stored using a key/value
2074 * scheme. A {@link #KEY} must be specified when updating these values.
2075 */
RoboErik36726962011-06-14 14:01:15 -07002076 public static final class CalendarCache implements CalendarCacheColumns {
Erik71ad58c2010-09-13 16:41:35 -07002077 /**
2078 * The URI to use for retrieving the properties from the Calendar db.
2079 */
2080 public static final Uri URI =
2081 Uri.parse("content://" + AUTHORITY + "/properties");
Erik71ad58c2010-09-13 16:41:35 -07002082
2083 /**
RoboErik36726962011-06-14 14:01:15 -07002084 * This utility class cannot be instantiated
2085 */
2086 private CalendarCache() {}
2087
2088 /**
Erik71ad58c2010-09-13 16:41:35 -07002089 * They key for updating the use of auto/home time zones in Calendar.
2090 * Valid values are {@link #TIMEZONE_TYPE_AUTO} or
2091 * {@link #TIMEZONE_TYPE_HOME}.
2092 */
RoboErik083cd2d2011-06-30 11:53:05 -07002093 public static final String KEY_TIMEZONE_TYPE = "timezoneType";
Erik71ad58c2010-09-13 16:41:35 -07002094
2095 /**
2096 * The key for updating the time zone used by the provider when it
2097 * generates the instances table. This should only be written if the
2098 * type is set to {@link #TIMEZONE_TYPE_HOME}. A valid time zone id
2099 * should be written to this field.
2100 */
RoboErik083cd2d2011-06-30 11:53:05 -07002101 public static final String KEY_TIMEZONE_INSTANCES = "timezoneInstances";
Erik71ad58c2010-09-13 16:41:35 -07002102
2103 /**
2104 * The key for reading the last time zone set by the user. This should
2105 * only be read by apps and it will be automatically updated whenever
RoboErik083cd2d2011-06-30 11:53:05 -07002106 * {@link #KEY_TIMEZONE_INSTANCES} is updated with
Erik71ad58c2010-09-13 16:41:35 -07002107 * {@link #TIMEZONE_TYPE_HOME} set.
2108 */
RoboErik083cd2d2011-06-30 11:53:05 -07002109 public static final String KEY_TIMEZONE_INSTANCES_PREVIOUS = "timezoneInstancesPrevious";
Erik71ad58c2010-09-13 16:41:35 -07002110
2111 /**
RoboErik083cd2d2011-06-30 11:53:05 -07002112 * The value to write to {@link #KEY_TIMEZONE_TYPE} if the provider
Erik71ad58c2010-09-13 16:41:35 -07002113 * should stay in sync with the device's time zone.
2114 */
2115 public static final String TIMEZONE_TYPE_AUTO = "auto";
2116
2117 /**
RoboErik083cd2d2011-06-30 11:53:05 -07002118 * The value to write to {@link #KEY_TIMEZONE_TYPE} if the provider
Erik71ad58c2010-09-13 16:41:35 -07002119 * should use a fixed time zone set by the user.
2120 */
2121 public static final String TIMEZONE_TYPE_HOME = "home";
2122 }
2123
2124 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002125 * A few Calendar globals are needed in the CalendarProvider for expanding
RoboErik59dab492011-06-17 11:09:36 -07002126 * the Instances table and these are all stored in the first (and only) row
2127 * of the CalendarMetaData table.
2128 *
2129 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002130 */
RoboErikb2c75602011-06-13 12:53:48 -07002131 protected interface CalendarMetaDataColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002132 /**
2133 * The local timezone that was used for precomputing the fields
2134 * in the Instances table.
2135 */
2136 public static final String LOCAL_TIMEZONE = "localTimezone";
2137
2138 /**
2139 * The minimum time used in expanding the Instances table,
2140 * in UTC milliseconds.
2141 * <P>Type: INTEGER</P>
2142 */
2143 public static final String MIN_INSTANCE = "minInstance";
2144
2145 /**
2146 * The maximum time used in expanding the Instances table,
2147 * in UTC milliseconds.
2148 * <P>Type: INTEGER</P>
2149 */
2150 public static final String MAX_INSTANCE = "maxInstance";
2151
2152 /**
Erik37634642009-12-23 15:24:14 -08002153 * The minimum Julian day in the EventDays table.
2154 * <P>Type: INTEGER</P>
2155 */
2156 public static final String MIN_EVENTDAYS = "minEventDays";
2157
2158 /**
2159 * The maximum Julian day in the EventDays table.
2160 * <P>Type: INTEGER</P>
2161 */
2162 public static final String MAX_EVENTDAYS = "maxEventDays";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002163 }
Ken Shirriff5b387e12009-10-23 09:50:41 -07002164
RoboErikc2d53302011-06-03 09:37:58 -07002165 /**
2166 * @hide
2167 */
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002168 public static final class CalendarMetaData implements CalendarMetaDataColumns, BaseColumns {
RoboErik36726962011-06-14 14:01:15 -07002169
2170 /**
2171 * This utility class cannot be instantiated
2172 */
2173 private CalendarMetaData() {}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 }
Erik37634642009-12-23 15:24:14 -08002175
RoboErikb2c75602011-06-13 12:53:48 -07002176 protected interface EventDaysColumns {
Erik37634642009-12-23 15:24:14 -08002177 /**
RoboErikc2d53302011-06-03 09:37:58 -07002178 * The Julian starting day number. Column name.
Erik37634642009-12-23 15:24:14 -08002179 * <P>Type: INTEGER (int)</P>
2180 */
2181 public static final String STARTDAY = "startDay";
RoboErikc2d53302011-06-03 09:37:58 -07002182 /**
2183 * The Julian ending day number. Column name.
2184 * <P>Type: INTEGER (int)</P>
2185 */
Erikbd8e2e22010-01-07 11:56:46 -08002186 public static final String ENDDAY = "endDay";
Erik37634642009-12-23 15:24:14 -08002187
2188 }
2189
RoboErikc2d53302011-06-03 09:37:58 -07002190 /**
2191 * Fields and helpers for querying for a list of days that contain events.
2192 */
Erik37634642009-12-23 15:24:14 -08002193 public static final class EventDays implements EventDaysColumns {
RoboErikb2c75602011-06-13 12:53:48 -07002194 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY
RoboErikc2d53302011-06-03 09:37:58 -07002195 + "/instances/groupbyday");
RoboErikc2d53302011-06-03 09:37:58 -07002196 private static final String SELECTION = "selected=1";
2197
2198 /**
RoboErik36726962011-06-14 14:01:15 -07002199 * This utility class cannot be instantiated
2200 */
2201 private EventDays() {}
2202
2203 /**
RoboErikc2d53302011-06-03 09:37:58 -07002204 * Retrieves the days with events for the Julian days starting at
2205 * "startDay" for "numDays". It returns a cursor containing startday and
2206 * endday representing the max range of days for all events beginning on
2207 * each startday.This is a blocking function and should not be done on
2208 * the UI thread.
RoboErik36726962011-06-14 14:01:15 -07002209 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002210 * @param cr the ContentResolver
2211 * @param startDay the first Julian day in the range
2212 * @param numDays the number of days to load (must be at least 1)
RoboErik58644022011-07-08 13:39:05 -07002213 * @param projection the columns to return in the cursor
RoboErikc2d53302011-06-03 09:37:58 -07002214 * @return a database cursor containing a list of start and end days for
2215 * events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002216 */
RoboErik58644022011-07-08 13:39:05 -07002217 public static final Cursor query(ContentResolver cr, int startDay, int numDays,
2218 String[] projection) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002219 if (numDays < 1) {
2220 return null;
2221 }
2222 int endDay = startDay + numDays - 1;
2223 Uri.Builder builder = CONTENT_URI.buildUpon();
2224 ContentUris.appendId(builder, startDay);
2225 ContentUris.appendId(builder, endDay);
RoboErik58644022011-07-08 13:39:05 -07002226 return cr.query(builder.build(), projection, SELECTION,
Erik37634642009-12-23 15:24:14 -08002227 null /* selection args */, STARTDAY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002228 }
2229 }
2230
RoboErikb2c75602011-06-13 12:53:48 -07002231 protected interface RemindersColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002232 /**
RoboErikc2d53302011-06-03 09:37:58 -07002233 * The event the reminder belongs to. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002234 * <P>Type: INTEGER (foreign key to the Events table)</P>
2235 */
2236 public static final String EVENT_ID = "event_id";
2237
2238 /**
2239 * The minutes prior to the event that the alarm should ring. -1
2240 * specifies that we should use the default value for the system.
RoboErikc2d53302011-06-03 09:37:58 -07002241 * Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002242 * <P>Type: INTEGER</P>
2243 */
2244 public static final String MINUTES = "minutes";
2245
RoboErikc2d53302011-06-03 09:37:58 -07002246 /**
2247 * Passing this as a minutes value will use the default reminder
2248 * minutes.
2249 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002250 public static final int MINUTES_DEFAULT = -1;
2251
2252 /**
RoboErikc2d53302011-06-03 09:37:58 -07002253 * The alarm method, as set on the server. {@link #METHOD_DEFAULT},
Alon Albertbd251612012-02-23 10:30:51 -08002254 * {@link #METHOD_ALERT}, {@link #METHOD_EMAIL}, {@link #METHOD_SMS} and
2255 * {@link #METHOD_ALARM} are possible values; the device will only
2256 * process {@link #METHOD_DEFAULT} and {@link #METHOD_ALERT} reminders
2257 * (the other types are simply stored so we can send the same reminder
2258 * info back to the server when we make changes).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002259 */
2260 public static final String METHOD = "method";
2261
2262 public static final int METHOD_DEFAULT = 0;
2263 public static final int METHOD_ALERT = 1;
2264 public static final int METHOD_EMAIL = 2;
2265 public static final int METHOD_SMS = 3;
Alon Albertbd251612012-02-23 10:30:51 -08002266 public static final int METHOD_ALARM = 4;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002267 }
2268
RoboErikc2d53302011-06-03 09:37:58 -07002269 /**
RoboErik3771fcb2011-06-16 15:41:31 -07002270 * Fields and helpers for accessing reminders for an event. Each row of this
2271 * table represents a single reminder for an event. Calling
RoboErik58644022011-07-08 13:39:05 -07002272 * {@link #query(ContentResolver, long, String[])} will return a list of reminders for
RoboErik3771fcb2011-06-16 15:41:31 -07002273 * the event with the given eventId. Both apps and sync adapters may write
2274 * to this table. There are three writable fields and all of them must be
2275 * included when inserting a new reminder. They are:
2276 * <ul>
2277 * <li>{@link #EVENT_ID}</li>
2278 * <li>{@link #MINUTES}</li>
2279 * <li>{@link #METHOD}</li>
2280 * </ul>
RoboErikc2d53302011-06-03 09:37:58 -07002281 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002282 public static final class Reminders implements BaseColumns, RemindersColumns, EventsColumns {
RoboErikbec6c362011-06-14 11:06:01 -07002283 private static final String REMINDERS_WHERE = CalendarContract.Reminders.EVENT_ID + "=?";
RoboErikc2d53302011-06-03 09:37:58 -07002284 @SuppressWarnings("hiding")
Ken Shirriffa69a23b2010-01-21 17:32:39 -08002285 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/reminders");
RoboErikc2d53302011-06-03 09:37:58 -07002286
2287 /**
RoboErik36726962011-06-14 14:01:15 -07002288 * This utility class cannot be instantiated
2289 */
2290 private Reminders() {}
2291
2292 /**
RoboErikc2d53302011-06-03 09:37:58 -07002293 * Queries all reminders associated with the given event. This is a
2294 * blocking call and should not be done on the UI thread.
RoboErik36726962011-06-14 14:01:15 -07002295 *
RoboErikc2d53302011-06-03 09:37:58 -07002296 * @param cr The content resolver to use for the query
2297 * @param eventId The id of the event to retrieve reminders for
RoboErik58644022011-07-08 13:39:05 -07002298 * @param projection the columns to return in the cursor
RoboErikc2d53302011-06-03 09:37:58 -07002299 * @return A Cursor containing all reminders for the event
2300 */
RoboErik58644022011-07-08 13:39:05 -07002301 public static final Cursor query(ContentResolver cr, long eventId, String[] projection) {
RoboErikc2d53302011-06-03 09:37:58 -07002302 String[] remArgs = {Long.toString(eventId)};
RoboErik58644022011-07-08 13:39:05 -07002303 return cr.query(CONTENT_URI, projection, REMINDERS_WHERE, remArgs /*selection args*/,
RoboErikc2d53302011-06-03 09:37:58 -07002304 null /* sort order */);
2305 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002306 }
2307
RoboErikb2c75602011-06-13 12:53:48 -07002308 protected interface CalendarAlertsColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002309 /**
RoboErikc2d53302011-06-03 09:37:58 -07002310 * The event that the alert belongs to. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002311 * <P>Type: INTEGER (foreign key to the Events table)</P>
2312 */
2313 public static final String EVENT_ID = "event_id";
2314
2315 /**
RoboErikc2d53302011-06-03 09:37:58 -07002316 * The start time of the event, in UTC. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002317 * <P>Type: INTEGER (long; millis since epoch)</P>
2318 */
2319 public static final String BEGIN = "begin";
2320
2321 /**
RoboErikc2d53302011-06-03 09:37:58 -07002322 * The end time of the event, in UTC. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002323 * <P>Type: INTEGER (long; millis since epoch)</P>
2324 */
2325 public static final String END = "end";
2326
2327 /**
RoboErikc2d53302011-06-03 09:37:58 -07002328 * The alarm time of the event, in UTC. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002329 * <P>Type: INTEGER (long; millis since epoch)</P>
2330 */
2331 public static final String ALARM_TIME = "alarmTime";
2332
2333 /**
2334 * The creation time of this database entry, in UTC.
RoboErikc2d53302011-06-03 09:37:58 -07002335 * Useful for debugging missed reminders. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 * <P>Type: INTEGER (long; millis since epoch)</P>
2337 */
2338 public static final String CREATION_TIME = "creationTime";
2339
2340 /**
2341 * The time that the alarm broadcast was received by the Calendar app,
RoboErikc2d53302011-06-03 09:37:58 -07002342 * in UTC. Useful for debugging missed reminders. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002343 * <P>Type: INTEGER (long; millis since epoch)</P>
2344 */
2345 public static final String RECEIVED_TIME = "receivedTime";
2346
2347 /**
2348 * The time that the notification was created by the Calendar app,
RoboErikc2d53302011-06-03 09:37:58 -07002349 * in UTC. Useful for debugging missed reminders. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002350 * <P>Type: INTEGER (long; millis since epoch)</P>
2351 */
2352 public static final String NOTIFY_TIME = "notifyTime";
2353
2354 /**
RoboErik083cd2d2011-06-30 11:53:05 -07002355 * The state of this alert. It starts out as {@link #STATE_SCHEDULED}, then
2356 * when the alarm goes off, it changes to {@link #STATE_FIRED}, and then when
2357 * the user dismisses the alarm it changes to {@link #STATE_DISMISSED}. Column
RoboErikc2d53302011-06-03 09:37:58 -07002358 * name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002359 * <P>Type: INTEGER</P>
2360 */
2361 public static final String STATE = "state";
2362
RoboErik083cd2d2011-06-30 11:53:05 -07002363 /**
2364 * An alert begins in this state when it is first created.
2365 */
2366 public static final int STATE_SCHEDULED = 0;
2367 /**
2368 * After a notification for an alert has been created it should be
2369 * updated to fired.
2370 */
2371 public static final int STATE_FIRED = 1;
2372 /**
2373 * Once the user has dismissed the notification the alert's state should
2374 * be set to dismissed so it is not fired again.
2375 */
2376 public static final int STATE_DISMISSED = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377
2378 /**
RoboErikc2d53302011-06-03 09:37:58 -07002379 * The number of minutes that this alarm precedes the start time. Column
2380 * name.
2381 * <P>Type: INTEGER</P>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002382 */
2383 public static final String MINUTES = "minutes";
2384
2385 /**
RoboErikc2d53302011-06-03 09:37:58 -07002386 * The default sort order for this alerts queries
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002387 */
Michael Chancdaeafd2009-10-29 00:11:58 -07002388 public static final String DEFAULT_SORT_ORDER = "begin ASC,title ASC";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 }
2390
RoboErikc2d53302011-06-03 09:37:58 -07002391 /**
2392 * Fields and helpers for accessing calendar alerts information. These
RoboErik3771fcb2011-06-16 15:41:31 -07002393 * fields are for tracking which alerts have been fired. Scheduled alarms
RoboErike00d5892011-06-23 15:16:55 -07002394 * will generate an intent using {@link #ACTION_EVENT_REMINDER}. Apps that
RoboErik3771fcb2011-06-16 15:41:31 -07002395 * receive this action may update the {@link #STATE} for the reminder when
2396 * they have finished handling it. Apps that have their notifications
2397 * disabled should not modify the table to ensure that they do not conflict
2398 * with another app that is generating a notification. In general, apps
2399 * should not need to write to this table directly except to update the
2400 * state of a reminder.
RoboErikc2d53302011-06-03 09:37:58 -07002401 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002402 public static final class CalendarAlerts implements BaseColumns,
RoboErike00d5892011-06-23 15:16:55 -07002403 CalendarAlertsColumns, EventsColumns, CalendarColumns {
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08002404
RoboErikc2d53302011-06-03 09:37:58 -07002405 /**
2406 * @hide
2407 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002408 public static final String TABLE_NAME = "CalendarAlerts";
RoboErikc2d53302011-06-03 09:37:58 -07002409 /**
2410 * The Uri for querying calendar alert information
2411 */
2412 @SuppressWarnings("hiding")
Ken Shirriffa69a23b2010-01-21 17:32:39 -08002413 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY +
2414 "/calendar_alerts");
Ken Shirriff5b387e12009-10-23 09:50:41 -07002415
RoboErik36726962011-06-14 14:01:15 -07002416 /**
2417 * This utility class cannot be instantiated
2418 */
2419 private CalendarAlerts() {}
2420
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08002421 private static final String WHERE_ALARM_EXISTS = EVENT_ID + "=?"
2422 + " AND " + BEGIN + "=?"
2423 + " AND " + ALARM_TIME + "=?";
2424
2425 private static final String WHERE_FINDNEXTALARMTIME = ALARM_TIME + ">=?";
2426 private static final String SORT_ORDER_ALARMTIME_ASC = ALARM_TIME + " ASC";
2427
RoboErik083cd2d2011-06-30 11:53:05 -07002428 private static final String WHERE_RESCHEDULE_MISSED_ALARMS = STATE + "=" + STATE_SCHEDULED
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08002429 + " AND " + ALARM_TIME + "<?"
2430 + " AND " + ALARM_TIME + ">?"
2431 + " AND " + END + ">=?";
2432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002433 /**
2434 * This URI is for grouping the query results by event_id and begin
2435 * time. This will return one result per instance of an event. So
2436 * events with multiple alarms will appear just once, but multiple
2437 * instances of a repeating event will show up multiple times.
2438 */
Ken Shirriff5b387e12009-10-23 09:50:41 -07002439 public static final Uri CONTENT_URI_BY_INSTANCE =
Ken Shirriffa69a23b2010-01-21 17:32:39 -08002440 Uri.parse("content://" + AUTHORITY + "/calendar_alerts/by_instance");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441
RoboErik083cd2d2011-06-30 11:53:05 -07002442 private static final boolean DEBUG = false;
Michael Chancdaeafd2009-10-29 00:11:58 -07002443
RoboErikc2d53302011-06-03 09:37:58 -07002444 /**
RoboErik083cd2d2011-06-30 11:53:05 -07002445 * Helper for inserting an alarm time associated with an event TODO move
2446 * to Provider
RoboErikc2d53302011-06-03 09:37:58 -07002447 *
2448 * @hide
2449 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002450 public static final Uri insert(ContentResolver cr, long eventId,
2451 long begin, long end, long alarmTime, int minutes) {
2452 ContentValues values = new ContentValues();
2453 values.put(CalendarAlerts.EVENT_ID, eventId);
2454 values.put(CalendarAlerts.BEGIN, begin);
2455 values.put(CalendarAlerts.END, end);
2456 values.put(CalendarAlerts.ALARM_TIME, alarmTime);
2457 long currentTime = System.currentTimeMillis();
2458 values.put(CalendarAlerts.CREATION_TIME, currentTime);
2459 values.put(CalendarAlerts.RECEIVED_TIME, 0);
2460 values.put(CalendarAlerts.NOTIFY_TIME, 0);
RoboErik083cd2d2011-06-30 11:53:05 -07002461 values.put(CalendarAlerts.STATE, STATE_SCHEDULED);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002462 values.put(CalendarAlerts.MINUTES, minutes);
2463 return cr.insert(CONTENT_URI, values);
2464 }
2465
RoboErikc2d53302011-06-03 09:37:58 -07002466 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002467 * Finds the next alarm after (or equal to) the given time and returns
RoboErikc2d53302011-06-03 09:37:58 -07002468 * the time of that alarm or -1 if no such alarm exists. This is a
RoboErik083cd2d2011-06-30 11:53:05 -07002469 * blocking call and should not be done on the UI thread. TODO move to
2470 * provider
Ken Shirriff5b387e12009-10-23 09:50:41 -07002471 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002472 * @param cr the ContentResolver
2473 * @param millis the time in UTC milliseconds
2474 * @return the next alarm time greater than or equal to "millis", or -1
RoboErikc2d53302011-06-03 09:37:58 -07002475 * if no such alarm exists.
RoboErik083cd2d2011-06-30 11:53:05 -07002476 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002477 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002478 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002479 public static final long findNextAlarmTime(ContentResolver cr, long millis) {
2480 String selection = ALARM_TIME + ">=" + millis;
2481 // TODO: construct an explicit SQL query so that we can add
2482 // "LIMIT 1" to the end and get just one result.
2483 String[] projection = new String[] { ALARM_TIME };
RoboErik083cd2d2011-06-30 11:53:05 -07002484 Cursor cursor = cr.query(CONTENT_URI, projection, WHERE_FINDNEXTALARMTIME,
2485 (new String[] {
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08002486 Long.toString(millis)
RoboErik083cd2d2011-06-30 11:53:05 -07002487 }), SORT_ORDER_ALARMTIME_ASC);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 long alarmTime = -1;
2489 try {
2490 if (cursor != null && cursor.moveToFirst()) {
2491 alarmTime = cursor.getLong(0);
2492 }
2493 } finally {
2494 if (cursor != null) {
2495 cursor.close();
2496 }
2497 }
2498 return alarmTime;
2499 }
Ken Shirriff5b387e12009-10-23 09:50:41 -07002500
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 /**
2502 * Searches the CalendarAlerts table for alarms that should have fired
RoboErik083cd2d2011-06-30 11:53:05 -07002503 * but have not and then reschedules them. This method can be called at
2504 * boot time to restore alarms that may have been lost due to a phone
2505 * reboot. TODO move to provider
Ken Shirriff5b387e12009-10-23 09:50:41 -07002506 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002507 * @param cr the ContentResolver
2508 * @param context the Context
2509 * @param manager the AlarmManager
RoboErik083cd2d2011-06-30 11:53:05 -07002510 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002511 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002512 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002513 public static final void rescheduleMissedAlarms(ContentResolver cr,
2514 Context context, AlarmManager manager) {
2515 // Get all the alerts that have been scheduled but have not fired
2516 // and should have fired by now and are not too old.
2517 long now = System.currentTimeMillis();
Michael Chancdaeafd2009-10-29 00:11:58 -07002518 long ancient = now - DateUtils.DAY_IN_MILLIS;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002519 String[] projection = new String[] {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002520 ALARM_TIME,
2521 };
Michael Chancdaeafd2009-10-29 00:11:58 -07002522
2523 // TODO: construct an explicit SQL query so that we can add
2524 // "GROUPBY" instead of doing a sort and de-dup
RoboErik083cd2d2011-06-30 11:53:05 -07002525 Cursor cursor = cr.query(CalendarAlerts.CONTENT_URI, projection,
2526 WHERE_RESCHEDULE_MISSED_ALARMS, (new String[] {
2527 Long.toString(now), Long.toString(ancient), Long.toString(now)
2528 }), SORT_ORDER_ALARMTIME_ASC);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002529 if (cursor == null) {
2530 return;
2531 }
Michael Chancdaeafd2009-10-29 00:11:58 -07002532
2533 if (DEBUG) {
The Android Open Source Project10592532009-03-18 17:39:46 -07002534 Log.d(TAG, "missed alarms found: " + cursor.getCount());
2535 }
Ken Shirriff5b387e12009-10-23 09:50:41 -07002536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002537 try {
Michael Chancdaeafd2009-10-29 00:11:58 -07002538 long alarmTime = -1;
2539
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002540 while (cursor.moveToNext()) {
Michael Chancdaeafd2009-10-29 00:11:58 -07002541 long newAlarmTime = cursor.getLong(0);
2542 if (alarmTime != newAlarmTime) {
2543 if (DEBUG) {
2544 Log.w(TAG, "rescheduling missed alarm. alarmTime: " + newAlarmTime);
2545 }
2546 scheduleAlarm(context, manager, newAlarmTime);
2547 alarmTime = newAlarmTime;
2548 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002549 }
2550 } finally {
2551 cursor.close();
2552 }
Michael Chancdaeafd2009-10-29 00:11:58 -07002553 }
Ken Shirriff5b387e12009-10-23 09:50:41 -07002554
RoboErikc2d53302011-06-03 09:37:58 -07002555 /**
2556 * Schedules an alarm intent with the system AlarmManager that will
RoboErik3771fcb2011-06-16 15:41:31 -07002557 * notify listeners when a reminder should be fired. The provider will
2558 * keep scheduled reminders up to date but apps may use this to
2559 * implement snooze functionality without modifying the reminders table.
2560 * Scheduled alarms will generate an intent using
RoboErik083cd2d2011-06-30 11:53:05 -07002561 * {@link #ACTION_EVENT_REMINDER}. TODO Move to provider
RoboErikc2d53302011-06-03 09:37:58 -07002562 *
2563 * @param context A context for referencing system resources
2564 * @param manager The AlarmManager to use or null
2565 * @param alarmTime The time to fire the intent in UTC millis since
2566 * epoch
RoboErik083cd2d2011-06-30 11:53:05 -07002567 * @hide
RoboErikc2d53302011-06-03 09:37:58 -07002568 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002569 @UnsupportedAppUsage
Michael Chancdaeafd2009-10-29 00:11:58 -07002570 public static void scheduleAlarm(Context context, AlarmManager manager, long alarmTime) {
2571 if (DEBUG) {
2572 Time time = new Time();
2573 time.set(alarmTime);
2574 String schedTime = time.format(" %a, %b %d, %Y %I:%M%P");
2575 Log.d(TAG, "Schedule alarm at " + alarmTime + " " + schedTime);
2576 }
2577
2578 if (manager == null) {
2579 manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
2580 }
2581
RoboErike00d5892011-06-23 15:16:55 -07002582 Intent intent = new Intent(ACTION_EVENT_REMINDER);
RoboErikbec6c362011-06-14 11:06:01 -07002583 intent.setData(ContentUris.withAppendedId(CalendarContract.CONTENT_URI, alarmTime));
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08002584 intent.putExtra(ALARM_TIME, alarmTime);
Makoto Onukib63830a2017-02-09 17:06:28 -08002585 intent.setFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
Erik42f19572010-03-17 16:17:22 -07002586 PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0);
Tony Makfaf96ebc2015-07-02 17:05:35 +01002587 manager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, alarmTime, pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002588 }
Ken Shirriff5b387e12009-10-23 09:50:41 -07002589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002590 /**
RoboErik083cd2d2011-06-30 11:53:05 -07002591 * Searches for an entry in the CalendarAlerts table that matches the
2592 * given event id, begin time and alarm time. If one is found then this
2593 * alarm already exists and this method returns true. TODO Move to
2594 * provider
RoboErik58644022011-07-08 13:39:05 -07002595 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002596 * @param cr the ContentResolver
2597 * @param eventId the event id to match
2598 * @param begin the start time of the event in UTC millis
2599 * @param alarmTime the alarm time of the event in UTC millis
RoboErik083cd2d2011-06-30 11:53:05 -07002600 * @return true if there is already an alarm for the given event with
2601 * the same start time and alarm time.
2602 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 */
2604 public static final boolean alarmExists(ContentResolver cr, long eventId,
2605 long begin, long alarmTime) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002606 // TODO: construct an explicit SQL query so that we can add
2607 // "LIMIT 1" to the end and get just one result.
Fabrice Di Meglio1dfc8a22010-03-10 17:49:46 -08002608 String[] projection = new String[] { ALARM_TIME };
RoboErik083cd2d2011-06-30 11:53:05 -07002609 Cursor cursor = cr.query(CONTENT_URI, projection, WHERE_ALARM_EXISTS,
2610 (new String[] {
2611 Long.toString(eventId), Long.toString(begin), Long.toString(alarmTime)
2612 }), null);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 boolean found = false;
2614 try {
2615 if (cursor != null && cursor.getCount() > 0) {
2616 found = true;
2617 }
2618 } finally {
2619 if (cursor != null) {
2620 cursor.close();
2621 }
2622 }
2623 return found;
2624 }
2625 }
2626
RoboErikf8143c52011-09-28 15:16:00 -07002627 protected interface ColorsColumns extends SyncStateContract.Columns {
2628
2629 /**
2630 * The type of color, which describes how it should be used. Valid types
2631 * are {@link #TYPE_CALENDAR} and {@link #TYPE_EVENT}. Column name.
2632 * <P>
2633 * Type: INTEGER (NOT NULL)
2634 * </P>
2635 */
2636 public static final String COLOR_TYPE = "color_type";
2637
2638 /**
2639 * This indicateds a color that can be used for calendars.
2640 */
2641 public static final int TYPE_CALENDAR = 0;
2642 /**
2643 * This indicates a color that can be used for events.
2644 */
2645 public static final int TYPE_EVENT = 1;
2646
2647 /**
RoboErik4172d952011-10-25 13:59:13 -07002648 * The key used to reference this color. This can be any non-empty
RoboErikf8143c52011-09-28 15:16:00 -07002649 * string, but must be unique for a given {@link #ACCOUNT_TYPE} and
RoboErik8a8eebc2011-10-20 16:57:18 -07002650 * {@link #ACCOUNT_NAME}. Column name.
RoboErikf8143c52011-09-28 15:16:00 -07002651 * <P>
2652 * Type: TEXT
2653 * </P>
2654 */
RoboErik4172d952011-10-25 13:59:13 -07002655 public static final String COLOR_KEY = "color_index";
RoboErikf8143c52011-09-28 15:16:00 -07002656
2657 /**
RoboErik05b36e52011-10-14 15:31:15 -07002658 * The color as an 8-bit ARGB integer value. Colors should specify alpha
2659 * as fully opaque (eg 0xFF993322) as the alpha may be ignored or
2660 * modified for display. It is reccomended that colors be usable with
2661 * light (near white) text. Apps should not depend on that assumption,
2662 * however. Column name.
RoboErikf8143c52011-09-28 15:16:00 -07002663 * <P>
2664 * Type: INTEGER (NOT NULL)
2665 * </P>
2666 */
RoboErik05b36e52011-10-14 15:31:15 -07002667 public static final String COLOR = "color";
RoboErikf8143c52011-09-28 15:16:00 -07002668
2669 }
2670
2671 /**
2672 * Fields for accessing colors available for a given account. Colors are
RoboErik4172d952011-10-25 13:59:13 -07002673 * referenced by {@link #COLOR_KEY} which must be unique for a given
RoboErik0c559c62011-10-21 11:20:51 -07002674 * account name/type. These values can only be updated by the sync
RoboErik8a8eebc2011-10-20 16:57:18 -07002675 * adapter. Only {@link #COLOR} may be updated after the initial insert. In
2676 * addition, a row can only be deleted once all references to that color
2677 * have been removed from the {@link Calendars} or {@link Events} tables.
RoboErikf8143c52011-09-28 15:16:00 -07002678 */
2679 public static final class Colors implements ColorsColumns {
2680 /**
2681 * @hide
2682 */
2683 public static final String TABLE_NAME = "Colors";
2684 /**
2685 * The Uri for querying color information
2686 */
2687 @SuppressWarnings("hiding")
2688 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/colors");
2689
2690 /**
2691 * This utility class cannot be instantiated
2692 */
2693 private Colors() {
2694 }
2695 }
2696
RoboErikb2c75602011-06-13 12:53:48 -07002697 protected interface ExtendedPropertiesColumns {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002698 /**
RoboErikc2d53302011-06-03 09:37:58 -07002699 * The event the extended property belongs to. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002700 * <P>Type: INTEGER (foreign key to the Events table)</P>
2701 */
2702 public static final String EVENT_ID = "event_id";
2703
2704 /**
2705 * The name of the extended property. This is a uri of the form
RoboErikc2d53302011-06-03 09:37:58 -07002706 * {scheme}#{local-name} convention. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002707 * <P>Type: TEXT</P>
2708 */
2709 public static final String NAME = "name";
2710
2711 /**
RoboErikc2d53302011-06-03 09:37:58 -07002712 * The value of the extended property. Column name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002713 * <P>Type: TEXT</P>
2714 */
2715 public static final String VALUE = "value";
2716 }
2717
RoboErikc2d53302011-06-03 09:37:58 -07002718 /**
2719 * Fields for accessing the Extended Properties. This is a generic set of
Michael Chan73bddfc2011-10-19 18:21:49 -07002720 * name/value pairs for use by sync adapters to add extra
RoboErik3771fcb2011-06-16 15:41:31 -07002721 * information to events. There are three writable columns and all three
2722 * must be present when inserting a new value. They are:
2723 * <ul>
2724 * <li>{@link #EVENT_ID}</li>
2725 * <li>{@link #NAME}</li>
2726 * <li>{@link #VALUE}</li>
2727 * </ul>
RoboErikc2d53302011-06-03 09:37:58 -07002728 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 public static final class ExtendedProperties implements BaseColumns,
2730 ExtendedPropertiesColumns, EventsColumns {
2731 public static final Uri CONTENT_URI =
Ken Shirriffa69a23b2010-01-21 17:32:39 -08002732 Uri.parse("content://" + AUTHORITY + "/extendedproperties");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002733
RoboErik36726962011-06-14 14:01:15 -07002734 /**
2735 * This utility class cannot be instantiated
2736 */
2737 private ExtendedProperties() {}
2738
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002739 // TODO: fill out this class when we actually start utilizing extendedproperties
2740 // in the calendar application.
2741 }
Ken Shirriffead4f9c2010-01-22 12:26:02 -08002742
2743 /**
2744 * A table provided for sync adapters to use for storing private sync state data.
2745 *
2746 * @see SyncStateContract
2747 */
2748 public static final class SyncState implements SyncStateContract.Columns {
2749 /**
2750 * This utility class cannot be instantiated
2751 */
2752 private SyncState() {}
2753
RoboErikc2d53302011-06-03 09:37:58 -07002754 private static final String CONTENT_DIRECTORY =
Ken Shirriffead4f9c2010-01-22 12:26:02 -08002755 SyncStateContract.Constants.CONTENT_DIRECTORY;
2756
2757 /**
2758 * The content:// style URI for this table
2759 */
2760 public static final Uri CONTENT_URI =
RoboErikbec6c362011-06-14 11:06:01 -07002761 Uri.withAppendedPath(CalendarContract.CONTENT_URI, CONTENT_DIRECTORY);
Ken Shirriffead4f9c2010-01-22 12:26:02 -08002762 }
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002763
2764 /**
2765 * Columns from the EventsRawTimes table
RoboErik3771fcb2011-06-16 15:41:31 -07002766 *
2767 * @hide
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002768 */
RoboErikb2c75602011-06-13 12:53:48 -07002769 protected interface EventsRawTimesColumns {
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002770 /**
RoboErikc2d53302011-06-03 09:37:58 -07002771 * The corresponding event id. Column name.
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002772 * <P>Type: INTEGER (long)</P>
2773 */
2774 public static final String EVENT_ID = "event_id";
2775
2776 /**
RoboErikc2d53302011-06-03 09:37:58 -07002777 * The RFC2445 compliant time the event starts. Column name.
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002778 * <P>Type: TEXT</P>
2779 */
2780 public static final String DTSTART_2445 = "dtstart2445";
2781
2782 /**
RoboErikc2d53302011-06-03 09:37:58 -07002783 * The RFC2445 compliant time the event ends. Column name.
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002784 * <P>Type: TEXT</P>
2785 */
2786 public static final String DTEND_2445 = "dtend2445";
2787
2788 /**
RoboErikc2d53302011-06-03 09:37:58 -07002789 * The RFC2445 compliant original instance time of the recurring event
2790 * for which this event is an exception. Column name.
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002791 * <P>Type: TEXT</P>
2792 */
2793 public static final String ORIGINAL_INSTANCE_TIME_2445 = "originalInstanceTime2445";
2794
2795 /**
RoboErikc2d53302011-06-03 09:37:58 -07002796 * The RFC2445 compliant last date this event repeats on, or NULL if it
2797 * never ends. Column name.
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002798 * <P>Type: TEXT</P>
2799 */
2800 public static final String LAST_DATE_2445 = "lastDate2445";
2801 }
2802
RoboErikc2d53302011-06-03 09:37:58 -07002803 /**
2804 * @hide
2805 */
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002806 public static final class EventsRawTimes implements BaseColumns, EventsRawTimesColumns {
RoboErik36726962011-06-14 14:01:15 -07002807
2808 /**
2809 * This utility class cannot be instantiated
2810 */
2811 private EventsRawTimes() {}
Fabrice Di Meglio50563552010-06-15 16:35:20 -07002812 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813}