diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2010-03-23 17:09:01 -0700 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2010-03-23 17:09:01 -0700 |
commit | 992edb8d6ec6382fc64e6106cff8a8a121a30b7e (patch) | |
tree | 7d736c575aea94af53adfb613b9d3ad980ae8ad2 | |
parent | 3b10d3a1ed1052dcdf529da370cb71b74164b158 (diff) | |
download | ContactsProvider-992edb8d6ec6382fc64e6106cff8a8a121a30b7e.tar.gz |
Fixing an issue with legacy contact import.
The issue is that the importer set the is_primary flag, but
not the is_superprimary flag.
Bug: 2535177
Change-Id: I32e11d1bb9c1068781d1a734256a223f75543e7f
-rw-r--r-- | src/com/android/providers/contacts/LegacyContactImporter.java | 67 | ||||
-rw-r--r-- | tests/assets/test1/expected_data.txt | 8 | ||||
-rw-r--r-- | tests/assets/testSynced/expected_data.txt | 24 | ||||
-rw-r--r-- | tests/assets/testUnsynced/expected_data.txt | 12 |
4 files changed, 64 insertions, 47 deletions
diff --git a/src/com/android/providers/contacts/LegacyContactImporter.java b/src/com/android/providers/contacts/LegacyContactImporter.java index fcbae68d..00982151 100644 --- a/src/com/android/providers/contacts/LegacyContactImporter.java +++ b/src/com/android/providers/contacts/LegacyContactImporter.java @@ -693,19 +693,21 @@ public class LegacyContactImporter { Data.RAW_CONTACT_ID + "," + DataColumns.MIMETYPE_ID + "," + Data.IS_PRIMARY + "," + + Data.IS_SUPER_PRIMARY + "," + Organization.COMPANY + "," + Organization.TITLE + "," + Organization.TYPE + "," + Organization.LABEL + - ") VALUES (?,?,?,?,?,?,?)"; + ") VALUES (?,?,?,?,?,?,?,?)"; int RAW_CONTACT_ID = 1; int MIMETYPE_ID = 2; int IS_PRIMARY = 3; - int COMPANY = 4; - int TITLE = 5; - int TYPE = 6; - int LABEL = 7; + int IS_SUPER_PRIMARY = 4; + int COMPANY = 5; + int TITLE = 6; + int TYPE = 7; + int LABEL = 8; } private void importOrganizations() { @@ -727,6 +729,8 @@ public class LegacyContactImporter { insert.bindLong(OrganizationInsert.RAW_CONTACT_ID, id); insert.bindLong(OrganizationInsert.MIMETYPE_ID, mOrganizationMimetypeId); bindString(insert, OrganizationInsert.IS_PRIMARY, c.getString(OrganizationsQuery.ISPRIMARY)); + bindString(insert, OrganizationInsert.IS_SUPER_PRIMARY, + c.getString(OrganizationsQuery.ISPRIMARY)); bindString(insert, OrganizationInsert.COMPANY, c.getString(OrganizationsQuery.COMPANY)); bindString(insert, OrganizationInsert.TITLE, c.getString(OrganizationsQuery.TITLE)); bindString(insert, OrganizationInsert.TYPE, c.getString(OrganizationsQuery.TYPE)); @@ -755,19 +759,21 @@ public class LegacyContactImporter { Data.RAW_CONTACT_ID + "," + DataColumns.MIMETYPE_ID + "," + Data.IS_PRIMARY + "," + + Data.IS_SUPER_PRIMARY + "," + Email.DATA + "," + Email.TYPE + "," + Email.LABEL + "," + Data.DATA14 + - ") VALUES (?,?,?,?,?,?,?)"; + ") VALUES (?,?,?,?,?,?,?,?)"; int RAW_CONTACT_ID = 1; int MIMETYPE_ID = 2; int IS_PRIMARY = 3; - int DATA = 4; - int TYPE = 5; - int LABEL = 6; - int AUX_DATA = 7; + int IS_SUPER_PRIMARY = 4; + int DATA = 5; + int TYPE = 6; + int LABEL = 7; + int AUX_DATA = 8; } private interface ImInsert { @@ -775,19 +781,21 @@ public class LegacyContactImporter { Data.RAW_CONTACT_ID + "," + DataColumns.MIMETYPE_ID + "," + Data.IS_PRIMARY + "," + + Data.IS_SUPER_PRIMARY + "," + Im.DATA + "," + Im.TYPE + "," + Im.LABEL + "," + Data.DATA14 + - ") VALUES (?,?,?,?,?,?,?)"; + ") VALUES (?,?,?,?,?,?,?,?)"; int RAW_CONTACT_ID = 1; int MIMETYPE_ID = 2; int IS_PRIMARY = 3; - int DATA = 4; - int TYPE = 5; - int LABEL = 6; - int AUX_DATA = 7; + int IS_SUPER_PRIMARY = 4; + int DATA = 5; + int TYPE = 6; + int LABEL = 7; + int AUX_DATA = 8; } private interface PostalInsert { @@ -795,19 +803,21 @@ public class LegacyContactImporter { Data.RAW_CONTACT_ID + "," + DataColumns.MIMETYPE_ID + "," + Data.IS_PRIMARY + "," + + Data.IS_SUPER_PRIMARY + "," + StructuredPostal.FORMATTED_ADDRESS + "," + StructuredPostal.TYPE + "," + StructuredPostal.LABEL + "," + Data.DATA14 + - ") VALUES (?,?,?,?,?,?,?)"; + ") VALUES (?,?,?,?,?,?,?,?)"; int RAW_CONTACT_ID = 1; int MIMETYPE_ID = 2; int IS_PRIMARY = 3; - int DATA = 4; - int TYPE = 5; - int LABEL = 6; - int AUX_DATA = 7; + int IS_SUPER_PRIMARY = 4; + int DATA = 5; + int TYPE = 6; + int LABEL = 7; + int AUX_DATA = 8; } private void importContactMethods() { @@ -849,6 +859,7 @@ public class LegacyContactImporter { insert.bindLong(EmailInsert.RAW_CONTACT_ID, personId); insert.bindLong(EmailInsert.MIMETYPE_ID, mEmailMimetypeId); bindString(insert, EmailInsert.IS_PRIMARY, c.getString(ContactMethodsQuery.ISPRIMARY)); + bindString(insert, EmailInsert.IS_SUPER_PRIMARY, c.getString(ContactMethodsQuery.ISPRIMARY)); bindString(insert, EmailInsert.DATA, email); bindString(insert, EmailInsert.AUX_DATA, c.getString(ContactMethodsQuery.AUX_DATA)); bindString(insert, EmailInsert.TYPE, c.getString(ContactMethodsQuery.TYPE)); @@ -864,6 +875,7 @@ public class LegacyContactImporter { insert.bindLong(ImInsert.RAW_CONTACT_ID, personId); insert.bindLong(ImInsert.MIMETYPE_ID, mImMimetypeId); bindString(insert, ImInsert.IS_PRIMARY, c.getString(ContactMethodsQuery.ISPRIMARY)); + bindString(insert, ImInsert.IS_SUPER_PRIMARY, c.getString(ContactMethodsQuery.ISPRIMARY)); bindString(insert, ImInsert.DATA, c.getString(ContactMethodsQuery.DATA)); bindString(insert, ImInsert.AUX_DATA, c.getString(ContactMethodsQuery.AUX_DATA)); bindString(insert, ImInsert.TYPE, c.getString(ContactMethodsQuery.TYPE)); @@ -877,6 +889,8 @@ public class LegacyContactImporter { insert.bindLong(PostalInsert.RAW_CONTACT_ID, personId); insert.bindLong(PostalInsert.MIMETYPE_ID, mPostalMimetypeId); bindString(insert, PostalInsert.IS_PRIMARY, c.getString(ContactMethodsQuery.ISPRIMARY)); + bindString(insert, PostalInsert.IS_SUPER_PRIMARY, + c.getString(ContactMethodsQuery.ISPRIMARY)); bindString(insert, PostalInsert.DATA, c.getString(ContactMethodsQuery.DATA)); bindString(insert, PostalInsert.AUX_DATA, c.getString(ContactMethodsQuery.AUX_DATA)); bindString(insert, PostalInsert.TYPE, c.getString(ContactMethodsQuery.TYPE)); @@ -903,19 +917,21 @@ public class LegacyContactImporter { Data.RAW_CONTACT_ID + "," + DataColumns.MIMETYPE_ID + "," + Data.IS_PRIMARY + "," + + Data.IS_SUPER_PRIMARY + "," + Phone.NUMBER + "," + Phone.TYPE + "," + Phone.LABEL + "," + PhoneColumns.NORMALIZED_NUMBER + - ") VALUES (?,?,?,?,?,?,?)"; + ") VALUES (?,?,?,?,?,?,?,?)"; int RAW_CONTACT_ID = 1; int MIMETYPE_ID = 2; int IS_PRIMARY = 3; - int NUMBER = 4; - int TYPE = 5; - int LABEL = 6; - int NORMALIZED_NUMBER = 7; + int IS_SUPER_PRIMARY = 4; + int NUMBER = 5; + int TYPE = 6; + int LABEL = 7; + int NORMALIZED_NUMBER = 8; } private interface PhoneLookupInsert { @@ -971,6 +987,7 @@ public class LegacyContactImporter { phoneInsert.bindLong(PhoneInsert.RAW_CONTACT_ID, id); phoneInsert.bindLong(PhoneInsert.MIMETYPE_ID, mPhoneMimetypeId); bindString(phoneInsert, PhoneInsert.IS_PRIMARY, c.getString(PhonesQuery.ISPRIMARY)); + bindString(phoneInsert, PhoneInsert.IS_SUPER_PRIMARY, c.getString(PhonesQuery.ISPRIMARY)); bindString(phoneInsert, PhoneInsert.NUMBER, number); bindString(phoneInsert, PhoneInsert.TYPE, c.getString(PhonesQuery.TYPE)); bindString(phoneInsert, PhoneInsert.LABEL, c.getString(PhonesQuery.LABEL)); diff --git a/tests/assets/test1/expected_data.txt b/tests/assets/test1/expected_data.txt index 5a3447c9..49dab125 100644 --- a/tests/assets/test1/expected_data.txt +++ b/tests/assets/test1/expected_data.txt @@ -180,7 +180,7 @@ 180 data14=null 181 data15=null 182 is_primary=1 -183 is_super_primary=0 +183 is_super_primary=1 184 data_version=0 185 data_sync1=null 186 data_sync2=null @@ -423,7 +423,7 @@ 423 data14=null 424 data15=null 425 is_primary=1 -426 is_super_primary=0 +426 is_super_primary=1 427 data_version=0 428 data_sync1=null 429 data_sync2=null @@ -450,7 +450,7 @@ 450 data14=null 451 data15=null 452 is_primary=1 -453 is_super_primary=0 +453 is_super_primary=1 454 data_version=0 455 data_sync1=null 456 data_sync2=null @@ -774,7 +774,7 @@ 774 data14=null 775 data15=null 776 is_primary=1 -777 is_super_primary=0 +777 is_super_primary=1 778 data_version=0 779 data_sync1=null 780 data_sync2=null diff --git a/tests/assets/testSynced/expected_data.txt b/tests/assets/testSynced/expected_data.txt index 4cbb294b..6ea7568a 100644 --- a/tests/assets/testSynced/expected_data.txt +++ b/tests/assets/testSynced/expected_data.txt @@ -234,7 +234,7 @@ 234 data14=null 235 data15=null 236 is_primary=1 -237 is_super_primary=0 +237 is_super_primary=1 238 data_version=0 239 data_sync1=null 240 data_sync2=null @@ -261,7 +261,7 @@ 261 data14=null 262 data15=null 263 is_primary=1 -264 is_super_primary=0 +264 is_super_primary=1 265 data_version=0 266 data_sync1=null 267 data_sync2=null @@ -288,7 +288,7 @@ 288 data14=null 289 data15=null 290 is_primary=1 -291 is_super_primary=0 +291 is_super_primary=1 292 data_version=0 293 data_sync1=null 294 data_sync2=null @@ -315,7 +315,7 @@ 315 data14=null 316 data15=null 317 is_primary=1 -318 is_super_primary=0 +318 is_super_primary=1 319 data_version=0 320 data_sync1=null 321 data_sync2=null @@ -342,7 +342,7 @@ 342 data14=null 343 data15=null 344 is_primary=1 -345 is_super_primary=0 +345 is_super_primary=1 346 data_version=0 347 data_sync1=null 348 data_sync2=null @@ -369,7 +369,7 @@ 369 data14=null 370 data15=null 371 is_primary=1 -372 is_super_primary=0 +372 is_super_primary=1 373 data_version=0 374 data_sync1=null 375 data_sync2=null @@ -396,7 +396,7 @@ 396 data14=null 397 data15=null 398 is_primary=1 -399 is_super_primary=0 +399 is_super_primary=1 400 data_version=0 401 data_sync1=null 402 data_sync2=null @@ -423,7 +423,7 @@ 423 data14=null 424 data15=null 425 is_primary=1 -426 is_super_primary=0 +426 is_super_primary=1 427 data_version=0 428 data_sync1=null 429 data_sync2=null @@ -450,7 +450,7 @@ 450 data14=null 451 data15=null 452 is_primary=1 -453 is_super_primary=0 +453 is_super_primary=1 454 data_version=0 455 data_sync1=null 456 data_sync2=null @@ -477,7 +477,7 @@ 477 data14=null 478 data15=null 479 is_primary=1 -480 is_super_primary=0 +480 is_super_primary=1 481 data_version=0 482 data_sync1=null 483 data_sync2=null @@ -504,7 +504,7 @@ 504 data14=null 505 data15=null 506 is_primary=1 -507 is_super_primary=0 +507 is_super_primary=1 508 data_version=0 509 data_sync1=null 510 data_sync2=null @@ -807,4 +807,4 @@ 807 data_sync2=null 808 data_sync3=null 809 data_sync4=null -810 }
\ No newline at end of file +810 } diff --git a/tests/assets/testUnsynced/expected_data.txt b/tests/assets/testUnsynced/expected_data.txt index 4571f754..ecf480c0 100644 --- a/tests/assets/testUnsynced/expected_data.txt +++ b/tests/assets/testUnsynced/expected_data.txt @@ -99,7 +99,7 @@ 99 data14=null 100 data15=null 101 is_primary=1 -102 is_super_primary=0 +102 is_super_primary=1 103 data_version=0 104 data_sync1=null 105 data_sync2=null @@ -126,7 +126,7 @@ 126 data14=null 127 data15=null 128 is_primary=1 -129 is_super_primary=0 +129 is_super_primary=1 130 data_version=0 131 data_sync1=null 132 data_sync2=null @@ -153,7 +153,7 @@ 153 data14=null 154 data15=null 155 is_primary=1 -156 is_super_primary=0 +156 is_super_primary=1 157 data_version=0 158 data_sync1=null 159 data_sync2=null @@ -180,7 +180,7 @@ 180 data14=null 181 data15=null 182 is_primary=1 -183 is_super_primary=0 +183 is_super_primary=1 184 data_version=0 185 data_sync1=null 186 data_sync2=null @@ -207,7 +207,7 @@ 207 data14=null 208 data15=null 209 is_primary=1 -210 is_super_primary=0 +210 is_super_primary=1 211 data_version=0 212 data_sync1=null 213 data_sync2=null @@ -234,7 +234,7 @@ 234 data14=null 235 data15=null 236 is_primary=1 -237 is_super_primary=0 +237 is_super_primary=1 238 data_version=0 239 data_sync1=null 240 data_sync2=null |