summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt6
-rw-r--r--core/java/android/provider/CalendarContract.java135
2 files changed, 140 insertions, 1 deletions
diff --git a/api/current.txt b/api/current.txt
index f6f54769dc00..037aae086cd1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -36000,6 +36000,7 @@ package android.provider {
field public static final java.lang.String CALENDAR_LOCATION = "calendar_location";
field public static final android.net.Uri CONTENT_URI;
field public static final java.lang.String DEFAULT_SORT_ORDER = "calendar_displayName";
+ field public static final android.net.Uri ENTERPRISE_CONTENT_URI;
field public static final java.lang.String NAME = "name";
}
@@ -36028,6 +36029,7 @@ package android.provider {
public static final class CalendarContract.Events implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns {
field public static final android.net.Uri CONTENT_EXCEPTION_URI;
field public static final android.net.Uri CONTENT_URI;
+ field public static final android.net.Uri ENTERPRISE_CONTENT_URI;
}
protected static abstract interface CalendarContract.EventsColumns {
@@ -36119,6 +36121,10 @@ package android.provider {
field public static final java.lang.String END = "end";
field public static final java.lang.String END_DAY = "endDay";
field public static final java.lang.String END_MINUTE = "endMinute";
+ field public static final android.net.Uri ENTERPRISE_CONTENT_BY_DAY_URI;
+ field public static final android.net.Uri ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI;
+ field public static final android.net.Uri ENTERPRISE_CONTENT_SEARCH_URI;
+ field public static final android.net.Uri ENTERPRISE_CONTENT_URI;
field public static final java.lang.String EVENT_ID = "event_id";
field public static final java.lang.String START_DAY = "startDay";
field public static final java.lang.String START_MINUTE = "startMinute";
diff --git a/core/java/android/provider/CalendarContract.java b/core/java/android/provider/CalendarContract.java
index a8f3665072ae..92fe028bd5a3 100644
--- a/core/java/android/provider/CalendarContract.java
+++ b/core/java/android/provider/CalendarContract.java
@@ -16,13 +16,14 @@
package android.provider;
-
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.UnsupportedAppUsage;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
+import android.app.admin.DevicePolicyManager;
+import android.content.ComponentName;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentUris;
@@ -694,6 +695,37 @@ public final class CalendarContract {
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/calendars");
/**
+ * The content:// style URL for querying Calendars table in the work profile. Appending a
+ * calendar id using {@link ContentUris#withAppendedId(Uri, long)} will
+ * specify a single calendar.
+ *
+ * <p>The following columns are allowed to be queried via this uri:
+ * <ul>
+ * <li>{@link #_ID}</li>
+ * <li>{@link #NAME}</li>
+ * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
+ * <li>{@link #CALENDAR_COLOR}</li>
+ * <li>{@link #VISIBLE}</li>
+ * <li>{@link #CALENDAR_LOCATION}</li>
+ * <li>{@link #CALENDAR_TIME_ZONE}</li>
+ * <li>{@link #IS_PRIMARY}</li>
+ * </ul>
+ *
+ * <p>{@link IllegalArgumentException} will be thrown if there exist columns in the
+ * projection of the query to this uri that are not contained in the above list.
+ *
+ * <p>This uri will return an empty cursor if the calling user is not a parent profile
+ * of a work profile, or cross profile calendar is disabled in Settings, or this uri is
+ * queried from a package that is not whitelisted by profile owner of the work profile via
+ * {@link DevicePolicyManager.addCrossProfileCalendarPackage(ComponentName, String)}.
+ *
+ * @see DevicePolicyManager#getCrossProfileCalendarPackages(ComponentName)
+ * @see Settings.Secure#CROSS_PROFILE_CALENDAR_ENABLED
+ */
+ public static final Uri ENTERPRISE_CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/enterprise/calendars");
+
+ /**
* The default sort order for this table
*/
public static final String DEFAULT_SORT_ORDER = CALENDAR_DISPLAY_NAME;
@@ -1641,6 +1673,50 @@ public final class CalendarContract {
Uri.parse("content://" + AUTHORITY + "/events");
/**
+ * The content:// style URL for querying Events table in the work profile. Appending an
+ * event id using {@link ContentUris#withAppendedId(Uri, long)} will
+ * specify a single event.
+ *
+ * <p>The following columns are allowed to be queried via this uri:
+ * <ul>
+ * <li>{@link #_ID}</li>
+ * <li>{@link #CALENDAR_ID}</li>
+ * <li>{@link #TITLE}</li>
+ * <li>{@link #EVENT_LOCATION}</li>
+ * <li>{@link #EVENT_COLOR}</li>
+ * <li>{@link #STATUS}</li>
+ * <li>{@link #DTSTART}</li>
+ * <li>{@link #DTEND}</li>
+ * <li>{@link #EVENT_TIMEZONE}</li>
+ * <li>{@link #EVENT_END_TIMEZONE}</li>
+ * <li>{@link #DURATION}</li>
+ * <li>{@link #ALL_DAY}</li>
+ * <li>{@link #AVAILABILITY}</li>
+ * <li>{@link #RRULE}</li>
+ * <li>{@link #RDATE}</li>
+ * <li>{@link #EXRULE}</li>
+ * <li>{@link #EXDATE}</li>
+ * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
+ * <li>{@link #CALENDAR_COLOR}</li>
+ * <li>{@link #VISIBLE}</li>
+ * <li>{@link #CALENDAR_TIME_ZONE}</li>
+ * </ul>
+ *
+ * <p>{@link IllegalArgumentException} will be thrown if there exist columns in the
+ * projection of the query to this uri that are not contained in the above list.
+ *
+ * <p>This uri will return an empty cursor if the calling user is not a parent profile
+ * of a work profile, or cross profile calendar is disabled in Settings, or this uri is
+ * queried from a package that is not whitelisted by profile owner of the work profile via
+ * {@link DevicePolicyManager.addCrossProfileCalendarPackage(ComponentName, String)}.
+ *
+ * @see DevicePolicyManager#getCrossProfileCalendarPackages(ComponentName)
+ * @see Settings.Secure#CROSS_PROFILE_CALENDAR_ENABLED
+ */
+ public static final Uri ENTERPRISE_CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/enterprise/events");
+
+ /**
* The content:// style URI for recurring event exceptions. Insertions require an
* appended event ID. Deletion of exceptions requires both the original event ID and
* the exception event ID (see {@link Uri.Builder#appendPath}).
@@ -1820,6 +1896,63 @@ public final class CalendarContract {
Uri.parse("content://" + AUTHORITY + "/instances/searchbyday");
/**
+ * The content:// style URL for querying an instance range in the work profile.
+ * It supports similar semantics as {@link #CONTENT_URI}.
+ *
+ * <p>The following columns plus the columns that are whitelisted by
+ * {@link Events#ENTERPRISE_CONTENT_URI} are allowed to be queried via this uri:
+ * <ul>
+ * <li>{@link #_ID}</li>
+ * <li>{@link #EVENT_ID}</li>
+ * <li>{@link #BEGIN}</li>
+ * <li>{@link #END}</li>
+ * <li>{@link #START_DAY}</li>
+ * <li>{@link #END_DAY}</li>
+ * <li>{@link #START_MINUTE}</li>
+ * <li>{@link #END_MINUTE}</li>
+ * </ul>
+ *
+ * <p>{@link IllegalArgumentException} will be thrown if there exist columns in the
+ * projection of the query to this uri that are not contained in the above list.
+ *
+ * <p>This uri will return an empty cursor if the calling user is not a parent profile
+ * of a work profile, or cross profile calendar for the work profile is disabled in
+ * Settings, or this uri is queried from a package that is not whitelisted by
+ * profile owner of the work profile via
+ * {@link DevicePolicyManager.addCrossProfileCalendarPackage(ComponentName, String)}.
+ *
+ * @see DevicePolicyManager#getCrossProfileCalendarPackages(ComponentName)
+ * @see Settings.Secure#CROSS_PROFILE_CALENDAR_ENABLED
+ */
+ public static final Uri ENTERPRISE_CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/enterprise/instances/when");
+
+ /**
+ * The content:// style URL for querying an instance range by Julian
+ * Day in the work profile. It supports similar semantics as {@link #CONTENT_BY_DAY_URI}
+ * and performs similar checks as {@link #ENTERPRISE_CONTENT_URI}.
+ */
+ public static final Uri ENTERPRISE_CONTENT_BY_DAY_URI =
+ Uri.parse("content://" + AUTHORITY + "/enterprise/instances/whenbyday");
+
+ /**
+ * The content:// style URL for querying an instance range with a search
+ * term in the work profile. It supports similar semantics as {@link #CONTENT_SEARCH_URI}
+ * and performs similar checks as {@link #ENTERPRISE_CONTENT_URI}.
+ */
+ public static final Uri ENTERPRISE_CONTENT_SEARCH_URI =
+ Uri.parse("content://" + AUTHORITY + "/enterprise/instances/search");
+
+ /**
+ * The content:// style URL for querying an instance range with a search
+ * term in the work profile. It supports similar semantics as
+ * {@link #CONTENT_SEARCH_BY_DAY_URI} and performs similar checks as
+ * {@link #ENTERPRISE_CONTENT_URI}.
+ */
+ public static final Uri ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI =
+ Uri.parse("content://" + AUTHORITY + "/enterprise/instances/searchbyday");
+
+ /**
* The default sort order for this table.
*/
private static final String DEFAULT_SORT_ORDER = "begin ASC";