Merge "Grant Permanent Write Uri Permission" into main am: 9064d7280d

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Contacts/+/2746696

Change-Id: I315e66915d70c1c7acd48025164fe86547f51404
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/contacts/vcard/ExportProcessor.java b/src/com/android/contacts/vcard/ExportProcessor.java
index 0b96ea1..fd5134c 100755
--- a/src/com/android/contacts/vcard/ExportProcessor.java
+++ b/src/com/android/contacts/vcard/ExportProcessor.java
@@ -81,6 +81,12 @@
         mExportRequest = exportRequest;
         mJobId = jobId;
         mCallingActivity = callingActivity;
+        try {
+            mResolver.takePersistableUriPermission(exportRequest.destUri,
+                    Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
+        } catch (SecurityException e) {
+            Log.w(LOG_TAG, "SecurityException error", e);
+        }
     }
 
     @Override