Fix ConcurrentModificationException
ConcurrentModificationException could be happened during iterating if
parts are added newly.
Test: Select several images on Gallery app and attach them to a message
via Sharing
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
Change-Id: Idb96239ef2c05a08fc0727797b97739aa89f12a4
diff --git a/src/com/android/messaging/ui/conversation/ComposeMessageView.java b/src/com/android/messaging/ui/conversation/ComposeMessageView.java
index 0f36e9a..c35927e 100644
--- a/src/com/android/messaging/ui/conversation/ComposeMessageView.java
+++ b/src/com/android/messaging/ui/conversation/ComposeMessageView.java
@@ -72,6 +72,7 @@
import com.android.messaging.util.UiUtils;
import com.android.messaging.util.UriUtil;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -683,7 +684,8 @@
final boolean hasWorkingDraft = hasMessageText || hasSubject ||
mBinding.getData().hasAttachments();
- final List<MessagePartData> attachments = draftMessageData.getReadOnlyAttachments();
+ final List<MessagePartData> attachments =
+ new ArrayList<MessagePartData>(draftMessageData.getReadOnlyAttachments());
if (draftMessageData.getIsMms()) { // MMS case
if (draftMessageData.hasAttachments()) {
if (hasAttachmentsChanged) {