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

Commit 2355d131 authored by Chiao Cheng's avatar Chiao Cheng
Browse files

Adding public api support for finding contact changes.

DeletedContacts holds a log of deleted contacts which will be pruned
after a certain amount of time.

A timestamp field has been added to contacts so clients can query
for changes.

Bug: 8182147
Change-Id: Ic6e56e567892712da3c3941400dfb3ddc565aaac
parent f38b070b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -18442,6 +18442,7 @@ package android.provider {
  }
  protected static abstract interface ContactsContract.ContactsColumns {
    field public static final java.lang.String CONTACT_LAST_UPDATED_TIMESTAMP = "contact_last_updated_timestamp";
    field public static final java.lang.String DISPLAY_NAME = "display_name";
    field public static final java.lang.String HAS_PHONE_NUMBER = "has_phone_number";
    field public static final java.lang.String IN_VISIBLE_GROUP = "in_visible_group";
@@ -18506,6 +18507,16 @@ package android.provider {
    field public static final java.lang.String TIMES_USED = "times_used";
  }
  public static final class ContactsContract.DeletedContacts implements android.provider.ContactsContract.DeletedContactsColumns {
    field public static final android.net.Uri CONTENT_URI;
    field public static final long DAYS_KEPT_MILLISECONDS = 2592000000L; // 0x9a7ec800L
  }
  protected static abstract interface ContactsContract.DeletedContactsColumns {
    field public static final java.lang.String CONTACT_DELETED_TIMESTAMP = "contact_deleted_timestamp";
    field public static final java.lang.String CONTACT_ID = "contact_id";
  }
  public static final class ContactsContract.Directory implements android.provider.BaseColumns {
    method public static void notifyDirectoryChange(android.content.ContentResolver);
    field public static final java.lang.String ACCOUNT_NAME = "accountName";
@@ -18585,6 +18596,7 @@ package android.provider {
  public static final class ContactsContract.Intents {
    ctor public ContactsContract.Intents();
    field public static final java.lang.String ATTACH_IMAGE = "com.android.contacts.action.ATTACH_IMAGE";
    field public static final java.lang.String CONTACTS_DATABASE_CREATED = "android.provider.Contacts.DATABASE_CREATED";
    field public static final java.lang.String EXTRA_CREATE_DESCRIPTION = "com.android.contacts.action.CREATE_DESCRIPTION";
    field public static final java.lang.String EXTRA_FORCE_CREATE = "com.android.contacts.action.FORCE_CREATE";
    field public static final java.lang.String INVITE_CONTACT = "com.android.contacts.action.INVITE_CONTACT";
+66 −2
Original line number Diff line number Diff line
@@ -35,9 +35,7 @@ import android.database.Cursor;
import android.database.DatabaseUtils;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Pair;
@@ -939,6 +937,15 @@ public final class ContactsContract {
         * its row id changed as a result of a sync or aggregation.
         */
        public static final String LOOKUP_KEY = "lookup";

        /**
         * Timestamp (milliseconds since epoch) of when this contact was last updated.  This
         * includes updates to all data associated with this contact including raw contacts.  Any
         * modification (including deletes and inserts) of underlying contact data are also
         * reflected in this timestamp.
         */
        public static final String CONTACT_LAST_UPDATED_TIMESTAMP =
                "contact_last_updated_timestamp";
    }

    /**
@@ -2113,6 +2120,56 @@ public final class ContactsContract {
        return id >= Profile.MIN_ID;
    }

    protected interface DeletedContactsColumns {

        /**
         * A reference to the {@link ContactsContract.Contacts#_ID} that was deleted.
         * <P>Type: INTEGER</P>
         */
        public static final String CONTACT_ID = "contact_id";

        /**
         * Time (milliseconds since epoch) that the contact was deleted.
         */
        public static final String CONTACT_DELETED_TIMESTAMP = "contact_deleted_timestamp";
    }

    /**
     * Constants for the deleted contact table.  This table holds a log of deleted contacts.
     * <p>
     * Log older than {@link #DAYS_KEPT_MILLISECONDS} may be deleted.
     */
    public static final class DeletedContacts implements DeletedContactsColumns {

        /**
         * This utility class cannot be instantiated
         */
        private DeletedContacts() {
        }

        /**
         * The content:// style URI for this table, which requests a directory of raw contact rows
         * matching the selection criteria.
         */
        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI,
                "deleted_contacts");

        /**
         * Number of days that the delete log will be kept.  After this time, delete records may be
         * deleted.
         *
         * @hide
         */
        private static final int DAYS_KEPT = 30;

        /**
         * Milliseconds that the delete log will be kept.  After this time, delete records may be
         * deleted.
         */
        public static final long DAYS_KEPT_MILLISECONDS = 1000L * 60L * 60L * 24L * (long)DAYS_KEPT;
    }


    protected interface RawContactsColumns {
        /**
         * A reference to the {@link ContactsContract.Contacts#_ID} that this
@@ -7908,6 +7965,13 @@ public final class ContactsContract {
        public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =
                "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";

        /**
         * This is the intent that is fired when the contacts database is created. <p> The
         * READ_CONTACT permission is required to receive these broadcasts.
         */
        public static final String CONTACTS_DATABASE_CREATED =
                "android.provider.Contacts.DATABASE_CREATED";

        /**
         * Starts an Activity that lets the user pick a contact to attach an image to.
         * After picking the contact it launches the image cropper in face detection mode.