Grant Permanent Write Uri Permission
ExportProcessor can't get write uri permission after ExportVcardActivity is destroyed. Sometimes export thread is not finished before ExportVcardActivity onDestroyed. Need grant persistable permission to avoid this scenario.
Bug: 300036667
Change-Id: I9fd5d4d8acccb75fbe1660d69247074b03a8f255
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