diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2010-02-16 14:40:46 -0800 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2010-02-16 14:40:46 -0800 |
commit | 989edfde740b0dfddddba9782cced333624484dd (patch) | |
tree | 26c89476a0ca0cea13395c734646445e0214bd95 /core/java/android/pim | |
parent | cf06dd0a8a4321ea640e7d1ebe5dffcd69324a04 (diff) | |
download | frameworks_base-989edfde740b0dfddddba9782cced333624484dd.zip frameworks_base-989edfde740b0dfddddba9782cced333624484dd.tar.gz frameworks_base-989edfde740b0dfddddba9782cced333624484dd.tar.bz2 |
Fixing the use of entities in VCardExporter.
Bug: 2377678
Change-Id: I05768fd2ce28406b1fc32005343fa1eeaaecdd24
Diffstat (limited to 'core/java/android/pim')
-rw-r--r-- | core/java/android/pim/vcard/VCardComposer.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java index 5e978f6..2eb25954 100644 --- a/core/java/android/pim/vcard/VCardComposer.java +++ b/core/java/android/pim/vcard/VCardComposer.java @@ -31,6 +31,7 @@ import android.provider.CallLog.Calls; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.RawContacts; +import android.provider.ContactsContract.RawContactsEntity; import android.provider.ContactsContract.CommonDataKinds.Email; import android.provider.ContactsContract.CommonDataKinds.Event; import android.provider.ContactsContract.CommonDataKinds.Im; @@ -498,17 +499,18 @@ public class VCardComposer { Method getEntityIteratorMethod) throws VCardException { final Map<String, List<ContentValues>> contentValuesListMap = new HashMap<String, List<ContentValues>>(); - // The resolver may return the entity iterator with no data. It is possiible. + // The resolver may return the entity iterator with no data. It is possible. // e.g. If all the data in the contact of the given contact id are not exportable ones, // they are hidden from the view of this method, though contact id itself exists. EntityIterator entityIterator = null; try { + final Uri uri = RawContactsEntity.CONTENT_URI.buildUpon() + .appendQueryParameter(Data.FOR_EXPORT_ONLY, "1") + .build(); + final String selection = Data.CONTACT_ID + "=?"; + final String[] selectionArgs = new String[] {contactId}; if (getEntityIteratorMethod != null) { - final Uri uri = RawContacts.CONTENT_URI.buildUpon() - .appendQueryParameter(Data.FOR_EXPORT_ONLY, "1") - .build(); - final String selection = Data.CONTACT_ID + "=?"; - final String[] selectionArgs = new String[] {contactId}; + // Please note that this branch is executed by some tests only try { entityIterator = (EntityIterator)getEntityIteratorMethod.invoke(null, mContentResolver, uri, selection, selectionArgs, null); @@ -528,13 +530,8 @@ public class VCardComposer { e.getCause().getMessage()); } } else { - final Uri uri = RawContacts.CONTENT_URI.buildUpon() - .appendEncodedPath(contactId) - .appendEncodedPath(RawContacts.Entity.CONTENT_DIRECTORY) - .appendQueryParameter(Data.FOR_EXPORT_ONLY, "1") - .build(); entityIterator = RawContacts.newEntityIterator(mContentResolver.query( - uri, null, null, null, null)); + uri, null, selection, selectionArgs, null)); } if (entityIterator == null) { |