summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblong <blong@codeaurora.org>2016-09-13 15:56:20 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-13 01:04:59 -0700
commit5af0e504b6a50cdae2b10f793de5f664bc2458b5 (patch)
tree98f721f709cd71abe183d72bc15ed2531a4a8dd7
parent8a6d154b8d18971578f0bfe520b732bd7464b981 (diff)
downloadpackages_apps_Contacts-5af0e504b6a50cdae2b10f793de5f664bc2458b5.tar.gz
packages_apps_Contacts-5af0e504b6a50cdae2b10f793de5f664bc2458b5.tar.bz2
packages_apps_Contacts-5af0e504b6a50cdae2b10f793de5f664bc2458b5.zip
Fix unnecessary update command send to sim card
- If sim contacts info has no change, don't send update command to sim card. Change-Id: Id0aaf4e8a4db0cebcc0bb661f4b84529b7282a09 CRs-Fixed: 1064995
-rwxr-xr-xsrc/com/android/contacts/activities/MergeContactActivity.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/contacts/activities/MergeContactActivity.java b/src/com/android/contacts/activities/MergeContactActivity.java
index 7604e8ec2..5402e565d 100755
--- a/src/com/android/contacts/activities/MergeContactActivity.java
+++ b/src/com/android/contacts/activities/MergeContactActivity.java
@@ -236,6 +236,7 @@ public class MergeContactActivity extends ListActivity {
List<String> simNumberList = new ArrayList<>();
List<String> simEmailList = new ArrayList<>();
+ boolean needUpdate = false;
int subscription = -1;
ArrayList<Long> delContactIds = new ArrayList<>();
HashMap<Long, ArrayList<Long>> delRawIdsMap = new HashMap<>();
@@ -309,6 +310,7 @@ public class MergeContactActivity extends ListActivity {
}
}
if (!containsNumber) {
+ needUpdate = true;
simNumberList.add(number);
}
}
@@ -326,6 +328,7 @@ public class MergeContactActivity extends ListActivity {
}
}
if (!containsAnr) {
+ needUpdate = true;
simNumberList.add(splitAnr[j]);
}
}
@@ -337,6 +340,7 @@ public class MergeContactActivity extends ListActivity {
for (int j = 0; j < splitEmail.length; j++) {
if (!TextUtils.isEmpty(splitEmail[j]) && !simEmailList
.contains(splitEmail[j])) {
+ needUpdate = true;
simEmailList.add(splitEmail[j]);
}
}
@@ -383,7 +387,9 @@ public class MergeContactActivity extends ListActivity {
sourceValues.remove(SimContactsConstants.ACCOUNT_TYPE);
sourceValues.remove(SimContactsConstants.ACCOUNT_NAME);
// update the contacts in sim.
- int simResult = mSimContactsOperation.update(sourceValues, subscription);
+ int simResult = 1;
+ if (needUpdate)
+ mSimContactsOperation.update(sourceValues, subscription);
// if update sim contacts fail, stop merging.
if (simResult <= 0) {
@@ -415,6 +421,9 @@ public class MergeContactActivity extends ListActivity {
.CONTENT_URI, String.valueOf(list.get(j)));
rawDelList.add(ContentProviderOperation.newDelete(uri).build());
}
+ } else {
+ Toast.makeText(MergeContactActivity.this, R.string.merge_fail,
+ Toast.LENGTH_SHORT).show();
}
}
return true;