Fix crash from using third party gallery apps
am: 84b1654c1d
Change-Id: Id9cbb149aa86332ab60a4f8d06a51d62be169b19
diff --git a/src/com/android/contacts/detail/PhotoSelectionHandler.java b/src/com/android/contacts/detail/PhotoSelectionHandler.java
index 56d3d66..3053714 100644
--- a/src/com/android/contacts/detail/PhotoSelectionHandler.java
+++ b/src/com/android/contacts/detail/PhotoSelectionHandler.java
@@ -127,17 +127,16 @@
switch (requestCode) {
// Cropped photo was returned
case REQUEST_CROP_PHOTO: {
- final Uri uri;
if (data != null && data.getData() != null) {
- uri = data.getData();
- } else {
- uri = mCroppedPhotoUri;
+ final Uri croppedUri = data.getData();
+ ContactPhotoUtils.savePhotoFromUriToUri(mContext, croppedUri,
+ mCroppedPhotoUri, /* deleteAfterSave */ false);
}
try {
// delete the original temporary photo if it exists
mContext.getContentResolver().delete(mTempPhotoUri, null, null);
- listener.onPhotoSelected(uri);
+ listener.onPhotoSelected(mCroppedPhotoUri);
return true;
} catch (FileNotFoundException e) {
return false;