From 63fce00e8cefd20c94d4d2fd938177e030f79405 Mon Sep 17 00:00:00 2001 From: wangjing Date: Mon, 13 Apr 2015 15:32:26 +0800 Subject: Contacts: Can not export contacts to SIM card properly If failed to export contact to SIM card, it does not reset emptyNumber and emptyEmail to the value before the insert operation, as a result, we can not export contacts to SIM properly. When failed to export contact to SIM and try to continue the loop, we should reset emptyNumber and emptyAnr and emptyEmail to the value before the insert operation. Change-Id: I8ac8631de0e3feae89cb8e2052e65b4dd4e2cf8d CRs-Fixed: 811721 --- .../interactions/ImportExportDialogFragment.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java index ef99300a..63fe01d6 100755 --- a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java +++ b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java @@ -580,6 +580,26 @@ public class ImportExportDialogFragment extends AnalyticsDialogFragment TOAST_EXPORT_FAILED, insertCount, 0)); break; } else { + // Failed to insert to SIM card + int anrNumber = 0; + if (!TextUtils.isEmpty(anrNum)) { + anrNumber += anrNum.toString().split( + SimContactsConstants.ANR_SEP).length; + } + // reset emptyNumber and emptyAnr to the value before + // the insert operation + emptyAnr += anrNumber; + emptyNumber += anrNumber; + if (!TextUtils.isEmpty(num)) { + emptyNumber++; + } + + if (!TextUtils.isEmpty(email)) { + // reset emptyEmail to the value before the insert + // operation + emptyEmail += email.toString().split( + SimContactsConstants.EMAIL_SEP).length; + } continue; } } -- cgit v1.2.3