diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 17fc9f041e6e5..75ca5afc4f8f6 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -165,6 +165,13 @@ public final class ContactsContract { */ public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "aggregates"); + /** + * The content:// style URI for this table joined with useful data from + * {@link Data} and {@link Presence}. + */ + public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI, + "aggregates_summary"); + /** * The MIME type of {@link #CONTENT_URI} providing a directory of * people. @@ -367,7 +374,97 @@ public final class ContactsContract { * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber); * } */ - public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "phone_lookup"); + public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI, + "phone_lookup"); + } + + /** + * Additional data mixed in with {@link Im.CommonPresenceColumns} to link + * back to specific {@link ContactsContract.Aggregates#_ID} entries. + */ + private interface PresenceColumns { + /** + * Reference to the {@link Aggregates#_ID} this presence references. + */ + public static final String AGGREGATE_ID = "aggregate_id"; + + /** + * Reference to the {@link Data#_ID} entry that owns this presence. + */ + public static final String DATA_ID = "data_id"; + + /** + * The IM service the presence is coming from. Formatted using either + * {@link Contacts.ContactMethods#encodePredefinedImProtocol} or + * {@link Contacts.ContactMethods#encodeCustomImProtocol}. + *

+ * Type: STRING + */ + public static final String IM_PROTOCOL = "im_protocol"; + + /** + * The IM handle the presence item is for. The handle is scoped to the + * {@link #IM_PROTOCOL}. + *

+ * Type: STRING + */ + public static final String IM_HANDLE = "im_handle"; + + /** + * The IM account for the local user that the presence data came from. + *

+ * Type: STRING + */ + public static final String IM_ACCOUNT = "im_account"; + } + + public static final class Presence implements BaseColumns, PresenceColumns, + Im.CommonPresenceColumns { + /** + * This utility class cannot be instantiated + */ + private Presence() { + } + + /** + * The content:// style URI for this table + */ + public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence"); + + /** + * Gets the resource ID for the proper presence icon. + * + * @param status the status to get the icon for + * @return the resource ID for the proper presence icon + */ + public static final int getPresenceIconResourceId(int status) { + switch (status) { + case AVAILABLE: + return android.R.drawable.presence_online; + case IDLE: + case AWAY: + return android.R.drawable.presence_away; + case DO_NOT_DISTURB: + return android.R.drawable.presence_busy; + case INVISIBLE: + return android.R.drawable.presence_invisible; + case OFFLINE: + default: + return android.R.drawable.presence_offline; + } + } + + /** + * The MIME type of {@link #CONTENT_URI} providing a directory of + * presence details. + */ + public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence"; + + /** + * The MIME type of a {@link #CONTENT_URI} subdirectory of a single + * presence detail. + */ + public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence"; } /** diff --git a/core/java/android/provider/SocialContract.java b/core/java/android/provider/SocialContract.java index d4a9c489f72c8..28bf8dbc815d0 100644 --- a/core/java/android/provider/SocialContract.java +++ b/core/java/android/provider/SocialContract.java @@ -18,6 +18,8 @@ package android.provider; import android.graphics.BitmapFactory; import android.net.Uri; +import android.provider.ContactsContract.Aggregates; +import android.provider.ContactsContract.Data; /** * The contract between the social provider and applications. Contains @@ -152,12 +154,20 @@ public class SocialContract { public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "activities"); /** - * The content:// style URI for this table filtered to the set of social activities + * The content:// URI for this table filtered to the set of social activities * authored by a specific {@link android.provider.ContactsContract.Contacts#_ID}. */ public static final Uri CONTENT_AUTHORED_BY_URI = Uri.withAppendedPath(CONTENT_URI, "authored_by"); + /** + * The {@link Uri} for the latest social activity performed by any + * contact aggregated under the specified {@link Aggregates#_ID}. Will + * also join with most-present {@link Presence} for this aggregate. + */ + public static final Uri CONTENT_AGGREGATE_STATUS_URI = + Uri.withAppendedPath(AUTHORITY_URI, "aggregate_status"); + /** * The MIME type of {@link #CONTENT_URI} providing a directory of social * activities.