diff --git a/core/api/current.txt b/core/api/current.txt index da2b4e9490874..39ac0d2ebad2c 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -35148,6 +35148,7 @@ package android.provider { field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2"; field public static final android.net.Uri CONTENT_URI; field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; + field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_URI; field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -35328,6 +35329,7 @@ package android.provider { field public static final String CONTENT_VCARD_TYPE = "text/x-vcard"; field public static final android.net.Uri CONTENT_VCARD_URI; field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; + field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_URI; field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 92722901e485d..fb742607d9d25 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -10703,10 +10703,6 @@ package android.provider { field public static final int ERROR_UNKNOWN = 0; // 0x0 } - public static final class ContactsContract.CommonDataKinds.Phone implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { - field @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public static final android.net.Uri ENTERPRISE_CONTENT_URI; - } - @Deprecated public static final class ContactsContract.MetadataSync implements android.provider.BaseColumns android.provider.ContactsContract.MetadataSyncColumns { field @Deprecated public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_metadata"; field @Deprecated public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact_metadata"; diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 5e02e72f20885..c36aa61924601 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -2203,10 +2203,6 @@ package android.provider { field public static final String HIDDEN_COLUMN_PREFIX = "x_"; } - public static final class ContactsContract.CommonDataKinds.Phone implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins { - field @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public static final android.net.Uri ENTERPRISE_CONTENT_URI; - } - public static final class ContactsContract.PinnedPositions { field public static final String UNDEMOTE_METHOD = "undemote"; } diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index d50ba8de8fa6b..363d035ea774b 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -435,25 +435,27 @@ public final class ContactsContract { Uri.withAppendedPath(AUTHORITY_URI, "directories"); /** - * URI used for getting all directories from primary and managed profile. - * It supports the same semantics as {@link #CONTENT_URI} and returns the same columns. - * If the device has no managed profile that is linked to the current profile, it behaves - * in the exact same way as {@link #CONTENT_URI}. - * If there is a managed profile linked to the current profile, it will merge - * managed profile and current profile's results and return. - * - * Note: this query returns primary profile results before managed profile results, - * and this order is not affected by sorting parameter. + * URI used for getting all directories from both the calling user and the managed profile + * that is linked to it. + *
+ * It supports the same semantics as {@link #CONTENT_URI} and returns the same columns.
+ * If the device has no managed profile that is linked to the calling user, it behaves
+ * in the exact same way as {@link #CONTENT_URI}.
+ * If there is a managed profile linked to the calling user, it will return merged results
+ * from both.
+ *
+ * Note: this query returns the calling user results before the managed profile results, + * and this order is not affected by the sorting parameter. * */ public static final Uri ENTERPRISE_CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "directories_enterprise"); /** - * Access file provided by remote directory. It allows both personal and work remote - * directory, but not local and invisible diretory. - * - * It's supported only by a few specific places for referring to contact pictures in the + * Access file provided by remote directory. It allows both calling user and managed profile + * remote directory, but not local and invisible directory. + *
+ * It is supported only by a few specific places for referring to contact pictures in the * remote directory. Contact picture URIs, e.g. * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI}, may contain this kind of URI. * @@ -490,13 +492,13 @@ public final class ContactsContract { public static final long LOCAL_INVISIBLE = 1; /** - * _ID of the work profile default directory, which represents locally stored contacts. + * _ID of the managed profile default directory, which represents locally stored contacts. */ public static final long ENTERPRISE_DEFAULT = Directory.ENTERPRISE_DIRECTORY_ID_BASE + DEFAULT; /** - * _ID of the work profile directory that represents locally stored invisible contacts. + * _ID of the managed profile directory that represents locally stored invisible contacts. */ public static final long ENTERPRISE_LOCAL_INVISIBLE = Directory.ENTERPRISE_DIRECTORY_ID_BASE + LOCAL_INVISIBLE; @@ -557,8 +559,8 @@ public final class ContactsContract { public static final String ACCOUNT_NAME = "accountName"; /** - * Mimimal ID for corp directory returned from - * {@link Directory#CORP_CONTENT_URI}. + * Mimimal ID for managed profile directory returned from + * {@link Directory#ENTERPRISE_CONTENT_URI}. * * @hide */ @@ -1537,12 +1539,42 @@ public final class ContactsContract { public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts"); /** - * Special contacts URI to refer to contacts on the corp profile from the personal - * profile. - * + * URI used for getting all contacts from both the calling user and the managed profile + * that is linked to it. + *
+ * It supports the same semantics as {@link #CONTENT_URI} and returns the same columns.
+ * If the calling user has no managed profile, it behaves in the exact same way as
+ * {@link #CONTENT_URI}.
+ * If there is a managed profile linked to the calling user, it will return merged results
+ * from both.
+ *
+ * Note: this query returns the calling user results before the managed profile results, + * and this order is not affected by the sorting parameter. + *
+ * If a result is from the managed profile, the following changes are made to the data: + *
* It's supported only by a few specific places for referring to contact pictures that - * are in the corp provider for enterprise caller-ID. Contact picture URIs returned from - * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI} may contain this kind of URI. + * are in the managed profile provider for enterprise caller-ID. Contact picture URIs + * returned from {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI} and similar APIs may + * contain this kind of URI. * * @hide */ @@ -1736,7 +1768,8 @@ public final class ContactsContract { /** * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the same * columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in parameters, - * otherwise it will throw IllegalArgumentException. + * otherwise it will throw IllegalArgumentException. The passed directory can belong either + * to the calling user or to a managed profile that is linked to it. */ public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath( CONTENT_URI, "filter_enterprise"); @@ -1807,25 +1840,25 @@ public final class ContactsContract { public static final String CONTENT_VCARD_TYPE = "text/x-vcard"; /** - * Mimimal ID for corp contacts returned from - * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI}. + * Mimimal ID for managed profile contacts returned from + * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI} and similar APIs * * @hide */ public static long ENTERPRISE_CONTACT_ID_BASE = 1000000000; // slightly smaller than 2 ** 30 /** - * Prefix for corp contacts returned from - * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI}. + * Prefix for managed profile contacts returned from + * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI} and similar APIs. * * @hide */ public static String ENTERPRISE_CONTACT_LOOKUP_PREFIX = "c-"; /** - * Return TRUE if a contact ID is from the contacts provider on the enterprise profile. + * Return {@code true} if a contact ID is from the contacts provider on the managed profile. * - * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI} may return such a contact. + * {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI} and similar APIs may return such IDs. */ public static boolean isEnterpriseContactId(long contactId) { return (contactId >= ENTERPRISE_CONTACT_ID_BASE) && (contactId < Profile.MIN_ID); @@ -5167,7 +5200,7 @@ public final class ContactsContract { Uri.withAppendedPath(AUTHORITY_URI, "raw_contact_entities"); /** - * The content:// style URI for this table in corp profile + * The content:// style URI for this table in the managed profile * * @hide */ @@ -5209,13 +5242,13 @@ public final class ContactsContract { public static final String DATA_ID = "data_id"; /** - * Query raw contacts entity by a contact ID, which can potentially be a corp profile - * contact ID + * Query raw contacts entity by a contact ID, which can potentially be a managed profile + * contact ID. + *
+ * @param contentResolver The content resolver to query + * @param contactId Contact ID, which can potentially be a managed profile contact ID. + * @return A map from a mimetype to a list of the entity content values. * - * @param context A context to get the ContentResolver from - * @param contactId Contact ID, which can potentialy be a corp profile contact ID. - * - * @return A map from a mimetype to a List of the entity content values. * {@hide} */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @@ -5452,55 +5485,44 @@ public final class ContactsContract { "phone_lookup"); /** - *
URI used for the "enterprise caller-id".
- * - *Caution: If you publish your app to the Google Play Store, this - * field doesn't sort results based on contacts frequency. For more information, see the - * Contacts Provider - * page. - * + * URI used for looking up contacts by phone number on the contact databases of both the + * calling user and the managed profile that is linked to it. *
* It supports the same semantics as {@link #CONTENT_FILTER_URI} and returns the same - * columns. If the device has no corp profile that is linked to the current profile, it - * behaves in the exact same way as {@link #CONTENT_FILTER_URI}. If there is a corp profile - * linked to the current profile, it first queries against the personal contact database, - * and if no matching contacts are found there, then queries against the - * corp contacts database. - *
+ * columns.+ * Caution: If you publish your app to the Google Play Store, this field doesn't sort + * results based on contacts frequency. For more information, see the + * Contacts Provider + * page. *
- * If a result is from the corp profile, it makes the following changes to the data: + * If a result is from the managed profile, the following changes are made to the data: *
* A contact lookup URL built by * {@link ContactsContract.Contacts#getLookupUri(long, String)} - * with an {@link #_ID} and a {@link #LOOKUP_KEY} returned by this API can be passed to - * {@link ContactsContract.QuickContact#showQuickContact} even if a contact is from the - * corp profile. - *
- * + * with a {@link #CONTACT_ID} and a {@link #LOOKUP_KEY} returned by this API can be passed + * to {@link ContactsContract.QuickContact#showQuickContact} even if a contact is from the + * managed profile. *
* Uri lookupUri = Uri.withAppendedPath(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI,
* Uri.encode(phoneNumber));
- *
*/
public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
"phone_lookup_enterprise");
@@ -6236,19 +6258,32 @@ public final class ContactsContract {
"phones");
/**
- * URI used for getting all contacts from primary and managed profile.
- *
- * It supports the same semantics as {@link #CONTENT_URI} and returns the same
- * columns. If the device has no corp profile that is linked to the current profile, it
- * behaves in the exact same way as {@link #CONTENT_URI}. If there is a corp profile
- * linked to the current profile, it will merge corp profile and current profile's
- * results and return
- *
- * @hide
- */
- @SystemApi
- @TestApi
- @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS)
+ * URI used for getting all data records of the {@link #CONTENT_ITEM_TYPE} MIME type,
+ * combined with the associated raw contact and aggregate contact data, from both the
+ * calling user and the managed profile that is linked to it.
+ *
+ * It supports the same semantics as {@link #CONTENT_URI} and returns the same
+ * columns.
+ * If the device has no managed profile that is linked to the calling user, it behaves
+ * in the exact same way as {@link #CONTENT_URI}.
+ * If there is a managed profile linked to the calling user, it will return merged
+ * results from both.
+ *
+ * If a result is from the managed profile, the following changes are made to the data: + *
URI used for enterprise email lookup.
- * - *- * It supports the same semantics as {@link #CONTENT_LOOKUP_URI} and returns the same - * columns. If the device has no corp profile that is linked to the current profile, it - * behaves in the exact same way as {@link #CONTENT_LOOKUP_URI}. If there is a - * corp profile linked to the current profile, it first queries against the personal contact database, - * and if no matching contacts are found there, then queries against the - * corp contacts database. - *
- *- * If a result is from the corp profile, it makes the following changes to the data: - *
+ * It supports the same semantics as {@link #CONTENT_LOOKUP_URI} and returns the same
+ * columns.
+ * If the device has no managed profile that is linked to the calling user, it behaves
+ * in the exact same way as {@link #CONTENT_LOOKUP_URI}.
+ * If there is a managed profile linked to the calling user, it first queries the
+ * calling user's contact database, and only if no matching contacts are found there it
+ * then queries the managed profile database.
+ *
+ * If a result is from the managed profile, the following changes are made to the data: + *
* A contact lookup URL built by * {@link ContactsContract.Contacts#getLookupUri(long, String)} - * with an {@link #_ID} and a {@link #LOOKUP_KEY} returned by this API can be passed to - * {@link ContactsContract.QuickContact#showQuickContact} even if a contact is from the - * corp profile. - *
- * - *- * Uri lookupUri = Uri.withAppendedPath(Email.ENTERPRISE_CONTENT_LOOKUP_URI, - * Uri.encode(email)); - *- */ + * with a {@link #CONTACT_ID} and a {@link #LOOKUP_KEY} returned by this API can be + * passed to {@link ContactsContract.QuickContact#showQuickContact} even if a contact is + * from the managed profile. + *
+ * Uri lookupUri = Uri.withAppendedPath(Email.ENTERPRISE_CONTENT_LOOKUP_URI,
+ * Uri.encode(email));
+ */
public static final Uri ENTERPRISE_CONTENT_LOOKUP_URI =
Uri.withAppendedPath(CONTENT_URI, "lookup_enterprise");
@@ -6562,9 +6585,10 @@ public final class ContactsContract {
/**
* It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the
* same columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in
- * parameters, otherwise it will throw IllegalArgumentException.
- *
- *
Caution: If you publish your app to the Google Play Store,
+ * parameters, otherwise it will throw IllegalArgumentException. The passed directory
+ * can belong either to the calling user or to a managed profile that is linked to it.
+ *
+ * Caution: If you publish your app to the Google Play Store,
* this field doesn't sort results based on contacts frequency. For more information,
* see the
* Contacts Provider
@@ -9261,7 +9285,7 @@ public final class ContactsContract {
* around this {@link View}.
* @param lookupUri A {@link ContactsContract.Contacts#CONTENT_LOOKUP_URI} style
* {@link Uri} that describes a specific contact to feature
- * in this dialog. A work lookup uri is supported here,
+ * in this dialog. A managed profile lookup uri is supported here,
* see {@link CommonDataKinds.Email#ENTERPRISE_CONTENT_LOOKUP_URI} and
* {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI}.
* @param mode Any of {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or
@@ -9297,7 +9321,7 @@ public final class ContactsContract {
* @param lookupUri A
* {@link ContactsContract.Contacts#CONTENT_LOOKUP_URI} style
* {@link Uri} that describes a specific contact to feature
- * in this dialog. A work lookup uri is supported here,
+ * in this dialog. A managed profile lookup uri is supported here,
* see {@link CommonDataKinds.Email#ENTERPRISE_CONTENT_LOOKUP_URI} and
* {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI}.
* @param mode Any of {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or
@@ -9330,7 +9354,7 @@ public final class ContactsContract {
* @param lookupUri A
* {@link ContactsContract.Contacts#CONTENT_LOOKUP_URI} style
* {@link Uri} that describes a specific contact to feature
- * in this dialog. A work lookup uri is supported here,
+ * in this dialog. A managed profile lookup uri is supported here,
* see {@link CommonDataKinds.Email#ENTERPRISE_CONTENT_LOOKUP_URI} and
* {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI}.
* @param excludeMimes Optional list of {@link Data#MIMETYPE} MIME-types
@@ -9370,7 +9394,7 @@ public final class ContactsContract {
* @param lookupUri A
* {@link ContactsContract.Contacts#CONTENT_LOOKUP_URI} style
* {@link Uri} that describes a specific contact to feature
- * in this dialog. A work lookup uri is supported here,
+ * in this dialog. A managed profile lookup uri is supported here,
* see {@link CommonDataKinds.Email#ENTERPRISE_CONTENT_LOOKUP_URI} and
* {@link PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI}.
* @param excludeMimes Optional list of {@link Data#MIMETYPE} MIME-types