diff options
author | Paul Soulos <psoulos@google.com> | 2014-09-12 10:45:43 -0700 |
---|---|---|
committer | Paul Soulos <psoulos@google.com> | 2014-09-17 23:40:39 +0000 |
commit | fc98ff91106de05bef5b59c3a21ed4ac724847fe (patch) | |
tree | f4d4e87c7d741d779d4a242a2dc9b3256bcf7c22 | |
parent | bb28b10139a0a31c530043067c0a34b8571c0694 (diff) | |
download | packages_apps_Contacts-fc98ff91106de05bef5b59c3a21ed4ac724847fe.tar.gz packages_apps_Contacts-fc98ff91106de05bef5b59c3a21ed4ac724847fe.tar.bz2 packages_apps_Contacts-fc98ff91106de05bef5b59c3a21ed4ac724847fe.zip |
Fixes photo authority issues in Contacts
bug: 17462942
Change-Id: Ie67a2a3643cddff7fe83f1a5571ef027617cfa74
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/com/android/contacts/util/ContactPhotoUtils.java | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 2d3940763..6a903eca5 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -722,4 +722,7 @@ <!-- Prefix for messages that you sent [CHAR LIMIT=40] --> <string name="message_from_you_prefix">You: <xliff:g id="sms_body">%s</xliff:g></string> + <!-- File Authority for the photo picker --> + <string name="photo_file_provider_authority">com.android.contacts.files</string> + </resources> diff --git a/src/com/android/contacts/util/ContactPhotoUtils.java b/src/com/android/contacts/util/ContactPhotoUtils.java index 2b1c19a28..3f79da5b7 100644 --- a/src/com/android/contacts/util/ContactPhotoUtils.java +++ b/src/com/android/contacts/util/ContactPhotoUtils.java @@ -28,6 +28,7 @@ import android.provider.MediaStore; import android.support.v4.content.FileProvider; import android.util.Log; +import com.android.contacts.R; import com.google.common.io.Closeables; import java.io.ByteArrayOutputStream; @@ -49,8 +50,6 @@ public class ContactPhotoUtils { private static final String PHOTO_DATE_FORMAT = "'IMG'_yyyyMMdd_HHmmss"; - public static final String FILE_PROVIDER_AUTHORITY = "com.android.contacts.files"; - /** * Generate a new, unique file to be used as an out-of-band communication * channel, since hi-res Bitmaps are too big to serialize into a Bundle. @@ -58,12 +57,16 @@ public class ContactPhotoUtils { * cropper/etc.), and read by us once they are finished writing it. */ public static Uri generateTempImageUri(Context context) { - return FileProvider.getUriForFile(context, FILE_PROVIDER_AUTHORITY, + final String fileProviderAuthority = context.getResources().getString( + R.string.photo_file_provider_authority); + return FileProvider.getUriForFile(context, fileProviderAuthority, new File(pathForTempPhoto(context, generateTempPhotoFileName()))); } public static Uri generateTempCroppedImageUri(Context context) { - return FileProvider.getUriForFile(context, FILE_PROVIDER_AUTHORITY, + final String fileProviderAuthority = context.getResources().getString( + R.string.photo_file_provider_authority); + return FileProvider.getUriForFile(context, fileProviderAuthority, new File(pathForTempPhoto(context, generateTempCroppedPhotoFileName()))); } |