Performance: Fix importing vcard slowly problem
Enlarge the batch size to reduce db times and save importing time.
Change-Id: Ic5e259abeefb2081d454d7444ff94a456cea7419
CRs-Fixed: 875712
diff --git a/java/com/android/vcard/VCardEntryCommitter.java b/java/com/android/vcard/VCardEntryCommitter.java
index 7f8e885..17e0318 100644
--- a/java/com/android/vcard/VCardEntryCommitter.java
+++ b/java/com/android/vcard/VCardEntryCommitter.java
@@ -70,7 +70,12 @@
final long start = System.currentTimeMillis();
mOperationList = vcardEntry.constructInsertOperations(mContentResolver, mOperationList);
mCounter++;
- if (mCounter >= 20) {
+ //because the max batch size is 500 defined in ContactsProvider,so we enlarge this batch
+ //size to at least 460, when the batch size is bigger than it,the batch operation will be
+ //excuted. this could save db times when the batch size is more bigger, for example, for
+ //10000 contacts data, if batch size is 20, it needs excute 500 times while batch size is
+ //500, it only needs excute 20 times.
+ if (mOperationList != null && mOperationList.size() >= 460) {
mCreatedUris.add(pushIntoContentResolver(mOperationList));
mCounter = 0;
mOperationList = null;