Add cross profile uri for Events and Calendars table in CalendarContract.
Bug: 118455064 Test: runtest -x packages/providers/CalendarProvider/tests/src/com/android/providers/calendar/CalendarProvider2Test. Change-Id: Ic1f4dda7633ed8739e100c54c6413acf236c6808
This commit is contained in:
@@ -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;
|
||||
@@ -693,6 +694,37 @@ public final class CalendarContract {
|
||||
@SuppressWarnings("hiding")
|
||||
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
|
||||
*/
|
||||
@@ -1640,6 +1672,50 @@ public final class CalendarContract {
|
||||
public static final Uri CONTENT_URI =
|
||||
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
|
||||
@@ -1819,6 +1895,63 @@ public final class CalendarContract {
|
||||
public static final Uri CONTENT_SEARCH_BY_DAY_URI =
|
||||
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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user