am 879664e3: Adding columns to support attribution of status updates. Also renaming some columns to better describe their purpose.

Merge commit '879664e3e2e0169aba53d88f6c30c8b15858315d' into eclair-plus-aosp

* commit '879664e3e2e0169aba53d88f6c30c8b15858315d':
  Adding columns to support attribution of status updates.  Also renaming some columns to better describe their purpose.
This commit is contained in:
Dmitri Plotnikov
2009-09-27 19:55:51 -07:00
committed by Android Git Automerger
3 changed files with 193 additions and 157 deletions

View File

@@ -115648,82 +115648,21 @@
</field> </field>
</class> </class>
<class name="ContactsContract.Presence" <class name="ContactsContract.Presence"
extends="java.lang.Object" extends="android.provider.ContactsContract.StatusUpdates"
abstract="false" abstract="false"
static="true" static="true"
final="true" final="true"
deprecated="deprecated"
visibility="public"
>
<constructor name="ContactsContract.Presence"
type="android.provider.ContactsContract.Presence"
static="false"
final="false"
deprecated="not deprecated" deprecated="not deprecated"
visibility="public" visibility="public"
> >
<method name="getPresenceIconResourceId" </constructor>
return="int"
abstract="false"
native="false"
synchronized="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
<parameter name="status" type="int">
</parameter>
</method>
<method name="getPresencePrecedence"
return="int"
abstract="false"
native="false"
synchronized="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
<parameter name="status" type="int">
</parameter>
</method>
<field name="CONTENT_ITEM_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;vnd.android.cursor.item/im-presence&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="CONTENT_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;vnd.android.cursor.dir/im-presence&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="CONTENT_URI"
type="android.net.Uri"
transient="false"
volatile="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="_ID"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;presence_id&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class> </class>
<class name="ContactsContract.RawContacts" <class name="ContactsContract.RawContacts"
extends="java.lang.Object" extends="java.lang.Object"
@@ -115890,6 +115829,73 @@
> >
</field> </field>
</class> </class>
<class name="ContactsContract.StatusUpdates"
extends="java.lang.Object"
abstract="false"
static="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
<method name="getPresenceIconResourceId"
return="int"
abstract="false"
native="false"
synchronized="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
<parameter name="status" type="int">
</parameter>
</method>
<method name="getPresencePrecedence"
return="int"
abstract="false"
native="false"
synchronized="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
<parameter name="status" type="int">
</parameter>
</method>
<field name="CONTENT_ITEM_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;vnd.android.cursor.item/status-update&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="CONTENT_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;vnd.android.cursor.dir/status-update&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="CONTENT_URI"
type="android.net.Uri"
transient="false"
volatile="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="ContactsContract.SyncState" <class name="ContactsContract.SyncState"
extends="java.lang.Object" extends="java.lang.Object"
abstract="false" abstract="false"

View File

