summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lehmann <lehmannd@google.com>2010-03-12 13:44:31 -0800
committerDaniel Lehmann <lehmannd@google.com>2010-03-12 13:44:31 -0800
commit63e914096ebfc767dc764519e41a2f4d8e578791 (patch)
tree3617fd8530a1fd3cbbc5b15cfe960ccb2a30ef4e
parent7b00978dc739ed2213ed8e511c69cfb412798109 (diff)
downloadframeworks_base-63e914096ebfc767dc764519e41a2f4d8e578791.zip
frameworks_base-63e914096ebfc767dc764519e41a2f4d8e578791.tar.gz
frameworks_base-63e914096ebfc767dc764519e41a2f4d8e578791.tar.bz2
Framework changes to allow VCards containing multiple entries
Bug:2501468 Change-Id: I004997c6ed9351e2600e7446615af9e60a14fda8
-rw-r--r--core/java/android/pim/vcard/VCardEntryCommitter.java18
-rw-r--r--core/java/android/provider/ContactsContract.java19
2 files changed, 34 insertions, 3 deletions
diff --git a/core/java/android/pim/vcard/VCardEntryCommitter.java b/core/java/android/pim/vcard/VCardEntryCommitter.java
index 3cd64b0..2f99e4a 100644
--- a/core/java/android/pim/vcard/VCardEntryCommitter.java
+++ b/core/java/android/pim/vcard/VCardEntryCommitter.java
@@ -19,6 +19,8 @@ import android.content.ContentResolver;
import android.net.Uri;
import android.util.Log;
+import java.util.ArrayList;
+
/**
* <P>
* {@link VCardEntryHandler} implementation which commits the entry to ContentResolver.
@@ -35,7 +37,7 @@ public class VCardEntryCommitter implements VCardEntryHandler {
private final ContentResolver mContentResolver;
private long mTimeToCommit;
- private Uri mLastCreatedUri;
+ private ArrayList<Uri> mCreatedUris = new ArrayList<Uri>();
public VCardEntryCommitter(ContentResolver resolver) {
mContentResolver = resolver;
@@ -52,11 +54,21 @@ public class VCardEntryCommitter implements VCardEntryHandler {
public void onEntryCreated(final VCardEntry contactStruct) {
long start = System.currentTimeMillis();
- mLastCreatedUri = contactStruct.pushIntoContentResolver(mContentResolver);
+ mCreatedUris.add(contactStruct.pushIntoContentResolver(mContentResolver));
mTimeToCommit += System.currentTimeMillis() - start;
}
+ // TODO: Compatibility function to not break the build. Will be removed shortly
+ @Deprecated
public Uri getLastCreatedUri() {
- return mLastCreatedUri;
+ return mCreatedUris.size() == 0 ? null : mCreatedUris.get(mCreatedUris.size() - 1);
+ }
+
+ /**
+ * Returns the list of created Uris. This list should not be modified by the caller as it is
+ * not a clone.
+ */
+ public ArrayList<Uri> getCreatedUris() {
+ return mCreatedUris;
}
} \ No newline at end of file
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index c06a1e2..40a408a 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -887,6 +887,25 @@ public final class ContactsContract {
"as_vcard");
/**
+ * Base {@link Uri} for referencing multiple {@link Contacts} entry,
+ * created by appending {@link #LOOKUP_KEY} using
+ * {@link Uri#withAppendedPath(Uri, String)}. The lookup keys have to be
+ * encoded and joined with the colon (":") seperator. The resulting string
+ * has to be encoded again. Provides
+ * {@link OpenableColumns} columns when queried, or returns the
+ * referenced contact formatted as a vCard when opened through
+ * {@link ContentResolver#openAssetFileDescriptor(Uri, String)}.
+ *
+ * This is private API because we do not have a well-defined way to
+ * specify several entities yet. The format of this Uri might change in the future
+ * or the Uri might be completely removed.
+ *
+ * @hide
+ */
+ public static final Uri CONTENT_MULTI_VCARD_URI = Uri.withAppendedPath(CONTENT_URI,
+ "as_multi_vcard");
+
+ /**
* Builds a {@link #CONTENT_LOOKUP_URI} style {@link Uri} describing the
* requested {@link Contacts} entry.
*