Avoid crash when re-saving new contact with photo.
This bug was encountered when creating a new contact from Maps,
but could happen any time you:
- create a new contact
- set a contact photo, either from the gallery or a new photo
- save contact but don't leave ContactEditorFragment
(eg: "Join" cause the contact to be saved)
- edit another field
- save
The fix is to clear the list of photos-to-save after each save.
Bug: 6432438
Change-Id: I63e86bd82fd16b8177bdca741ecc7a1a90d22d18
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 5a6a3b6..7d9f510 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -1027,8 +1027,11 @@
Intent intent = ContactSaveService.createSaveContactIntent(getActivity(), mState,
SAVE_MODE_EXTRA_KEY, saveMode, isEditingUserProfile(), getActivity().getClass(),
ContactEditorActivity.ACTION_SAVE_COMPLETED, mUpdatedPhotos);
-
getActivity().startService(intent);
+
+ // Don't try to save the same photos twice.
+ mUpdatedPhotos = new Bundle();
+
return true;
}