@@ -60,6 +60,7 @@ public final class ContactsContract {
* @hide should be removed when users are updated to refer to SyncState * @hide should be removed when users are updated to refer to SyncState
* @deprecated use SyncState instead * @deprecated use SyncState instead
*/ */
@Deprecated
public interface SyncStateColumns extends SyncStateContract.Columns { public interface SyncStateColumns extends SyncStateContract.Columns {
} }
@@ -224,49 +225,6 @@ public final class ContactsContract {
*/ */
public static final String IN_VISIBLE_GROUP = "in_visible_group"; public static final String IN_VISIBLE_GROUP = "in_visible_group";
/**
* Contact presence status. See {@link Presence}
* for individual status definitions. This column is only returned if explicitly
* requested in the query projection.
* <p>Type: NUMBER</p>
*/
public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS;
/**
* Contact presence custom status. This column is only returned if explicitly
* requested in the query projection.
* <p>Type: TEXT</p>
*/
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.
* <p>Type: TEXT</p>
* @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.
* <p>Type: NUMBER</p>
* @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.
* <p>Type: TEXT</p>
* @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 * An indicator of whether this contact has at least one phone number. "1" if there is
* at least one phone number, "0" otherwise. * at least one phone number, "0" otherwise.
@@ -281,12 +239,55 @@ public final class ContactsContract {
public static final String LOOKUP_KEY = "lookup"; public static final String LOOKUP_KEY = "lookup";
} }
private interface ContactStatusColumns {
/**
* Contact presence status. See {@link StatusUpdates} for individual status
* definitions.
* <p>Type: NUMBER</p>
*/
public static final String CONTACT_PRESENCE = "contact_presence";
/**
* Contact's latest status update.
* <p>Type: TEXT</p>
*/
public static final String CONTACT_STATUS = "contact_status";
/**
* The absolute time in milliseconds when the latest status was
* inserted/updated.
* <p>Type: NUMBER</p>
*/
public static final String CONTACT_STATUS_TIMESTAMP = "contact_status_ts";
/**
* The package containing resources for this status: label and icon.
* <p>Type: NUMBER</p>
*/
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}.
* <p>Type: NUMBER</p>
*/
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}.
* <p>Type: NUMBER</p>
*/
public static final String CONTACT_STATUS_ICON = "contact_status_icon";
}
/** /**
* Constants for the contacts table, which contains a record per group * Constants for the contacts table, which contains a record per group
* of raw contacts representing the same person. * of raw contacts representing the same person.
*/ */
public static class Contacts implements BaseColumns, ContactsColumns, public static class Contacts implements BaseColumns, ContactsColumns,
ContactOptionsColumns { ContactOptionsColumns, ContactStatusColumns {
/** /**
* This utility class cannot be instantiated * 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.
* <P>Type: INTEGER (one of the values below)</P>
*/
public static final String PRESENCE = PRESENCE_STATUS;
/**
* Contact latest status update.
* <p>Type: TEXT</p>
*/
public static final String STATUS = PRESENCE_CUSTOM_STATUS;
/**
* The absolute time in milliseconds when the latest status was inserted/updated.
* <p>Type: NUMBER</p>
*/
public static final String STATUS_TIMESTAMP = "status_ts";
/**
* The package containing resources for this status: label and icon.
* <p>Type: NUMBER</p>
*/
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}.
* <p>Type: NUMBER</p>
*/
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}.
* <p>Type: NUMBER</p>
*/
public static final String STATUS_ICON = "status_icon";
}
private interface DataColumns { private interface DataColumns {
/** /**
* The package name to use when creating {@link Resources} objects for * 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. * Combines all columns returned by {@link Data} table queries.
*/ */
private interface DataColumnsWithJoins extends BaseColumns, DataColumns, RawContactsColumns, private interface DataColumnsWithJoins extends BaseColumns, DataColumns, StatusColumns,
ContactsColumns, ContactOptionsColumns { RawContactsColumns, ContactsColumns, ContactOptionsColumns, ContactStatusColumns {
} }
@@ -758,15 +800,6 @@ public final class ContactsContract {
*/ */
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data"); 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. * 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 * Additional data mixed in with {@link StatusColumns} to link
* back to specific {@link ContactsContract.Contacts#_ID} entries. * back to specific {@link ContactsContract.Data#_ID} entries.
*/ */
private interface PresenceColumns { private interface PresenceColumns {
@@ -881,23 +914,22 @@ public final class ContactsContract {
public static final String IM_ACCOUNT = "im_account"; 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 * This utility class cannot be instantiated
*/ */
private Presence() {} private StatusUpdates() {}
/** /**
* The content:// style URI for this table * The content:// style URI for this table
*/ */
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence"); public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "status_updates");
/**
* The unique ID for a presence row.
* <P>Type: INTEGER (long)</P>
*/
public static final String _ID = "presence_id";
/** /**
* Gets the resource ID for the proper presence icon. * 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 * 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 * 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.
* <p>Type: TEXT</p>
* @hide TODO unhide
*/
public static final String PRESENCE_CUSTOM_STATUS_TIMESTAMP = "status_timestamp";
} }
/** /**

View File

@@ -96,9 +96,9 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
Contacts.PHOTO_ID, Contacts.PHOTO_ID,
Contacts.DISPLAY_NAME, Contacts.DISPLAY_NAME,
Contacts.STARRED, Contacts.STARRED,
Contacts.PRESENCE_STATUS, Contacts.CONTACT_PRESENCE,
Contacts.PRESENCE_CUSTOM_STATUS, Contacts.CONTACT_STATUS,
Contacts.PRESENCE_CUSTOM_STATUS_TIMESTAMP, Contacts.CONTACT_STATUS_TIMESTAMP,
}; };
int _ID = 0; int _ID = 0;
int LOOKUP_KEY = 1; 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. //TODO: We need to figure out how we're going to get the phonetic name.
//static final int HEADER_PHONETIC_NAME_COLUMN_INDEX //static final int HEADER_PHONETIC_NAME_COLUMN_INDEX
int STARRED = 4; int STARRED = 4;
int PRESENCE_STATUS = 5; int CONTACT_PRESENCE_STATUS = 5;
int PRESENCE_CUSTOM_STATUS = 6; int CONTACT_STATUS = 6;
int PRESENCE_CUSTOM_STATUS_TIMESTAMP = 7; int CONTACT_STATUS_TIMESTAMP = 7;
} }
//Projection used for looking up contact id from phone number //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)); mPhotoView.assignContactUri(Contacts.getLookupUri(contactId, lookupKey));
//Set the presence status //Set the presence status
if (!c.isNull(ContactQuery.PRESENCE_STATUS)) { if (!c.isNull(ContactQuery.CONTACT_PRESENCE_STATUS)) {
int presence = c.getInt(ContactQuery.PRESENCE_STATUS); int presence = c.getInt(ContactQuery.CONTACT_PRESENCE_STATUS);
mPresenceView.setImageResource(Presence.getPresenceIconResourceId(presence)); mPresenceView.setImageResource(Presence.getPresenceIconResourceId(presence));
mPresenceView.setVisibility(View.VISIBLE); mPresenceView.setVisibility(View.VISIBLE);
} else { } else {
@@ -438,13 +438,13 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
} }
//Set the status update //Set the status update
String status = c.getString(ContactQuery.PRESENCE_CUSTOM_STATUS); String status = c.getString(ContactQuery.CONTACT_STATUS);
if (!TextUtils.isEmpty(status)) { if (!TextUtils.isEmpty(status)) {
mStatusView.setText(status); mStatusView.setText(status);
mStatusView.setVisibility(View.VISIBLE); mStatusView.setVisibility(View.VISIBLE);
if (!c.isNull(ContactQuery.PRESENCE_CUSTOM_STATUS_TIMESTAMP)) { if (!c.isNull(ContactQuery.CONTACT_STATUS_TIMESTAMP)) {
long date = c.getLong(ContactQuery.PRESENCE_CUSTOM_STATUS_TIMESTAMP); long date = c.getLong(ContactQuery.CONTACT_STATUS_TIMESTAMP);
// Set the date/time field by mixing relative and absolute // Set the date/time field by mixing relative and absolute
// times. // times.