summaryrefslogtreecommitdiffstats
path: root/core/java/android/provider/ContactsContract.java
diff options
context:
space:
mode:
authorChiao Cheng <chiaocheng@google.com>2013-03-20 16:54:06 -0700
committerChiao Cheng <chiaocheng@google.com>2013-04-09 14:12:31 -0700
commit2355d13154d50687c0d8d74ea1c0e41ab9d88e7e (patch)
tree1ecccb78fc0adb5bbffa635b4a65e6f8787e2d78 /core/java/android/provider/ContactsContract.java
parentf38b070b31269e974298ec9e644814bcc2663c91 (diff)
downloadframeworks_base-2355d13154d50687c0d8d74ea1c0e41ab9d88e7e.zip
frameworks_base-2355d13154d50687c0d8d74ea1c0e41ab9d88e7e.tar.gz
frameworks_base-2355d13154d50687c0d8d74ea1c0e41ab9d88e7e.tar.bz2
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
Diffstat (limited to 'core/java/android/provider/ContactsContract.java')
-rw-r--r--core/java/android/provider/ContactsContract.java68
1 files changed, 66 insertions, 2 deletions
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 367d576..c41c35e 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -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
@@ -7909,6 +7966,13 @@ public final class ContactsContract {
"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.
*/