Skip to content

Commit f8143c5

Browse files
committed
Add hidden API to prepare for increasing calendar support
This adds hidden APIs for supporting settng allowed availabilities and attendee types, adding the tentative availability and resource attendee type, color indexes for calendars and events, and a colors table. b/5317399 b/5309787 b/5207781 b/5347210 Change-Id: I8dec4d0ebb0523b34bd420a0ab62bf5d0650996f
1 parent 79425fd commit f8143c5

File tree

1 file changed

+166
-4
lines changed

1 file changed

+166
-4
lines changed

core/java/android/provider/CalendarContract.java

Lines changed: 166 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,26 @@ protected interface CalendarColumns {
299299
*/
300300
public static final String CALENDAR_COLOR = "calendar_color";
301301

302+
/**
303+
* An index for looking up a color from the {@link Colors} table. NULL
304+
* or an empty string are reserved for indicating that the calendar does
305+
* not use an index for looking up the color. The provider will update
306+
* {@link #CALENDAR_COLOR} automatically when a valid index is written
307+
* to this column. @see Colors
308+
* <P>
309+
* Type: TEXT
310+
* </P>
311+
* TODO UNHIDE
312+
*
313+
* @hide
314+
*/
315+
public static final String CALENDAR_COLOR_INDEX = "calendar_color_index";
316+
302317
/**
303318
* The display name of the calendar. Column name.
304-
* <P>Type: TEXT</P>
319+
* <P>
320+
* Type: TEXT
321+
* </P>
305322
*/
306323
public static final String CALENDAR_DISPLAY_NAME = "calendar_displayName";
307324

@@ -392,6 +409,34 @@ protected interface CalendarColumns {
392409
* <P>Type: TEXT</P>
393410
*/
394411
public static final String ALLOWED_REMINDERS = "allowedReminders";
412+
413+
/**
414+
* A comma separated list of availability types supported for this
415+
* calendar in the format "#,#,#". Valid types are
416+
* {@link Events#AVAILABILITY_BUSY}, {@link Events#AVAILABILITY_FREE},
417+
* {@link Events#AVAILABILITY_TENTATIVE}. Setting this field to only
418+
* {@link Events#AVAILABILITY_BUSY} should be used to indicate that
419+
* changing the availability is not supported.
420+
*
421+
* TODO UNHIDE, Update Calendars doc
422+
*
423+
* @hide
424+
*/
425+
public static final String ALLOWED_AVAILABILITY = "allowedAvailability";
426+
427+
/**
428+
* A comma separated list of attendee types supported for this calendar
429+
* in the format "#,#,#". Valid types are {@link Attendees#TYPE_NONE},
430+
* {@link Attendees#TYPE_OPTIONAL}, {@link Attendees#TYPE_REQUIRED},
431+
* {@link Attendees#TYPE_RESOURCE}. Setting this field to only
432+
* {@link Attendees#TYPE_NONE} should be used to indicate that changing
433+
* the attendee type is not supported.
434+
*
435+
* TODO UNHIDE, Update Calendars doc
436+
*
437+
* @hide
438+
*/
439+
public static final String ALLOWED_ATTENDEE_TYPES = "allowedAttendeeTypes";
395440
}
396441

397442
/**
@@ -688,13 +733,23 @@ protected interface AttendeesColumns {
688733

689734
/**
690735
* The type of attendee. Column name.
691-
* <P>Type: Integer (one of {@link #TYPE_REQUIRED}, {@link #TYPE_OPTIONAL})</P>
736+
* <P>
737+
* Type: Integer (one of {@link #TYPE_REQUIRED}, {@link #TYPE_OPTIONAL},
738+
* {@link #TYPE_RESOURCE})
739+
* </P>
692740
*/
693741
public static final String ATTENDEE_TYPE = "attendeeType";
694742

695743
public static final int TYPE_NONE = 0;
696744
public static final int TYPE_REQUIRED = 1;
697745
public static final int TYPE_OPTIONAL = 2;
746+
/**
747+
* This specifies that an attendee is a resource, such as a room, and
748+
* not an actual person. TODO UNHIDE
749+
*
750+
* @hide
751+
*/
752+
public static final int TYPE_RESOURCE = 3;
698753

699754
/**
700755
* The attendance status of the attendee. Column name.
@@ -787,12 +842,25 @@ protected interface EventsColumns {
787842
public static final String EVENT_LOCATION = "eventLocation";
788843

789844
/**
790-
* A secondary color for the individual event. Reserved for future use.
791-
* Column name.
845+
* A secondary color for the individual event. This should only be
846+
* updated by the sync adapter for a given account.
792847
* <P>Type: INTEGER</P>
793848
*/
794849
public static final String EVENT_COLOR = "eventColor";
795850

851+
/**
852+
* A secondary color index for the individual event. NULL or an empty
853+
* string are reserved for indicating that the event does not use an
854+
* index for looking up the color. The provider will update
855+
* {@link #EVENT_COLOR} automatically when a valid index is written to
856+
* this column. @see Colors
857+
* <P>Type: TEXT</P>
858+
* TODO UNHIDE
859+
*
860+
* @hide
861+
*/
862+
public static final String EVENT_COLOR_INDEX = "eventColor_index";
863+
796864
/**
797865
* The event status. Column name.
798866
* <P>Type: INTEGER (one of {@link #STATUS_TENTATIVE}...)</P>
@@ -964,6 +1032,15 @@ protected interface EventsColumns {
9641032
* other events.
9651033
*/
9661034
public static final int AVAILABILITY_FREE = 1;
1035+
/**
1036+
* Indicates that the owner's availability may change, but should be
1037+
* considered busy time that will conflict.
1038+
*
1039+
* TODO UNHIDE
1040+
*
1041+
* @hide
1042+
*/
1043+
public static final int AVAILABILITY_TENTATIVE = 2;
9671044

9681045
/**
9691046
* Whether the event has an alarm or not. Column name.
@@ -2224,6 +2301,91 @@ public static final boolean alarmExists(ContentResolver cr, long eventId,
22242301
}
22252302
}
22262303

2304+
/**
2305+
* @hide
2306+
* TODO UNHIDE
2307+
*/
2308+
protected interface ColorsColumns extends SyncStateContract.Columns {
2309+
2310+
/**
2311+
* The type of color, which describes how it should be used. Valid types
2312+
* are {@link #TYPE_CALENDAR} and {@link #TYPE_EVENT}. Column name.
2313+
* <P>
2314+
* Type: INTEGER (NOT NULL)
2315+
* </P>
2316+
*/
2317+
public static final String COLOR_TYPE = "color_type";
2318+
2319+
/**
2320+
* This indicateds a color that can be used for calendars.
2321+
*/
2322+
public static final int TYPE_CALENDAR = 0;
2323+
/**
2324+
* This indicates a color that can be used for events.
2325+
*/
2326+
public static final int TYPE_EVENT = 1;
2327+
2328+
/**
2329+
* The index used to reference this color. This can be any non-empty
2330+
* string, but must be unique for a given {@link #ACCOUNT_TYPE} and
2331+
* {@link #ACCOUNT_NAME} . Column name.
2332+
* <P>
2333+
* Type: TEXT
2334+
* </P>
2335+
*/
2336+
public static final String COLOR_INDEX = "color_index";
2337+
2338+
/**
2339+
* The version of this color that will work with dark text as an 8-bit
2340+
* ARGB integer value. Colors should specify alpha as fully opaque (eg
2341+
* 0xFF993322) as the alpha may be ignored or modified for display.
2342+
* Column name.
2343+
* <P>
2344+
* Type: INTEGER (NOT NULL)
2345+
* </P>
2346+
*/
2347+
public static final String COLOR_LIGHT = "color_light";
2348+
2349+
/**
2350+
* The version of this color that will work with light text as an 8-bit
2351+
* ARGB integer value. Colors should specify alpha as fully opaque (eg
2352+
* 0xFF993322) as the alpha may be ignored or modified for display.
2353+
* Column name.
2354+
* <P>
2355+
* Type: INTEGER (NOT NULL)
2356+
* </P>
2357+
*/
2358+
public static final String COLOR_DARK = "color_dark";
2359+
2360+
}
2361+
2362+
/**
2363+
* Fields for accessing colors available for a given account. Colors are
2364+
* referenced by {@link #COLOR_INDEX} which must be unique for a given
2365+
* account name/type. These values should only be updated by the sync
2366+
* adapter.
2367+
* TODO UNHIDE
2368+
*
2369+
* @hide
2370+
*/
2371+
public static final class Colors implements ColorsColumns {
2372+
/**
2373+
* @hide
2374+
*/
2375+
public static final String TABLE_NAME = "Colors";
2376+
/**
2377+
* The Uri for querying color information
2378+
*/
2379+
@SuppressWarnings("hiding")
2380+
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/colors");
2381+
2382+
/**
2383+
* This utility class cannot be instantiated
2384+
*/
2385+
private Colors() {
2386+
}
2387+
}
2388+
22272389
protected interface ExtendedPropertiesColumns {
22282390
/**
22292391
* The event the extended property belongs to. Column name.

0 commit comments

Comments
 (0)