From 241778348a2195ea4979acbe836d9af26b101e11 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 18 Jan 2023 08:44:45 +0100 Subject: [PATCH] Debug: persisted URIs --- app/src/main/java/eu/faircode/email/Log.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 966ccbdb71..cc8b0245f5 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -32,6 +32,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.content.UriPermission; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -2857,6 +2858,21 @@ public class Log { long size = 0; File file = attachment.getFile(context); try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) { + try { + List uperms = context.getContentResolver().getPersistedUriPermissions(); + if (uperms != null) + for (UriPermission uperm : uperms) { + size += write(os, String.format("%s r=%b w=%b %s\r\n", + uperm.getUri().toString(), + uperm.isReadPermission(), + uperm.isWritePermission(), + new Date(uperm.getPersistedTime()))); + } + } catch (Throwable ex) { + size += write(os, String.format("%s\r\n", ex)); + } + size += write(os, "\r\n"); + try { PackageInfo pi = context.getPackageManager() .getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_PERMISSIONS);