diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-18 16:56:56 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-18 16:56:56 -0700 |
commit | 704a6471a78ae070cbf5e0b329d2385b526f8a2b (patch) | |
tree | beaaeb31348ce16d14b9f6a61cfc3b655beb3631 /core/java | |
parent | 0dfe16dc46919f99e419038ba767d5e1a321249a (diff) | |
parent | 6e9610e1dba59bf708b45e0039856d70e6b9768b (diff) | |
download | frameworks_base-704a6471a78ae070cbf5e0b329d2385b526f8a2b.zip frameworks_base-704a6471a78ae070cbf5e0b329d2385b526f8a2b.tar.gz frameworks_base-704a6471a78ae070cbf5e0b329d2385b526f8a2b.tar.bz2 |
Merge change 1927 into donut
* changes:
Fix build breakage
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/provider/Contacts.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/core/java/android/provider/Contacts.java b/core/java/android/provider/Contacts.java index 8d6ebdd..84fe184 100644 --- a/core/java/android/provider/Contacts.java +++ b/core/java/android/provider/Contacts.java @@ -340,27 +340,33 @@ public class Contacts { } /** - * Adds a person to the My Contacts group. - * - * @param resolver the resolver to use - * @param personId the person to add to the group - * @return the URI of the group membership row - * @throws IllegalStateException if the My Contacts group can't be found + * @hide Used in vCard parser code. */ - public static Uri addToMyContactsGroup(ContentResolver resolver, long personId) { - long groupId = 0; + public static long tryGetMyContactsGroupId(ContentResolver resolver) { Cursor groupsCursor = resolver.query(Groups.CONTENT_URI, GROUPS_PROJECTION, Groups.SYSTEM_ID + "='" + Groups.GROUP_MY_CONTACTS + "'", null, null); if (groupsCursor != null) { try { if (groupsCursor.moveToFirst()) { - groupId = groupsCursor.getLong(0); + return groupsCursor.getLong(0); } } finally { groupsCursor.close(); } } + return 0; + } + /** + * Adds a person to the My Contacts group. + * + * @param resolver the resolver to use + * @param personId the person to add to the group + * @return the URI of the group membership row + * @throws IllegalStateException if the My Contacts group can't be found + */ + public static Uri addToMyContactsGroup(ContentResolver resolver, long personId) { + long groupId = tryGetMyContactsGroupId(resolver); if (groupId == 0) { throw new IllegalStateException("Failed to find the My Contacts group"); } |