diff --git a/api/current.txt b/api/current.txt index fff444de3f2b5..51ec0fd12f21b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -31695,6 +31695,8 @@ package android.provider { field public static final java.lang.String EXTRA_RECIPIENT_CONTACT_NAME = "android.provider.extra.RECIPIENT_CONTACT_NAME"; field public static final java.lang.String EXTRA_RECIPIENT_CONTACT_URI = "android.provider.extra.RECIPIENT_CONTACT_URI"; field public static final java.lang.String INVITE_CONTACT = "com.android.contacts.action.INVITE_CONTACT"; + field public static final java.lang.String METADATA_ACCOUNT_TYPE = "android.provider.account_type"; + field public static final java.lang.String METADATA_MIMETYPE = "android.provider.mimetype"; field public static final java.lang.String SEARCH_SUGGESTION_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; field public static final java.lang.String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; field public static final java.lang.String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; diff --git a/api/system-current.txt b/api/system-current.txt index 9a6d07aa1f5b7..1bfe03805d5d5 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -34260,6 +34260,8 @@ package android.provider { field public static final java.lang.String EXTRA_RECIPIENT_CONTACT_NAME = "android.provider.extra.RECIPIENT_CONTACT_NAME"; field public static final java.lang.String EXTRA_RECIPIENT_CONTACT_URI = "android.provider.extra.RECIPIENT_CONTACT_URI"; field public static final java.lang.String INVITE_CONTACT = "com.android.contacts.action.INVITE_CONTACT"; + field public static final java.lang.String METADATA_ACCOUNT_TYPE = "android.provider.account_type"; + field public static final java.lang.String METADATA_MIMETYPE = "android.provider.mimetype"; field public static final java.lang.String SEARCH_SUGGESTION_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; field public static final java.lang.String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; field public static final java.lang.String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; diff --git a/api/test-current.txt b/api/test-current.txt index a7282f2e2544d..de7ee98bed150 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -31767,6 +31767,8 @@ package android.provider { field public static final java.lang.String EXTRA_RECIPIENT_CONTACT_NAME = "android.provider.extra.RECIPIENT_CONTACT_NAME"; field public static final java.lang.String EXTRA_RECIPIENT_CONTACT_URI = "android.provider.extra.RECIPIENT_CONTACT_URI"; field public static final java.lang.String INVITE_CONTACT = "com.android.contacts.action.INVITE_CONTACT"; + field public static final java.lang.String METADATA_ACCOUNT_TYPE = "android.provider.account_type"; + field public static final java.lang.String METADATA_MIMETYPE = "android.provider.mimetype"; field public static final java.lang.String SEARCH_SUGGESTION_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; field public static final java.lang.String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; field public static final java.lang.String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 3658df9a84434..8658d137c7bba 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -8759,21 +8759,34 @@ public final class ContactsContract { * android.service.voice.VoiceInteractionSession#startVoiceActivity}. *
* When the action was not initiated by Voice Assistant or when the receiving activity does - * not support {@link android.content.Intent#CATEGORY_VOICE}, the activity should confirm + * not support {@link android.content.Intent#CATEGORY_VOICE}, the activity must confirm * with the user before sending the message (because in this case it is unknown which app * sent the intent, it could be malicious). *
* To allow the Voice Assistant to help users with contacts disambiguation, the messaging - * app may choose to integrate with the Contacts Provider. The following convention should - * be met when creating Data table for such integration: + * app may choose to integrate with the Contacts Provider. You will need to specify a new + * MIME type in order to store your app’s unique contact IDs and optional human readable + * labels in the Data table. The Voice Assistant needs to know this MIME type and {@link + * RawContacts#ACCOUNT_TYPE} that you are using in order to provide the smooth contact + * disambiguation user experience. The following convention should be met when performing + * such integration: *
* Input: {@link android.content.Intent#getType} is the MIME type of the data being sent. * The intent sender will always put the concrete mime type in the intent type, like @@ -8814,6 +8830,8 @@ public final class ContactsContract { * @see #EXTRA_RECIPIENT_CONTACT_URI * @see #EXTRA_RECIPIENT_CONTACT_CHAT_ID * @see #EXTRA_RECIPIENT_CONTACT_NAME + * @see #METADATA_ACCOUNT_TYPE + * @see #METADATA_MIMETYPE */ public static final String ACTION_VOICE_SEND_MESSAGE_TO_CONTACTS = "android.provider.action.VOICE_SEND_MESSAGE_TO_CONTACTS"; @@ -8845,8 +8863,10 @@ public final class ContactsContract { * recipient is absent, it will be set to null. *
* The value of the elements comes from the {@link DataColumns#DATA1} column in Contacts - * Provider, and should be the unambiguous contact endpoint. This value is app-specific, it - * could be a phone number or some proprietary ID. + * Provider with {@link DataColumns#MIMETYPE} from {@link #METADATA_MIMETYPE} (if both + * {@link #METADATA_ACCOUNT_TYPE} and {@link #METADATA_MIMETYPE} are specified by the app; + * otherwise, the value will be a phone number), and should be the unambiguous contact + * endpoint. This value is app-specific, it could be some proprietary ID or a phone number. */ public static final String EXTRA_RECIPIENT_CONTACT_CHAT_ID = "android.provider.extra.RECIPIENT_CONTACT_CHAT_ID"; @@ -8866,6 +8886,20 @@ public final class ContactsContract { public static final String EXTRA_RECIPIENT_CONTACT_NAME = "android.provider.extra.RECIPIENT_CONTACT_NAME"; + /** + * A string associated with an {@link #ACTION_VOICE_SEND_MESSAGE_TO_CONTACTS} activity + * describing {@link RawContacts#ACCOUNT_TYPE} for the corresponding Contacts Provider + * implementation. + */ + public static final String METADATA_ACCOUNT_TYPE = "android.provider.account_type"; + + /** + * A string associated with an {@link #ACTION_VOICE_SEND_MESSAGE_TO_CONTACTS} activity + * describing {@link DataColumns#MIMETYPE} for the corresponding Contacts Provider + * implementation. + */ + public static final String METADATA_MIMETYPE = "android.provider.mimetype"; + /** * Starts an Activity that lets the user select the multiple phones from a * list of phone numbers which come from the contacts or