Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 879664e3 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Adding columns to support attribution of status updates. Also renaming some...

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

Change-Id: If6d7812f38a3cfd662a5ae2387c72c4761fdf9fa
parent dba93b68
Loading
Loading
Loading
Loading
+74 −68
Original line number Diff line number Diff line
@@ -115648,82 +115648,21 @@
</field>
</class>
<class name="ContactsContract.Presence"
 extends="java.lang.Object"
 abstract="false"
 static="true"
 final="true"
 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"
 extends="android.provider.ContactsContract.StatusUpdates"
 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"
 deprecated="deprecated"
 visibility="public"
>
</field>
<field name="_ID"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;presence_id&quot;"
 static="true"
 final="true"
<constructor name="ContactsContract.Presence"
 type="android.provider.ContactsContract.Presence"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</constructor>
</class>
<class name="ContactsContract.RawContacts"
 extends="java.lang.Object"
@@ -115890,6 +115829,73 @@
>
</field>
</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"
 extends="java.lang.Object"
 abstract="false"
+96 −66
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ public final class ContactsContract {
     * @hide should be removed when users are updated to refer to SyncState
     * @deprecated use SyncState instead
     */
    @Deprecated
    public interface SyncStateColumns extends SyncStateContract.Columns {
    }

@@ -225,60 +226,60 @@ public final class ContactsContract {
        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>
         * An indicator of whether this contact has at least one phone number. "1" if there is
         * at least one phone number, "0" otherwise.
         * <P>Type: INTEGER</P>
         */
        public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS;
        public static final String HAS_PHONE_NUMBER = "has_phone_number";

        /**
         * Contact presence custom status. This column is only returned if explicitly
         * requested in the query projection.
         * <p>Type: TEXT</p>
         * An opaque value that contains hints on how to find the contact if
         * its row id changed as a result of a sync or aggregation.
         */
        public static final String PRESENCE_CUSTOM_STATUS = Presence.PRESENCE_CUSTOM_STATUS;
        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";

        /**
         * The time when the latest presence custom status was inserted/updated.
         * This column is only returned if explicitly requested in the query
         * projection.
         * Contact's latest status update.
         * <p>Type: TEXT</p>
         * @hide TODO unhide
         */
        public static final String PRESENCE_CUSTOM_STATUS_TIMESTAMP =
                Presence.PRESENCE_CUSTOM_STATUS_TIMESTAMP;
        public static final String CONTACT_STATUS = "contact_status";

        /**
         * Protocol that supplied the latest status update (see {@link CommonDataKinds.Im#PROTOCOL}.
         * This column is only returned if explicitly requested in the query
         * projection.
         * The absolute time in milliseconds when the latest status was
         * inserted/updated.
         * <p>Type: NUMBER</p>
         * @hide TODO unhide
         */
        public static final String PRESENCE_PROTOCOL = "presence_protocol";
        public static final String CONTACT_STATUS_TIMESTAMP = "contact_status_ts";

        /**
         * 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
         * The package containing resources for this status: label and icon.
         * <p>Type: NUMBER</p>
         */
        public static final String PRESENCE_CUSTOM_PROTOCOL = "presence_custom_protocol";
        public static final String CONTACT_STATUS_RES_PACKAGE = "contact_status_res_package";

        /**
         * An indicator of whether this contact has at least one phone number. "1" if there is
         * at least one phone number, "0" otherwise.
         * <P>Type: INTEGER</P>
         * 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 HAS_PHONE_NUMBER = "has_phone_number";
        public static final String CONTACT_STATUS_LABEL = "contact_status_label";

        /**
         * An opaque value that contains hints on how to find the contact if
         * its row id changed as a result of a sync or aggregation.
         * 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 LOOKUP_KEY = "lookup";
        public static final String CONTACT_STATUS_ICON = "contact_status_icon";
    }

    /**
@@ -286,7 +287,7 @@ public final class ContactsContract {
     * 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.
         * <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 {
        /**
         * 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 {

    /**
         * This utility class cannot be instantiated
     * 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".
     */
        private Presence() {}
    // TODO make final as soon as Presence is removed
    public static /*final*/ class StatusUpdates implements StatusColumns, PresenceColumns {

        /**
         * The content:// style URI for this table
         * This utility class cannot be instantiated
         */
        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence");
        private StatusUpdates() {}

        /**
         * The unique ID for a presence row.
         * <P>Type: INTEGER (long)</P>
         * The content:// style URI for this table
         */
        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.
         * <p>Type: TEXT</p>
         * @hide TODO unhide
         */
        public static final String PRESENCE_CUSTOM_STATUS_TIMESTAMP = "status_timestamp";
    }

    /**
+11 −11
Original line number Diff line number Diff line
@@ -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.