summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblong <blong@codeaurora.org>2015-07-17 16:07:35 +0800
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:29:19 -0600
commit22b057b0863763c2f4634935dd09c15e3f1e11d7 (patch)
tree7c0827a68f5c89df6ab25c46583bb2c82e68316f
parentb5f51a734ff5c957dd407fbb985bfabf5c5e5dec (diff)
downloadandroid_frameworks_opt_vcard-cm-13.0.tar.gz
android_frameworks_opt_vcard-cm-13.0.tar.bz2
android_frameworks_opt_vcard-cm-13.0.zip
Enlarge the batch size to reduce db times and save importing time. Change-Id: Ic5e259abeefb2081d454d7444ff94a456cea7419 CRs-Fixed: 875712
-rw-r--r--java/com/android/vcard/VCardEntryCommitter.java7
1 files changed, 6 insertions, 1 deletions
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 @@ public class VCardEntryCommitter implements VCardEntryHandler {
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;