Make contacts photo pickers compatible with new documents UI
The old contacts photo picker code was using unguaranteed behavior
(that Intent.GET_CONTENT would support MediaStore.EXTRA_OUTPUT) and this
caused it to not work anymore with the new document picker.
This CL changes all usages of files to instead use URIs.
Also, a FileProvider has been added to Contacts, to allow us to pass in
URI pointing to our private cache in intent.setClipData with
Intent.FLAG_GRANT_WRITE_URI_PERMISSION and Intent.FLAG_GRANT_READ_URI_PERMISSION
so we no longer have to reply on the MediaStore.EXTRA_OUTPUT being parsed
and supported. The use of the FileProvider also prevents unauthorized access
to temporary files during the caching process.
Bug: 10745342
Change-Id: Iaee3d7d112dd124a2f5596c4b9704ea75d3b3419
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 7bbdc60..bae0341 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -498,6 +498,16 @@
</intent-filter>
</service>
+ <provider
+ android:name="android.support.v4.content.FileProvider"
+ android:authorities="com.android.contacts.files"
+ android:grantUriPermissions="true"
+ android:exported="false">
+ <meta-data
+ android:name="android.support.FILE_PROVIDER_PATHS"
+ android:resource="@xml/file_paths" />
+ </provider>
+
<meta-data android:name="android.nfc.disable_beam_default" android:value="true" />
</application>
</manifest>