diff --git a/api/current.xml b/api/current.xml
index 931b0d8b7c613..d8ab697f31a43 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -115648,82 +115648,21 @@
Type: TEXT
- */ - public static final String PRESENCE_CUSTOM_STATUS = Presence.PRESENCE_CUSTOM_STATUS; - - /** - * The time when the latest presence custom status was inserted/updated. - * This column is only returned if explicitly requested in the query - * projection. - *Type: TEXT
- * @hide TODO unhide - */ - public static final String PRESENCE_CUSTOM_STATUS_TIMESTAMP = - Presence.PRESENCE_CUSTOM_STATUS_TIMESTAMP; - - /** - * Protocol that supplied the latest status update (see {@link CommonDataKinds.Im#PROTOCOL}. - * This column is only returned if explicitly requested in the query - * projection. - *Type: NUMBER
- * @hide TODO unhide - */ - public static final String PRESENCE_PROTOCOL = "presence_protocol"; - - /** - * Custom protocol that supplied the latest status update (see - * {@link CommonDataKinds.Im#CUSTOM_PROTOCOL}. This column is only - * returned if explicitly requested in the query projection. - *Type: TEXT
- * @hide TODO unhide - */ - public static final String PRESENCE_CUSTOM_PROTOCOL = "presence_custom_protocol"; - /** * An indicator of whether this contact has at least one phone number. "1" if there is * at least one phone number, "0" otherwise. @@ -281,12 +239,55 @@ public final class ContactsContract { public static final String LOOKUP_KEY = "lookup"; } + private interface ContactStatusColumns { + /** + * Contact presence status. See {@link StatusUpdates} for individual status + * definitions. + *Type: NUMBER
+ */ + public static final String CONTACT_PRESENCE = "contact_presence"; + + /** + * Contact's latest status update. + *Type: TEXT
+ */ + public static final String CONTACT_STATUS = "contact_status"; + + /** + * The absolute time in milliseconds when the latest status was + * inserted/updated. + *Type: NUMBER
+ */ + public static final String CONTACT_STATUS_TIMESTAMP = "contact_status_ts"; + + /** + * The package containing resources for this status: label and icon. + *Type: NUMBER
+ */ + public static final String CONTACT_STATUS_RES_PACKAGE = "contact_status_res_package"; + + /** + * The resource ID of the label describing the source of contact + * status, e.g. "Google Talk". This resource is scoped by the + * {@link #CONTACT_STATUS_RES_PACKAGE}. + *Type: NUMBER
+ */ + public static final String CONTACT_STATUS_LABEL = "contact_status_label"; + + /** + * The resource ID of the icon for the source of contact status. This + * resource is scoped by the {@link #CONTACT_STATUS_RES_PACKAGE}. + *Type: NUMBER
+ */ + public static final String CONTACT_STATUS_ICON = "contact_status_icon"; + } + /** * Constants for the contacts table, which contains a record per group * of raw contacts representing the same person. */ public static class Contacts implements BaseColumns, ContactsColumns, - ContactOptionsColumns { + ContactOptionsColumns, ContactStatusColumns { /** * This utility class cannot be instantiated */ @@ -649,6 +650,47 @@ public final class ContactsContract { } } + private interface StatusColumns extends Im.CommonPresenceColumns { + /** + * Contact's latest presence level, see {@link Im.CommonPresenceColumns} for + * specific definitions. + *Type: INTEGER (one of the values below)
+ */ + public static final String PRESENCE = PRESENCE_STATUS; + + /** + * Contact latest status update. + *Type: TEXT
+ */ + public static final String STATUS = PRESENCE_CUSTOM_STATUS; + + /** + * The absolute time in milliseconds when the latest status was inserted/updated. + *Type: NUMBER
+ */ + public static final String STATUS_TIMESTAMP = "status_ts"; + + /** + * The package containing resources for this status: label and icon. + *Type: NUMBER
+ */ + public static final String STATUS_RES_PACKAGE = "status_res_package"; + + /** + * The resource ID of the label describing the source of the status update, e.g. "Google + * Talk". This resource should be scoped by the {@link #STATUS_RES_PACKAGE}. + *Type: NUMBER
+ */ + public static final String STATUS_LABEL = "status_label"; + + /** + * The resource ID of the icon for the source of the status update. + * This resource should be scoped by the {@link #STATUS_RES_PACKAGE}. + *Type: NUMBER
+ */ + public static final String STATUS_ICON = "status_icon"; + } + private interface DataColumns { /** * The package name to use when creating {@link Resources} objects for @@ -736,8 +778,8 @@ public final class ContactsContract { /** * Combines all columns returned by {@link Data} table queries. */ - private interface DataColumnsWithJoins extends BaseColumns, DataColumns, RawContactsColumns, - ContactsColumns, ContactOptionsColumns { + private interface DataColumnsWithJoins extends BaseColumns, DataColumns, StatusColumns, + RawContactsColumns, ContactsColumns, ContactOptionsColumns, ContactStatusColumns { } @@ -758,15 +800,6 @@ public final class ContactsContract { */ public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data"); - /** - * The content:// style URI for this table joined with {@link Presence} - * data where applicable. - * - * @hide - */ - public static final Uri CONTENT_WITH_PRESENCE_URI = Uri.withAppendedPath(AUTHORITY_URI, - "data_with_presence"); - /** * The MIME type of {@link #CONTENT_URI} providing a directory of data. */ @@ -841,8 +874,8 @@ public final class ContactsContract { } /** - * Additional data mixed in with {@link Im.CommonPresenceColumns} to link - * back to specific {@link ContactsContract.Contacts#_ID} entries. + * Additional data mixed in with {@link StatusColumns} to link + * back to specific {@link ContactsContract.Data#_ID} entries. */ private interface PresenceColumns { @@ -881,23 +914,22 @@ public final class ContactsContract { public static final String IM_ACCOUNT = "im_account"; } - public static final class Presence implements PresenceColumns, Im.CommonPresenceColumns { + /** + * A status update is linked to a {@link Data} row and captures the user's latest status + * update via the corresponding source, e.g. "Having lunch" via "Google Talk". + */ + // TODO make final as soon as Presence is removed + public static /*final*/ class StatusUpdates implements StatusColumns, PresenceColumns { /** * This utility class cannot be instantiated */ - private Presence() {} + private StatusUpdates() {} /** * The content:// style URI for this table */ - public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence"); - - /** - * The unique ID for a presence row. - *Type: INTEGER (long)
- */ - public static final String _ID = "presence_id"; + public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "status_updates"); /** * Gets the resource ID for the proper presence icon. @@ -936,22 +968,20 @@ public final class ContactsContract { /** * The MIME type of {@link #CONTENT_URI} providing a directory of - * presence details. + * status update details. */ - public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence"; + public static final String CONTENT_TYPE = "vnd.android.cursor.dir/status-update"; /** * The MIME type of a {@link #CONTENT_URI} subdirectory of a single - * presence detail. + * status update detail. */ - public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence"; + public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/status-update"; + } + + @Deprecated + public static final class Presence extends StatusUpdates { - /** - * The time when the presence custom status was inserted/updated. - *Type: TEXT
- * @hide TODO unhide - */ - public static final String PRESENCE_CUSTOM_STATUS_TIMESTAMP = "status_timestamp"; } /** diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java index 86ee3dbc737bd..d7311c26dbb70 100644 --- a/core/java/com/android/internal/widget/ContactHeaderWidget.java +++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java @@ -96,9 +96,9 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList Contacts.PHOTO_ID, Contacts.DISPLAY_NAME, Contacts.STARRED, - Contacts.PRESENCE_STATUS, - Contacts.PRESENCE_CUSTOM_STATUS, - Contacts.PRESENCE_CUSTOM_STATUS_TIMESTAMP, + Contacts.CONTACT_PRESENCE, + Contacts.CONTACT_STATUS, + Contacts.CONTACT_STATUS_TIMESTAMP, }; int _ID = 0; int LOOKUP_KEY = 1; @@ -107,9 +107,9 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList //TODO: We need to figure out how we're going to get the phonetic name. //static final int HEADER_PHONETIC_NAME_COLUMN_INDEX int STARRED = 4; - int PRESENCE_STATUS = 5; - int PRESENCE_CUSTOM_STATUS = 6; - int PRESENCE_CUSTOM_STATUS_TIMESTAMP = 7; + int CONTACT_PRESENCE_STATUS = 5; + int CONTACT_STATUS = 6; + int CONTACT_STATUS_TIMESTAMP = 7; } //Projection used for looking up contact id from phone number @@ -429,8 +429,8 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList mPhotoView.assignContactUri(Contacts.getLookupUri(contactId, lookupKey)); //Set the presence status - if (!c.isNull(ContactQuery.PRESENCE_STATUS)) { - int presence = c.getInt(ContactQuery.PRESENCE_STATUS); + if (!c.isNull(ContactQuery.CONTACT_PRESENCE_STATUS)) { + int presence = c.getInt(ContactQuery.CONTACT_PRESENCE_STATUS); mPresenceView.setImageResource(Presence.getPresenceIconResourceId(presence)); mPresenceView.setVisibility(View.VISIBLE); } else { @@ -438,13 +438,13 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList } //Set the status update - String status = c.getString(ContactQuery.PRESENCE_CUSTOM_STATUS); + String status = c.getString(ContactQuery.CONTACT_STATUS); if (!TextUtils.isEmpty(status)) { mStatusView.setText(status); mStatusView.setVisibility(View.VISIBLE); - if (!c.isNull(ContactQuery.PRESENCE_CUSTOM_STATUS_TIMESTAMP)) { - long date = c.getLong(ContactQuery.PRESENCE_CUSTOM_STATUS_TIMESTAMP); + if (!c.isNull(ContactQuery.CONTACT_STATUS_TIMESTAMP)) { + long date = c.getLong(ContactQuery.CONTACT_STATUS_TIMESTAMP); // Set the date/time field by mixing relative and absolute // times.